diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b4adf51e3b0..5933969590e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -22,6 +22,7 @@ "packages/google-cloud-deploy": "2.2.2", "packages/google-cloud-dialogflow": "5.3.0", "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-iot": "3.1.2", diff --git a/packages/google-cloud-documentai/.OwlBot.yaml b/packages/google-cloud-documentai/.OwlBot.yaml new file mode 100644 index 00000000000..5e095ce5be2 --- /dev/null +++ b/packages/google-cloud-documentai/.OwlBot.yaml @@ -0,0 +1,20 @@ +# 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. + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/documentai/(.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-documentai/$1 diff --git a/packages/google-cloud-documentai/.eslintignore b/packages/google-cloud-documentai/.eslintignore new file mode 100644 index 00000000000..ea5b04aebe6 --- /dev/null +++ b/packages/google-cloud-documentai/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ +samples/generated/ 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/.gitattributes b/packages/google-cloud-documentai/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-documentai/.gitattributes @@ -0,0 +1,4 @@ +*.ts text eol=lf +*.js text eol=lf +protos/* linguist-generated +**/api-extractor.json linguist-language=JSON-with-Comments diff --git a/packages/google-cloud-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..75c76e52a54 --- /dev/null +++ b/packages/google-cloud-documentai/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/documentai', + 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..cdb7b752160 --- /dev/null +++ b/packages/google-cloud-documentai/.mocharc.js @@ -0,0 +1,29 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000, + "recursive": true +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/packages/google-cloud-documentai/.nycrc b/packages/google-cloud-documentai/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /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", + "**/protos", + "**/test", + "**/*.d.ts", + ".jsdoc.js", + "**/.jsdoc.js", + "karma.conf.js", + "webpack-tests.config.js", + "webpack.config.js" + ], + "exclude-after-remap": false, + "all": true +} diff --git a/packages/google-cloud-documentai/.prettierignore b/packages/google-cloud-documentai/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-documentai/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-documentai/.prettierrc.js b/packages/google-cloud-documentai/.prettierrc.js new file mode 100644 index 00000000000..d546a4ad546 --- /dev/null +++ b/packages/google-cloud-documentai/.prettierrc.js @@ -0,0 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/.repo-metadata.json b/packages/google-cloud-documentai/.repo-metadata.json new file mode 100644 index 00000000000..bd9f0e591b4 --- /dev/null +++ b/packages/google-cloud-documentai/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "name": "documentai", + "name_pretty": "Document AI", + "product_documentation": "https://cloud.google.com/document-ai/docs/", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/documentai/latest", + "issue_tracker": "", + "release_level": "stable", + "language": "nodejs", + "repo": "googleapis/google-cloud-node", + "distribution_name": "@google-cloud/documentai", + "api_id": "documentai.googleapis.com", + "requires_billing": true, + "codeowner_team": "@googleapis/ml-apis", + "default_version": "v1", + "api_shortname": "documentai", + "library_type": "GAPIC_AUTO" +} diff --git a/packages/google-cloud-documentai/CHANGELOG.md b/packages/google-cloud-documentai/CHANGELOG.md new file mode 100644 index 00000000000..f144e97701e --- /dev/null +++ b/packages/google-cloud-documentai/CHANGELOG.md @@ -0,0 +1,291 @@ +# 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) + + +### ⚠ 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) + + +### ⚠ 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) + + +### 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) + + +### ⚠ 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### ⚠ 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### 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) + + +### ⚠ 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) + + +### ⚠ 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/CODE_OF_CONDUCT.md b/packages/google-cloud-documentai/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..2add2547a81 --- /dev/null +++ b/packages/google-cloud-documentai/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/packages/google-cloud-documentai/CONTRIBUTING.md b/packages/google-cloud-documentai/CONTRIBUTING.md new file mode 100644 index 00000000000..7bd13312a09 --- /dev/null +++ b/packages/google-cloud-documentai/CONTRIBUTING.md @@ -0,0 +1,76 @@ +# How to become a contributor and submit your own code + +**Table of contents** + +* [Contributor License Agreements](#contributor-license-agreements) +* [Contributing a patch](#contributing-a-patch) +* [Running the tests](#running-the-tests) +* [Releasing the library](#releasing-the-library) + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the code to which + you are contributing. +1. Ensure that your code has an appropriate set of tests which all pass. +1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. +1. Submit a pull request. + +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [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]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + # Run unit tests. + npm test + + # Run sample integration tests. + npm run samples-test + + # Run all system tests. + npm run system-test + +1. Lint (and maybe fix) any changes: + + npm run fix + +[setup]: https://cloud.google.com/nodejs/docs/setup +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[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/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..58ebf7d8167 --- /dev/null +++ b/packages/google-cloud-documentai/README.md @@ -0,0 +1,246 @@ +[//]: # "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 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) + + + + +Document AI client for Node.js + + +A comprehensive list of changes in each version may be found in +[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/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]. + +[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 @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'; // Format is 'us' or 'eu' +// const processorId = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console +// const filePath = '/path/to/local/pdf'; + +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() { + // 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 = { + name, + rawDocument: { + 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} = document; + + // Extract shards from the text field + 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 paragraph of paragraphs) { + const paragraphText = getText(paragraph.layout.textAnchor); + console.log(`Paragraph text:\n${paragraphText}`); + } +} + +``` + + + +## Samples + +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 | +| --------------------------- | --------------------------------- | ------ | +| 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) | + + + +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. +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. + +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: + +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. + +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 + +This library follows [Semantic Versioning](http://semver.org/). + + + +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 **stable** libraries +are addressed with the highest priority. + + + + + + +More Information: [Google Cloud Platform Launch Stages][launch_stages] + +[launch_stages]: https://cloud.google.com/terms/launch-stages + +## Contributing + +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/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`) +are generated from a central template. To edit one of these files, make an edit +to its templates in +[directory](https://github.com/googleapis/synthtool). + +## License + +Apache Version 2.0 + +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/ +[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=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..befd23c8633 --- /dev/null +++ b/packages/google-cloud-documentai/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/packages/google-cloud-documentai/owlbot.py b/packages/google-cloud-documentai/owlbot.py new file mode 100644 index 00000000000..3a0575fbd7d --- /dev/null +++ b/packages/google-cloud-documentai/owlbot.py @@ -0,0 +1,38 @@ +# 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_mono_repo as node +import json +import logging +from pathlib import Path + +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", + "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)*?}", + "" + ) diff --git a/packages/google-cloud-documentai/package.json b/packages/google-cloud-documentai/package.json new file mode 100644 index 00000000000..c344a9ea087 --- /dev/null +++ b/packages/google-cloud-documentai/package.json @@ -0,0 +1,60 @@ +{ + "name": "@google-cloud/documentai", + "version": "6.1.0", + "description": "Document AI client for Node.js", + "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": [ + "build/src", + "build/protos" + ], + "main": "build/src/index.js", + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "docs-test": "linkinator docs", + "fix": "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": "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" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^18.0.0", + "@types/sinon": "^10.0.0", + "c8": "^7.1.0", + "chai": "^4.2.0", + "gts": "^3.1.0", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.0", + "jsdoc-region-tag": "^2.0.0", + "linkinator": "^4.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": "^4.6.4", + "webpack": "^5.0.0", + "webpack-cli": "^4.0.0" + }, + "engines": { + "node": ">=12.0.0" + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-documentai" +} 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/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/google/cloud/documentai/v1/barcode.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto new file mode 100644 index 00000000000..bb841771ade --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 new file mode 100644 index 00000000000..c4fbb21ceca --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -0,0 +1,820 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/barcode.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"; + +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 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 + // 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; + + // 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]. + 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 [deprecated = true]; + } + + // 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 [deprecated = true]; + } + + // 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 [deprecated = true]; + } + + // 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 [deprecated = true]; + } + + // 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 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; + + // The history of this table. + Provenance provenance = 5; + } + + // 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; + + // 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 + // information, see + // https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + string language_code = 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. + 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 list of visually detected symbols on the page. + repeated Symbol symbols = 12; + + // 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 [deprecated = true]; + } + + // 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 { + // 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 + 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; + + // Integer value. + int32 integer_value = 7; + + // Float value. + float float_value = 8; + } + + // 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) = OPTIONAL]; + } + + // 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]; + + // Required. Entity type from a schema e.g. `Address`. + string type = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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]`. + 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. 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. + 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. + // 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. + 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]; + + // 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 + repeated PageRef page_refs = 1; + } + + // Structure to identify provenance relationships between annotations in + // different revisions. + message Provenance { + // The parent element the current element is based on. Used for + // referencing/aligning, removal and replacement operations. + message Parent { + // The index of the index into current revision's parent_ids list. + int32 revision = 1; + + // 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. + int32 id = 2 [deprecated = true]; + } + + // If a processor or agent does an explicit operation on existing elements. + enum OperationType { + // 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. + ADD = 1; + + // Remove an element identified by `parent`. + REMOVE = 2; + + // Replace an element identified by `parent`. + REPLACE = 3; + + // Request human review for the element identified by `parent`. + 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 [deprecated = true]; + + // 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 [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; + + // 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 [deprecated = true]; + } + + // 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]; + + // 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. + repeated Entity entities = 7; + + // 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][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 + // 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; + + // 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 new file mode 100644 index 00000000000..3240d494e8f --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto @@ -0,0 +1,91 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/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; +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][google.cloud.documentai.v1.RawDocument.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; + + // 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. + 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..e748ae1f748 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -0,0 +1,801 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/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"; + +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/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 +// 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) = "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: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}: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: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess" + body: "*" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "BatchProcessResponse" + metadata_type: "BatchProcessMetadata" + }; + } + + // 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) { + 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 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: "*" + } + ]; + + // 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. + // 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; +} + +// 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 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: "*" + } + ]; + + // 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 processing 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 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 { + // 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. + 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" + } + ]; + + // 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; + + // The document schema of the human review task. + DocumentSchema document_schema = 6; +} + +// Response message for review document method. +message ReviewDocumentResponse { + // 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. +message ReviewDocumentOperationMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; + + // 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..ceb25a1d69a --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto @@ -0,0 +1,141 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 new file mode 100644 index 00000000000..7471ef01247 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 = "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 (starts from the top of the image). + 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 (starts from the top of the image). + 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/v1/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto new file mode 100644 index 00000000000..5698b0a4f3c --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto @@ -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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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; + + // A related resource to this operation. + string resource = 5; + + // 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/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto new file mode 100644 index 00000000000..3ffe6927df9 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto @@ -0,0 +1,189 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/cloud/documentai/v1/document_schema.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 schema of the processor version. Describes the output. + DocumentSchema document_schema = 12; + + // 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..2c9ee923051 --- /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 processor type, e.g., `OCR_PROCESSOR`, `INVOICE_PROCESSOR`, etc. + 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/google/cloud/documentai/v1beta1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto new file mode 100644 index 00000000000..aa95ecc2995 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document.proto @@ -0,0 +1,449 @@ +// 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/field_behavior.proto"; +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. +// 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; + + // 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; + + // 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..eb17286d4d5 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/document_understanding.proto @@ -0,0 +1,302 @@ +// 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 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, +// 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..5772db74511 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta1/geometry.proto @@ -0,0 +1,57 @@ +// 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; + + +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. +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/v1beta2/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto new file mode 100644 index 00000000000..a7255d7c1b9 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document.proto @@ -0,0 +1,518 @@ +// 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"; + +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. +// 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; + + // 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; + + // 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]; + } + + // 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; + + // 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]. + 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..137ba5e3116 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/document_understanding.proto @@ -0,0 +1,346 @@ +// 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 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, +// 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. 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..8c97cb995cf --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta2/geometry.proto @@ -0,0 +1,56 @@ +// 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; + + +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. +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/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 new file mode 100644 index 00000000000..809a64ea4c7 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -0,0 +1,782 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/barcode.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"; + +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::V1beta3"; + +// 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 + // 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; + } + + // 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 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; + + // 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 + // information, see + // 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. + 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 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; + } + + // 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 { + // 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 + 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; + + // Integer value. + int32 integer_value = 7; + + // Float value. + float float_value = 8; + } + + // 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) = OPTIONAL]; + } + + // Optional. Provenance of the entity. + // 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. + 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.v1beta3.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.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. 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 + // 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, 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. + 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]; + + // 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 + repeated PageRef page_refs = 1; + } + + // Structure to identify provenance relationships between annotations in + // different revisions. + message Provenance { + // The parent element the current element is based on. Used for + // referencing/aligning, removal and replacement operations. + message Parent { + // The index of the index into current revision's parent_ids list. + int32 revision = 1; + + // 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. + int32 id = 2 [deprecated = true]; + } + + // If a processor or agent does an explicit operation on existing elements. + enum OperationType { + // 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. + ADD = 1; + + // Remove an element identified by `parent`. + REMOVE = 2; + + // Replace an element identified by `parent`. + REPLACE = 3; + + // Request human review for the element identified by `parent`. + 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 [deprecated = true]; + + // 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 [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; + + // 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 { + // 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]; + + // 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]. + 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; + + // 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 + // 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; + + // Placeholder. Revision history of this document. + repeated Revision revisions = 13; +} 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..a0d410c8cb4 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto @@ -0,0 +1,84 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 = "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 new file mode 100644 index 00000000000..952db5904d5 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -0,0 +1,878 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/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"; +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::V1beta3"; +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 +// 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) = "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: "*" + additional_bindings { + post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}: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: "*" + additional_bindings { + post: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess" + body: "*" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "BatchProcessResponse" + metadata_type: "BatchProcessMetadata" + }; + } + + // 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" + }; + 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) = { + get: "/v1beta3/{parent=projects/*/locations/*}/processors" + }; + 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) { + 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" + }; + } + + // 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) { + 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 { + // The document payload. + oneof source { + // An inline document proto. + Document inline_document = 4; + + // A raw document content (bytes). + RawDocument raw_document = 5; + } + + // 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: "*" + } + ]; + + // The document payload, the [content] and [mime_type] fields must be set. + Document document = 2 [deprecated = true]; + + // 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. +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 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 [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; + + // 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 { + option deprecated = true; + + // The output Cloud Storage directory to put the processed documents. + string gcs_destination = 1; + } + + // 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: "*" + } + ]; + + // The input config for each single document in the batch process. + repeated BatchInputConfig input_configs = 2 [deprecated = true]; + + // The overall output config for batch process. + 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. +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 processing 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 [deprecated = true]; + + // 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 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.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. +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. + 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" + } + ]; + + // 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; + + // The document schema of the human review task. + DocumentSchema document_schema = 6; +} + +// Response message for review document method. +message ReviewDocumentResponse { + // 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. +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; + + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; + + // 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 new file mode 100644 index 00000000000..c42e0cb7a07 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/geometry.proto @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 = "GeometryProto"; +option java_package = "com.google.cloud.documentai.v1beta3"; +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. +message Vertex { + // X coordinate. + int32 x = 1; + + // Y coordinate (starts from the top of the image). + 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 (starts from the top of the image). + 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/v1beta3/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto new file mode 100644 index 00000000000..cd573a823c4 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/operation_metadata.proto @@ -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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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; + + // A related resource to this operation. + string resource = 5; + + // 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/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto new file mode 100644 index 00000000000..b7019bf4d12 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/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.v1beta3; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.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"; + +// 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.v1beta3.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/v1beta3/processor_type.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto new file mode 100644 index 00000000000..a2799e301a9 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/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.v1beta3; + +import "google/api/launch_stage.proto"; +import "google/api/resource.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, 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 new file mode 100644 index 00000000000..af6c5eac483 --- /dev/null +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -0,0 +1,39248 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace documentai. */ + namespace documentai { + + /** 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 }; + + /** + * 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. */ + 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|null); + + /** Document content. */ + public content?: (Uint8Array|string|null); + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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); + + /** Style fontFamily */ + fontFamily?: (string|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); + + /** Style fontFamily. */ + public fontFamily: string; + + /** + * 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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); + + /** Page symbols */ + symbols?: (google.cloud.documentai.v1.Document.Page.ISymbol[]|null); + + /** 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); + } + + /** 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[]; + + /** Page symbols. */ + public symbols: google.cloud.documentai.v1.Document.Page.ISymbol[]; + + /** 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); + + /** + * 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + SPACE = 1, + WIDE_SPACE = 2, + HYPHEN = 3 + } + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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); + + /** Table provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|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[]; + + /** 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 + * @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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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); + + /** FormField correctedKeyText */ + correctedKeyText?: (string|null); + + /** FormField correctedValueText */ + correctedValueText?: (string|null); + + /** FormField provenance */ + provenance?: (google.cloud.documentai.v1.Document.IProvenance|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; + + /** FormField correctedKeyText. */ + public correctedKeyText: string; + + /** FormField correctedValueText. */ + public correctedValueText: 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 + * @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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + + /** 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. */ + 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 }; + + /** + * 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 { + + /** 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 integerValue */ + integerValue?: (number|null); + + /** NormalizedValue floatValue */ + floatValue?: (number|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|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"|"integerValue"|"floatValue"); + + /** + * 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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); + + /** PageRef confidence */ + confidence?: (number|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); + + /** PageRef confidence. */ + public confidence: number; + + /** + * 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** Properties of a Parent. */ + interface IParent { + + /** Parent revision */ + revision?: (number|null); + + /** Parent index */ + index?: (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 index. */ + public index: 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 }; + + /** + * 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. */ + 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 parentIds */ + parentIds?: (string[]|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|null); + + /** Revision processor. */ + public processor?: (string|null); + + /** Revision id. */ + public id: string; + + /** Revision parent. */ + public parent: number[]; + + /** Revision parentIds. */ + public parentIds: string[]; + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** Properties of a GcsOutputConfig. */ + interface IGcsOutputConfig { + + /** GcsOutputConfig gcsUri */ + gcsUri?: (string|null); + + /** GcsOutputConfig fieldMask */ + fieldMask?: (google.protobuf.IFieldMask|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; + + /** GcsOutputConfig fieldMask. */ + public fieldMask?: (google.protobuf.IFieldMask|null); + + /** + * 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 }; + + /** + * 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; + } + } + + /** 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 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.v1.IFetchProcessorTypesRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypesCallback): void; + + /** + * Calls FetchProcessorTypes. + * @param request FetchProcessorTypesRequest message or plain object + * @returns Promise + */ + public fetchProcessorTypes(request: google.cloud.documentai.v1.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.v1.IListProcessorTypesRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypesCallback): void; + + /** + * Calls ListProcessorTypes. + * @param request ListProcessorTypesRequest message or plain object + * @returns Promise + */ + public listProcessorTypes(request: google.cloud.documentai.v1.IListProcessorTypesRequest): 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.v1.IListProcessorsRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorsCallback): void; + + /** + * Calls ListProcessors. + * @param request ListProcessorsRequest message or plain object + * @returns Promise + */ + public listProcessors(request: google.cloud.documentai.v1.IListProcessorsRequest): Promise; + + /** + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor + */ + public getProcessor(request: google.cloud.documentai.v1.IGetProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.GetProcessorCallback): void; + + /** + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object + * @returns Promise + */ + public getProcessor(request: google.cloud.documentai.v1.IGetProcessorRequest): Promise; + + /** + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProcessorVersion + */ + public getProcessorVersion(request: google.cloud.documentai.v1.IGetProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersionCallback): void; + + /** + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @returns Promise + */ + public getProcessorVersion(request: google.cloud.documentai.v1.IGetProcessorVersionRequest): Promise; + + /** + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse + */ + public listProcessorVersions(request: google.cloud.documentai.v1.IListProcessorVersionsRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersionsCallback): void; + + /** + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @returns Promise + */ + public listProcessorVersions(request: google.cloud.documentai.v1.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.v1.IDeleteProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersionCallback): void; + + /** + * 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 }; + + /** + * Converts this ProcessRequest to JSON. + * @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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 SetDefaultProcessorVersionResponse to JSON. + * @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. */ + interface ISetDefaultProcessorVersionMetadata { + + /** SetDefaultProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a SetDefaultProcessorVersionMetadata. */ + class SetDefaultProcessorVersionMetadata implements ISetDefaultProcessorVersionMetadata { + + /** + * 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 }; + + /** + * 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. */ + 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 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 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 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 }; + + /** + * 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 { + + /** 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.v1.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1.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.v1.IReviewDocumentResponse); + + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; + + /** 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 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 }; + + /** + * 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 { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + REJECTED = 1, + SUCCEEDED = 2 + } + } + + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { + + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.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.v1.IReviewDocumentOperationMetadata); + + /** 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 + * @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 }; + + /** + * 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. */ + 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 DocumentSchema. */ + class DocumentSchema implements IDocumentSchema { + + /** + * Constructs a new DocumentSchema. + * @param [properties] Properties to set + */ + 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 DocumentSchema instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentSchema instance + */ + public static create(properties?: google.cloud.documentai.v1.IDocumentSchema): google.cloud.documentai.v1.DocumentSchema; + + /** + * 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.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1.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.v1.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.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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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; + + /** + * 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; + + /** + * 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; + + /** + * 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.v1.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.v1.DocumentSchema.EntityType.EnumValues, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValues to JSON. + * @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. */ + interface IProperty { + + /** Property name */ + name?: (string|null); + + /** Property valueType */ + valueType?: (string|null); + + /** Property occurrenceType */ + occurrenceType?: (google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.IProperty); + + /** Property name. */ + public name: string; + + /** Property valueType. */ + public valueType: string; + + /** 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 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 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 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 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 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 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.v1.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.v1.DocumentSchema.EntityType.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Property to JSON. + * @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 { + + /** 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.v1.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.v1.DocumentSchema.IMetadata): google.cloud.documentai.v1.DocumentSchema.Metadata; + + /** + * 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.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1.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.v1.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.v1.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.v1.DocumentSchema.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Metadata to JSON. + * @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; + } + } + + /** 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 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.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 resource. */ + public resource: 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 }; + + /** + * 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 { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } + + /** Properties of a ProcessorVersion. */ + interface IProcessorVersion { + + /** ProcessorVersion name */ + name?: (string|null); + + /** 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); + + /** 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 ProcessorVersion. */ + class ProcessorVersion implements IProcessorVersion { + + /** + * Constructs a new ProcessorVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessorVersion); + + /** ProcessorVersion name. */ + public name: string; + + /** 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); + + /** 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 ProcessorVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessorVersion instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessorVersion): google.cloud.documentai.v1.ProcessorVersion; + + /** + * 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.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.ProcessorVersion; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.ProcessorVersion; + + /** + * 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 ProcessorVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessorVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorVersion; + + /** + * 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.ProcessorVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessorVersion to JSON. + * @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 { + + /** 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.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 }; + + /** + * 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. */ + enum State { + STATE_UNSPECIFIED = 0, + DEPLOYED = 1, + DEPLOYING = 2, + UNDEPLOYED = 3, + UNDEPLOYING = 4, + CREATING = 5, + DELETING = 6, + FAILED = 7 + } + } + + /** 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 Processor. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessor); + + /** Processor name. */ + public name: 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 Processor instance using the specified properties. + * @param [properties] Properties to set + * @returns Processor instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessor): google.cloud.documentai.v1.Processor; + + /** + * 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.IProcessor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1.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.v1.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.v1.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.v1.Processor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Processor to JSON. + * @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 { + + /** 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.v1.ProcessorType.ILocationInfo[]|null); + + /** ProcessorType allowCreation */ + allowCreation?: (boolean|null); + + /** ProcessorType launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); + } + + /** Represents a ProcessorType. */ + class ProcessorType implements IProcessorType { + + /** + * Constructs a new ProcessorType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessorType); + + /** ProcessorType name. */ + public name: string; + + /** ProcessorType type. */ + public type: string; + + /** ProcessorType category. */ + public category: string; + + /** 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 ProcessorType instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessorType instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessorType): google.cloud.documentai.v1.ProcessorType; + + /** + * 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.IProcessorType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1.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.v1.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.v1.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.v1.ProcessorType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessorType to JSON. + * @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 { + + /** 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 }; + + /** + * 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; + } + } + } + + /** 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|null); + + /** Document content. */ + public content?: (Uint8Array|string|null); + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACCEPTED = 1, + WAITING = 2, + RUNNING = 3, + SUCCEEDED = 4, + CANCELLED = 5, + FAILED = 6 + } + } + } + + /** Namespace v1beta2. */ + namespace v1beta2 { + + /** 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.v1beta2.Document.IStyle[]|null); + + /** Document pages */ + pages?: (google.cloud.documentai.v1beta2.Document.IPage[]|null); + + /** Document entities */ + entities?: (google.cloud.documentai.v1beta2.Document.IEntity[]|null); + + /** Document entityRelations */ + entityRelations?: (google.cloud.documentai.v1beta2.Document.IEntityRelation[]|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 Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IDocument); + + /** Document uri. */ + public uri?: (string|null); + + /** Document content. */ + public content?: (Uint8Array|string|null); + + /** 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 Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.IDocument): google.cloud.documentai.v1beta2.Document; + + /** + * 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.v1beta2.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @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 { + + /** 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.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 }; + + /** + * 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. */ + interface ILabel { + + /** Label automlModel */ + automlModel?: (string|null); + + /** Label name */ + name?: (string|null); + + /** Label confidence */ + confidence?: (number|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|null); + + /** 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 }; + + /** + * 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. */ + interface IStyle { + + /** Style textAnchor */ + textAnchor?: (google.cloud.documentai.v1beta2.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.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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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); + } + + /** 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; + + /** + * 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + interface ITextAnchor { + + /** TextAnchor textSegments */ + textSegments?: (google.cloud.documentai.v1beta2.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.v1beta2.Document.ITextAnchor); + + /** 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 + * @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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + 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 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.v1beta2.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @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. */ + 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.v1beta2.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.v1beta2.INormalizedVertex): google.cloud.documentai.v1beta2.NormalizedVertex; + + /** + * 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.v1beta2.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @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. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.documentai.v1beta2.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.documentai.v1beta2.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.documentai.v1beta2.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.documentai.v1beta2.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.v1beta2.IBoundingPoly): google.cloud.documentai.v1beta2.BoundingPoly; + + /** + * 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.v1beta2.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @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 */ + 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.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; + } + + namespace DocumentUnderstandingService { + + /** + * 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.v1beta2.IBatchProcessDocumentsRequest); + + /** BatchProcessDocumentsRequest requests. */ + public requests: google.cloud.documentai.v1beta2.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.v1beta2.IBatchProcessDocumentsRequest): google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; + + /** + * 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.v1beta2.IBatchProcessDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.BatchProcessDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessDocumentsRequest to JSON. + * @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. */ + interface IProcessDocumentRequest { + + /** ProcessDocumentRequest parent */ + parent?: (string|null); + + /** ProcessDocumentRequest inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); + + /** ProcessDocumentRequest outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta2.IOutputConfig|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 ProcessDocumentRequest. */ + class ProcessDocumentRequest implements IProcessDocumentRequest { + + /** + * Constructs a new ProcessDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IProcessDocumentRequest); + + /** ProcessDocumentRequest parent. */ + public parent: string; + + /** ProcessDocumentRequest inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); + + /** ProcessDocumentRequest outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta2.IOutputConfig|null); + + /** 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 ProcessDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.IProcessDocumentRequest): google.cloud.documentai.v1beta2.ProcessDocumentRequest; + + /** + * 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.v1beta2.IProcessDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.ProcessDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessDocumentRequest to JSON. + * @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. */ + interface IBatchProcessDocumentsResponse { + + /** BatchProcessDocumentsResponse responses */ + responses?: (google.cloud.documentai.v1beta2.IProcessDocumentResponse[]|null); + } + + /** Represents a BatchProcessDocumentsResponse. */ + class BatchProcessDocumentsResponse implements IBatchProcessDocumentsResponse { + + /** + * Constructs a new BatchProcessDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse); + + /** BatchProcessDocumentsResponse responses. */ + public responses: google.cloud.documentai.v1beta2.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.v1beta2.IBatchProcessDocumentsResponse): google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; + + /** + * 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.v1beta2.IBatchProcessDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.BatchProcessDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessDocumentsResponse to JSON. + * @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. */ + interface IProcessDocumentResponse { + + /** ProcessDocumentResponse inputConfig */ + inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); + + /** ProcessDocumentResponse outputConfig */ + outputConfig?: (google.cloud.documentai.v1beta2.IOutputConfig|null); + } + + /** Represents a ProcessDocumentResponse. */ + class ProcessDocumentResponse implements IProcessDocumentResponse { + + /** + * Constructs a new ProcessDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IProcessDocumentResponse); + + /** ProcessDocumentResponse inputConfig. */ + public inputConfig?: (google.cloud.documentai.v1beta2.IInputConfig|null); + + /** ProcessDocumentResponse outputConfig. */ + public outputConfig?: (google.cloud.documentai.v1beta2.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.v1beta2.IProcessDocumentResponse): google.cloud.documentai.v1beta2.ProcessDocumentResponse; + + /** + * 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.v1beta2.IProcessDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.ProcessDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessDocumentResponse to JSON. + * @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. */ + 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.v1beta2.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.v1beta2.IOcrParams): google.cloud.documentai.v1beta2.OcrParams; + + /** + * 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.v1beta2.IOcrParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.OcrParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OcrParams to JSON. + * @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. */ + interface ITableExtractionParams { + + /** TableExtractionParams enabled */ + enabled?: (boolean|null); + + /** TableExtractionParams tableBoundHints */ + tableBoundHints?: (google.cloud.documentai.v1beta2.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.v1beta2.ITableExtractionParams); + + /** TableExtractionParams enabled. */ + public enabled: boolean; + + /** TableExtractionParams tableBoundHints. */ + public tableBoundHints: google.cloud.documentai.v1beta2.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.v1beta2.ITableExtractionParams): google.cloud.documentai.v1beta2.TableExtractionParams; + + /** + * 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.v1beta2.ITableExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.TableExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableExtractionParams to JSON. + * @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. */ + interface ITableBoundHint { + + /** TableBoundHint pageNumber */ + pageNumber?: (number|null); + + /** TableBoundHint boundingBox */ + boundingBox?: (google.cloud.documentai.v1beta2.IBoundingPoly|null); + } + + /** Represents a TableBoundHint. */ + class TableBoundHint implements ITableBoundHint { + + /** + * Constructs a new TableBoundHint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.ITableBoundHint); + + /** TableBoundHint pageNumber. */ + public pageNumber: number; + + /** TableBoundHint boundingBox. */ + public boundingBox?: (google.cloud.documentai.v1beta2.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.v1beta2.ITableBoundHint): google.cloud.documentai.v1beta2.TableBoundHint; + + /** + * 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.v1beta2.ITableBoundHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.TableBoundHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableBoundHint to JSON. + * @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. */ + interface IFormExtractionParams { + + /** FormExtractionParams enabled */ + enabled?: (boolean|null); + + /** FormExtractionParams keyValuePairHints */ + keyValuePairHints?: (google.cloud.documentai.v1beta2.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.v1beta2.IFormExtractionParams); + + /** FormExtractionParams enabled. */ + public enabled: boolean; + + /** FormExtractionParams keyValuePairHints. */ + public keyValuePairHints: google.cloud.documentai.v1beta2.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.v1beta2.IFormExtractionParams): google.cloud.documentai.v1beta2.FormExtractionParams; + + /** + * 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.v1beta2.IFormExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.FormExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormExtractionParams to JSON. + * @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. */ + 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.v1beta2.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.v1beta2.IKeyValuePairHint): google.cloud.documentai.v1beta2.KeyValuePairHint; + + /** + * 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.v1beta2.IKeyValuePairHint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.KeyValuePairHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeyValuePairHint to JSON. + * @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. */ + 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.v1beta2.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.v1beta2.IEntityExtractionParams): google.cloud.documentai.v1beta2.EntityExtractionParams; + + /** + * 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.v1beta2.IEntityExtractionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.EntityExtractionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityExtractionParams to JSON. + * @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. */ + interface IAutoMlParams { + + /** AutoMlParams model */ + model?: (string|null); + } + + /** Represents an AutoMlParams. */ + class AutoMlParams implements IAutoMlParams { + + /** + * Constructs a new AutoMlParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta2.IAutoMlParams); + + /** AutoMlParams model. */ + public model: string; + + /** + * Creates a new AutoMlParams instance using the specified properties. + * @param [properties] Properties to set + * @returns AutoMlParams instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.IAutoMlParams): google.cloud.documentai.v1beta2.AutoMlParams; + + /** + * 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.v1beta2.IAutoMlParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.IAutoMlParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.v1beta2.AutoMlParams; + + /** + * Decodes an AutoMlParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.v1beta2.AutoMlParams; + + /** + * 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 AutoMlParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutoMlParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta2.AutoMlParams; + + /** + * 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.v1beta2.AutoMlParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutoMlParams to JSON. + * @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. */ + interface IInputConfig { + + /** InputConfig gcsSource */ + gcsSource?: (google.cloud.documentai.v1beta2.IGcsSource|null); + + /** InputConfig contents */ + contents?: (Uint8Array|string|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.v1beta2.IInputConfig); + + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.documentai.v1beta2.IGcsSource|null); + + /** InputConfig contents. */ + public contents?: (Uint8Array|string|null); + + /** InputConfig mimeType. */ + public mimeType: string; + + /** InputConfig source. */ + public source?: ("gcsSource"|"contents"); + + /** + * Creates a new InputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta2.IInputConfig): google.cloud.documentai.v1beta2.InputConfig; + + /** + * 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.v1beta2.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputConfig to JSON. + * @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. */ + interface IOutputConfig { + + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.documentai.v1beta2.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.v1beta2.IOutputConfig); + + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.documentai.v1beta2.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.v1beta2.IOutputConfig): google.cloud.documentai.v1beta2.OutputConfig; + + /** + * 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.v1beta2.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputConfig to JSON. + * @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. */ + 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.v1beta2.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.v1beta2.IGcsSource): google.cloud.documentai.v1beta2.GcsSource; + + /** + * 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.v1beta2.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsSource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a 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.v1beta2.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.v1beta2.IGcsDestination): google.cloud.documentai.v1beta2.GcsDestination; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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.v1beta2.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.v1beta2.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDestination to JSON. + * @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. */ + interface IOperationMetadata { + + /** OperationMetadata state */ + state?: (google.cloud.documentai.v1beta2.OperationMetadata.State|keyof typeof google.cloud.documentai.v1beta2.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.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 }; + + /** + * 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 { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACCEPTED = 1, + WAITING = 2, + RUNNING = 3, + SUCCEEDED = 4, + CANCELLED = 5, + FAILED = 6 + } + } + } + + /** 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 }; + + /** + * 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. */ + 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 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|null); + + /** Document content. */ + public content?: (Uint8Array|string|null); + + /** 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 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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); + + /** 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); + } + + /** 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[]; + + /** 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); + + /** + * 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + SPACE = 1, + WIDE_SPACE = 2, + HYPHEN = 3 + } + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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); + + /** FormField correctedKeyText */ + correctedKeyText?: (string|null); + + /** FormField correctedValueText */ + correctedValueText?: (string|null); + + /** FormField provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|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; + + /** FormField correctedKeyText. */ + public correctedKeyText: string; + + /** FormField correctedValueText. */ + public correctedValueText: 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 + * @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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 integerValue */ + integerValue?: (number|null); + + /** NormalizedValue floatValue */ + floatValue?: (number|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 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"|"integerValue"|"floatValue"); + + /** + * 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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); + + /** PageRef confidence */ + confidence?: (number|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); + + /** PageRef confidence. */ + public confidence: number; + + /** + * 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** Properties of a Parent. */ + interface IParent { + + /** Parent revision */ + revision?: (number|null); + + /** Parent index */ + index?: (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 index. */ + public index: 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 }; + + /** + * 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. */ + 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 parentIds */ + parentIds?: (string[]|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|null); + + /** Revision processor. */ + public processor?: (string|null); + + /** Revision id. */ + public id: string; + + /** Revision parent. */ + public parent: number[]; + + /** Revision parentIds. */ + public parentIds: string[]; + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 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 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 + * @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 GetProcessor. + * @param request GetProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor + */ + public getProcessor(request: google.cloud.documentai.v1beta3.IGetProcessorRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorCallback): void; + + /** + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object + * @returns Promise + */ + public getProcessor(request: google.cloud.documentai.v1beta3.IGetProcessorRequest): Promise; + + /** + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProcessorVersion + */ + public getProcessorVersion(request: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.GetProcessorVersionCallback): void; + + /** + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @returns Promise + */ + public getProcessorVersion(request: google.cloud.documentai.v1beta3.IGetProcessorVersionRequest): Promise; + + /** + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse + */ + public listProcessorVersions(request: google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorVersionsCallback): void; + + /** + * 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; + + /** + * 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 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 + * @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|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}. + * @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 + * @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}. + * @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 + * @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|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 + * @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.v1beta3.IDocument|null); + + /** ProcessRequest rawDocument */ + rawDocument?: (google.cloud.documentai.v1beta3.IRawDocument|null); + + /** ProcessRequest name */ + name?: (string|null); + + /** ProcessRequest document */ + document?: (google.cloud.documentai.v1beta3.IDocument|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.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; + + /** ProcessRequest document. */ + public document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** 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.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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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.v1beta3.IDocument|null); + + /** ProcessResponse humanReviewOperation */ + humanReviewOperation?: (string|null); + + /** ProcessResponse humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1beta3.IHumanReviewStatus|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; + + /** ProcessResponse humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1beta3.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.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 }; + + /** + * 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. */ + 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); + + /** 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. */ + 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); + + /** 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 + * @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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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); + + /** IndividualProcessStatus humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1beta3.IHumanReviewStatus|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; + + /** IndividualProcessStatus humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1beta3.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.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 }; + + /** + * 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. */ + 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.v1beta3.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.v1beta3.IFetchProcessorTypesRequest): google.cloud.documentai.v1beta3.FetchProcessorTypesRequest; + + /** + * 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.IFetchProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.FetchProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FetchProcessorTypesRequest to JSON. + * @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. */ + interface IFetchProcessorTypesResponse { + + /** FetchProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1beta3.IProcessorType[]|null); + } + + /** Represents a FetchProcessorTypesResponse. */ + class FetchProcessorTypesResponse implements IFetchProcessorTypesResponse { + + /** + * Constructs a new FetchProcessorTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse); + + /** FetchProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1beta3.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.v1beta3.IFetchProcessorTypesResponse): google.cloud.documentai.v1beta3.FetchProcessorTypesResponse; + + /** + * 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.IFetchProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.FetchProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FetchProcessorTypesResponse to JSON. + * @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. */ + 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.v1beta3.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.v1beta3.IListProcessorTypesRequest): google.cloud.documentai.v1beta3.ListProcessorTypesRequest; + + /** + * 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.IListProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorTypesRequest to JSON. + * @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. */ + interface IListProcessorTypesResponse { + + /** ListProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1beta3.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.v1beta3.IListProcessorTypesResponse); + + /** ListProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1beta3.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.v1beta3.IListProcessorTypesResponse): google.cloud.documentai.v1beta3.ListProcessorTypesResponse; + + /** + * 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.IListProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorTypesResponse to JSON. + * @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. */ + 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.v1beta3.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.v1beta3.IListProcessorsRequest): google.cloud.documentai.v1beta3.ListProcessorsRequest; + + /** + * 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.IListProcessorsRequest, 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 + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorsRequest to JSON. + * @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. */ + interface IListProcessorsResponse { + + /** ListProcessorsResponse processors */ + processors?: (google.cloud.documentai.v1beta3.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.v1beta3.IListProcessorsResponse); + + /** ListProcessorsResponse processors. */ + public processors: google.cloud.documentai.v1beta3.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.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 }; + + /** + * 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. */ + 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.v1beta3.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.v1beta3.IGetProcessorRequest): google.cloud.documentai.v1beta3.GetProcessorRequest; + + /** + * 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.IGetProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.GetProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProcessorRequest to JSON. + * @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. */ + 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.v1beta3.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.v1beta3.IGetProcessorVersionRequest): google.cloud.documentai.v1beta3.GetProcessorVersionRequest; + + /** + * 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.IGetProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.GetProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProcessorVersionRequest to JSON. + * @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. */ + 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.v1beta3.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.v1beta3.IListProcessorVersionsRequest): google.cloud.documentai.v1beta3.ListProcessorVersionsRequest; + + /** + * 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.IListProcessorVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorVersionsRequest to JSON. + * @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. */ + interface IListProcessorVersionsResponse { + + /** ListProcessorVersionsResponse processorVersions */ + processorVersions?: (google.cloud.documentai.v1beta3.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.v1beta3.IListProcessorVersionsResponse); + + /** ListProcessorVersionsResponse processorVersions. */ + public processorVersions: google.cloud.documentai.v1beta3.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.v1beta3.IListProcessorVersionsResponse): google.cloud.documentai.v1beta3.ListProcessorVersionsResponse; + + /** + * 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.IListProcessorVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorVersionsResponse to JSON. + * @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. */ + 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.v1beta3.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.v1beta3.IDeleteProcessorVersionRequest): google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest; + + /** + * 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.IDeleteProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.DeleteProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorVersionRequest to JSON. + * @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. */ + interface IDeleteProcessorVersionMetadata { + + /** DeleteProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a DeleteProcessorVersionMetadata. */ + class DeleteProcessorVersionMetadata implements IDeleteProcessorVersionMetadata { + + /** + * Constructs a new DeleteProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata); + + /** DeleteProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.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.v1beta3.IDeleteProcessorVersionMetadata): google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata; + + /** + * 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.IDeleteProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.DeleteProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorVersionMetadata to JSON. + * @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. */ + 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.v1beta3.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.v1beta3.IDeployProcessorVersionRequest): google.cloud.documentai.v1beta3.DeployProcessorVersionRequest; + + /** + * 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.IDeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.DeployProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionRequest to JSON. + * @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. */ + interface IDeployProcessorVersionResponse { + } + + /** Represents a DeployProcessorVersionResponse. */ + class DeployProcessorVersionResponse implements IDeployProcessorVersionResponse { + + /** + * Constructs a new DeployProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.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.v1beta3.IDeployProcessorVersionResponse): google.cloud.documentai.v1beta3.DeployProcessorVersionResponse; + + /** + * 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.IDeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.DeployProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionResponse to JSON. + * @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. */ + interface IDeployProcessorVersionMetadata { + + /** DeployProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents a DeployProcessorVersionMetadata. */ + class DeployProcessorVersionMetadata implements IDeployProcessorVersionMetadata { + + /** + * Constructs a new DeployProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata); + + /** DeployProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.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.v1beta3.IDeployProcessorVersionMetadata): google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata; + + /** + * 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.IDeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.DeployProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionMetadata to JSON. + * @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. */ + 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.v1beta3.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.v1beta3.IUndeployProcessorVersionRequest): google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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); + + /** 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 }; + + /** + * 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 { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } + + /** Properties of a ProcessorVersion. */ + interface IProcessorVersion { + + /** ProcessorVersion name */ + name?: (string|null); + + /** ProcessorVersion displayName */ + displayName?: (string|null); + + /** 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); + + /** 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 ProcessorVersion. */ + class ProcessorVersion implements IProcessorVersion { + + /** + * Constructs a new ProcessorVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IProcessorVersion); + + /** ProcessorVersion name. */ + public name: string; + + /** ProcessorVersion displayName. */ + public displayName: string; + + /** 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); + + /** 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 ProcessorVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessorVersion instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IProcessorVersion): google.cloud.documentai.v1beta3.ProcessorVersion; + + /** + * 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.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.ProcessorVersion; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.ProcessorVersion; + + /** + * 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 ProcessorVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessorVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ProcessorVersion; + + /** + * 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.ProcessorVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessorVersion to JSON. + * @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 { + + /** 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 }; + + /** + * 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. */ + enum State { + STATE_UNSPECIFIED = 0, + DEPLOYED = 1, + DEPLOYING = 2, + UNDEPLOYED = 3, + UNDEPLOYING = 4, + CREATING = 5, + DELETING = 6, + FAILED = 7 + } + } + + /** 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 }; + + /** + * 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 { + + /** 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); + + /** ProcessorType launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|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; + + /** 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 + * @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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + } + } + } + + /** 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 { + + /** 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 }; + + /** + * 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. */ + 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|null); + + /** HttpRule put. */ + public put?: (string|null); + + /** HttpRule post. */ + public post?: (string|null); + + /** HttpRule delete. */ + public delete?: (string|null); + + /** HttpRule patch. */ + public patch?: (string|null); + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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 { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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. */ + enum LaunchStage { + LAUNCH_STAGE_UNSPECIFIED = 0, + UNIMPLEMENTED = 6, + PRELAUNCH = 7, + EARLY_ACCESS = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 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 }; + + /** + * 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. */ + 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); + + /** FileDescriptorProto edition */ + edition?: (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; + + /** FileDescriptorProto edition. */ + public edition: 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto implements IFieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + + /** FieldDescriptorProto type. */ + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional. */ + public proto3Optional: boolean; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions phpGenericServices */ + phpGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions phpGenericServices. */ + public phpGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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 { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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 }; + + /** + * 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; + } + } + + /** 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 }; + + /** + * 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 { + + /** 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); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|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; + + /** 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 + * @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 }; + + /** + * 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 + } + } + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + + /** + * Verifies an Any message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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. */ + interface IDoubleValue { + + /** DoubleValue value */ + value?: (number|null); + } + + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { + + /** + * Constructs a new DoubleValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDoubleValue); + + /** DoubleValue value. */ + public value: number; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @param [properties] Properties to set + * @returns DoubleValue instance + */ + public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DoubleValue; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DoubleValue; + + /** + * Verifies a DoubleValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoubleValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @param message DoubleValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoubleValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Duration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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 an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** 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 }; + + /** + * 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; + } + } + + /** Namespace type. */ + namespace type { + + /** 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 Color. */ + class Color implements IColor { + + /** + * Constructs a new Color. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IColor); + + /** 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 Color instance using the specified properties. + * @param [properties] Properties to set + * @returns Color instance + */ + public static create(properties?: google.type.IColor): google.type.Color; + + /** + * 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.type.IColor, 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 + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.IColor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.type.Color; + + /** + * Decodes a Color message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.type.Color; + + /** + * 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 Color message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Color + */ + public static fromObject(object: { [k: string]: any }): google.type.Color; + + /** + * 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.type.Color, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Color to JSON. + * @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. */ + interface IDate { + + /** Date year */ + year?: (number|null); + + /** Date month */ + month?: (number|null); + + /** Date day */ + day?: (number|null); + } + + /** Represents a Date. */ + class Date implements IDate { + + /** + * Constructs a new Date. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IDate); + + /** Date year. */ + public year: number; + + /** Date month. */ + public month: number; + + /** Date day. */ + public day: number; + + /** + * Creates a new Date instance using the specified properties. + * @param [properties] Properties to set + * @returns Date instance + */ + public static create(properties?: google.type.IDate): google.type.Date; + + /** + * 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.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.type.IDate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.type.Date; + + /** + * Decodes a Date message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.type.Date; + + /** + * 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 Date message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Date + */ + public static fromObject(object: { [k: string]: any }): google.type.Date; + + /** + * 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.type.Date, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Date to JSON. + * @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. */ + 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 a DateTime. */ + class DateTime implements IDateTime { + + /** + * Constructs a new DateTime. + * @param [properties] Properties to set + */ + 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 DateTime instance using the specified properties. + * @param [properties] Properties to set + * @returns DateTime instance + */ + public static create(properties?: google.type.IDateTime): google.type.DateTime; + + /** + * 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.type.IDateTime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.type.IDateTime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.type.DateTime; + + /** + * Decodes a DateTime message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.type.DateTime; + + /** + * 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 a DateTime message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DateTime + */ + public static fromObject(object: { [k: string]: any }): google.type.DateTime; + + /** + * 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.type.DateTime, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DateTime to JSON. + * @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. */ + interface ITimeZone { + + /** TimeZone id */ + id?: (string|null); + + /** TimeZone version */ + version?: (string|null); + } + + /** Represents a TimeZone. */ + class TimeZone implements ITimeZone { + + /** + * Constructs a new TimeZone. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.ITimeZone); + + /** TimeZone id. */ + public id: string; + + /** TimeZone version. */ + public version: string; + + /** + * Creates a new TimeZone instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeZone instance + */ + public static create(properties?: google.type.ITimeZone): google.type.TimeZone; + + /** + * 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.type.ITimeZone, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.type.ITimeZone, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.type.TimeZone; + + /** + * Decodes a TimeZone message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.type.TimeZone; + + /** + * 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 TimeZone message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeZone + */ + public static fromObject(object: { [k: string]: any }): google.type.TimeZone; + + /** + * 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.type.TimeZone, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeZone to JSON. + * @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. */ + interface IMoney { + + /** Money currencyCode */ + currencyCode?: (string|null); + + /** Money units */ + units?: (number|Long|string|null); + + /** Money nanos */ + nanos?: (number|null); + } + + /** Represents a Money. */ + class Money implements IMoney { + + /** + * Constructs a new Money. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IMoney); + + /** Money currencyCode. */ + public currencyCode: string; + + /** Money units. */ + public units: (number|Long|string); + + /** Money nanos. */ + public nanos: number; + + /** + * Creates a new Money instance using the specified properties. + * @param [properties] Properties to set + * @returns Money instance + */ + public static create(properties?: google.type.IMoney): google.type.Money; + + /** + * 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.type.IMoney, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.type.IMoney, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.type.Money; + + /** + * Decodes a Money message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.type.Money; + + /** + * 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 Money message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Money + */ + public static fromObject(object: { [k: string]: any }): google.type.Money; + + /** + * 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.type.Money, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Money to JSON. + * @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. */ + interface IPostalAddress { + + /** PostalAddress revision */ + revision?: (number|null); + + /** PostalAddress regionCode */ + regionCode?: (string|null); + + /** PostalAddress languageCode */ + languageCode?: (string|null); + + /** PostalAddress postalCode */ + postalCode?: (string|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 PostalAddress. */ + class PostalAddress implements IPostalAddress { + + /** + * Constructs a new PostalAddress. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IPostalAddress); + + /** PostalAddress revision. */ + public revision: number; + + /** PostalAddress regionCode. */ + public regionCode: string; + + /** PostalAddress languageCode. */ + public languageCode: string; + + /** 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 PostalAddress instance using the specified properties. + * @param [properties] Properties to set + * @returns PostalAddress instance + */ + public static create(properties?: google.type.IPostalAddress): google.type.PostalAddress; + + /** + * 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.IPostalAddress, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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.IPostalAddress, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * 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 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.PostalAddress; + + /** + * Decodes a PostalAddress message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @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.PostalAddress; + + /** + * 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 PostalAddress message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PostalAddress + */ + public static fromObject(object: { [k: string]: any }): google.type.PostalAddress; + + /** + * 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.PostalAddress, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PostalAddress to JSON. + * @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; + } + } + + /** 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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. */ + 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 }; + + /** + * 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 new file mode 100644 index 00000000000..3a0d67dc16f --- /dev/null +++ b/packages/google-cloud-documentai/protos/protos.js @@ -0,0 +1,97615 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) + module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots._google_cloud_documentai_protos || ($protobuf.roots._google_cloud_documentai_protos = {}); + + $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.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.documentai + * @namespace + */ + 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); + }; + + /** + * 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; + })(); + + 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|null|undefined} uri + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.uri = null; + + /** + * Document content. + * @member {Uint8Array|null|undefined} content + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.content = null; + + /** + * 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 >= 0) + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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 + * @property {string|null} [fontFamily] Style fontFamily + */ + + /** + * 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; + + /** + * 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 + * @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(); + if (message.fontFamily != null && Object.hasOwnProperty.call(message, "fontFamily")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.fontFamily); + 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; + } + case 8: { + message.fontFamily = reader.string(); + 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; + } + if (message.fontFamily != null && message.hasOwnProperty("fontFamily")) + if (!$util.isString(message.fontFamily)) + return "fontFamily: string expected"; + 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); + } + if (object.fontFamily != null) + message.fontFamily = String(object.fontFamily); + 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; + object.fontFamily = ""; + } + 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); + if (message.fontFamily != null && message.hasOwnProperty("fontFamily")) + object.fontFamily = message.fontFamily; + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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 + * @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 + */ + + /** + * 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 = []; + this.symbols = []; + this.detectedBarcodes = []; + if (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; + + /** + * Page symbols. + * @member {Array.} symbols + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.symbols = $util.emptyArray; + + /** + * Page detectedBarcodes. + * @member {Array.} detectedBarcodes + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + 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 + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.provenance = null; + + /** + * 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.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) + 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(); + 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; + }; + + /** + * 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; + } + 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 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; + } + 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; + } + } + 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.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.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) + return "provenance." + 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]); + } + } + 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.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.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"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } + 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.symbols = []; + object.transforms = []; + object.detectedBarcodes = []; + } + if (options.defaults) { + object.pageNumber = 0; + object.dimension = null; + object.layout = null; + object.image = null; + object.provenance = null; + object.imageQualityScores = 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.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) { + 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); + } + 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); + if (message.imageQualityScores != null && message.hasOwnProperty("imageQualityScores")) + object.imageQualityScores = $root.google.cloud.documentai.v1.Document.Page.ImageQualityScores.toObject(message.imageQualityScores, 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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 >= 0) + 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); + }; + + /** + * 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; + })(); + + 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 >= 0) + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; + 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] === undefined ? message.orientation : $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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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] === undefined ? message.type : $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); + }; + + /** + * 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 + * @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.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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Table provenance + */ + + /** + * 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; + + /** + * 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 + * @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(); + 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; + }; + + /** + * 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; + } + case 5: { + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.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; + } + } + 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 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]); + } + } + 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; + }; + + /** + * 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; + 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) { + 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); + } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 + * @property {string|null} [correctedKeyText] FormField correctedKeyText + * @property {string|null} [correctedValueText] FormField correctedValueText + * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] FormField provenance + */ + + /** + * 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 = ""; + + /** + * 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 + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.provenance = null; + + /** + * 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); + 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; + }; + + /** + * 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; + } + 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; + } + } + 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"; + 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) + return "provenance." + 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.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); + 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"); + message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.fromObject(object.provenance); + } + 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 = ""; + object.correctedKeyText = ""; + object.correctedValueText = ""; + object.provenance = null; + } + 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; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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 {number|null} [integerValue] NormalizedValue integerValue + * @property {number|null} [floatValue] NormalizedValue floatValue + * @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|null|undefined} booleanValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + 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 + * @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"|"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", "integerValue", "floatValue"]), + 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); + 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; + }; + + /** + * 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 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; + } + } + 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.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"; + 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.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; + }; + + /** + * 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"; + } + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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 + * @property {number|null} [confidence] PageRef confidence + */ + + /** + * 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; + + /** + * 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 + * @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(); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + 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; + } + case 5: { + message.confidence = reader.float(); + 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; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number 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.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) { + default: + if (typeof object.layoutType === "number") { + message.layoutType = object.layoutType; + break; + } + break; + 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); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + 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; + object.confidence = 0; + } + 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] === 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")) + 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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] === undefined ? message.type : $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); + }; + + /** + * 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() { + + /** + * Properties of a Parent. + * @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 + */ + + /** + * 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 index. + * @member {number} index + * @memberof google.cloud.documentai.v1.Document.Provenance.Parent + * @instance + */ + Parent.prototype.index = 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); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.index); + 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 3: { + message.index = 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.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"; + 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.index != null) + message.index = object.index | 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; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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 {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 + */ + + /** + * 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 = []; + this.parentIds = []; + if (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|null|undefined} agent + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.agent = null; + + /** + * Revision processor. + * @member {string|null|undefined} processor + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.processor = null; + + /** + * 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 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 + * @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(); + 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; + }; + + /** + * 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 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; + } + } + 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.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) + 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.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"); + 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 = []; + object.parentIds = []; + } + 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); + 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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 >= 0) + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * Properties of a GcsOutputConfig. + * @memberof google.cloud.documentai.v1.DocumentOutputConfig + * @interface IGcsOutputConfig + * @property {string|null} [gcsUri] GcsOutputConfig gcsUri + * @property {google.protobuf.IFieldMask|null} [fieldMask] GcsOutputConfig fieldMask + */ + + /** + * 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 = ""; + + /** + * 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 + * @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); + 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; + }; + + /** + * 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; + } + case 2: { + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + 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"; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } + 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); + 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; + }; + + /** + * 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 = ""; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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|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 + * @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 + * @property {google.protobuf.IFieldMask|null} [fieldMask] ProcessRequest fieldMask + */ + + /** + * 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; + + /** + * 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; + + /** + * 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(); + 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; + }; + + /** + * 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; + } + case 6: { + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + 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"; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } + 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); + 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; + }; + + /** + * 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; + object.fieldMask = 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.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"; + } + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) + object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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.FetchProcessorTypesRequest = (function() { + + /** + * Properties of a FetchProcessorTypesRequest. + * @memberof google.cloud.documentai.v1 + * @interface IFetchProcessorTypesRequest + * @property {string|null} [parent] FetchProcessorTypesRequest parent + */ + + /** + * Constructs a new FetchProcessorTypesRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a FetchProcessorTypesRequest. + * @implements IFetchProcessorTypesRequest + * @constructor + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest=} [properties] Properties to set + */ + function FetchProcessorTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FetchProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @instance + */ + FetchProcessorTypesRequest.prototype.parent = ""; + + /** + * Creates a new FetchProcessorTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @static + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest instance + */ + FetchProcessorTypesRequest.create = function create(properties) { + return new FetchProcessorTypesRequest(properties); + }; + + /** + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @static + * @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 + */ + FetchProcessorTypesRequest.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); + return writer; + }; + + /** + * 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.FetchProcessorTypesRequest + * @static + * @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 + */ + FetchProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. + * @function decode + * @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.FetchProcessorTypesRequest} FetchProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.FetchProcessorTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + FetchProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FetchProcessorTypesRequest message. + * @function verify + * @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 + */ + FetchProcessorTypesRequest.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"; + return null; + }; + + /** + * Creates a FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest + */ + FetchProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.FetchProcessorTypesRequest) + return object; + 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 FetchProcessorTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @static + * @param {google.cloud.documentai.v1.FetchProcessorTypesRequest} message FetchProcessorTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FetchProcessorTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this FetchProcessorTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest + * @instance + * @returns {Object.} JSON object + */ + FetchProcessorTypesRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1.FetchProcessorTypesResponse = (function() { + + /** + * Properties of a FetchProcessorTypesResponse. + * @memberof google.cloud.documentai.v1 + * @interface IFetchProcessorTypesResponse + * @property {Array.|null} [processorTypes] FetchProcessorTypesResponse processorTypes + */ + + /** + * Constructs a new FetchProcessorTypesResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a FetchProcessorTypesResponse. + * @implements IFetchProcessorTypesResponse + * @constructor + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse=} [properties] Properties to set + */ + function FetchProcessorTypesResponse(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]]; + } + + /** + * FetchProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @instance + */ + FetchProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; + + /** + * Creates a new FetchProcessorTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse instance + */ + FetchProcessorTypesResponse.create = function create(properties) { + return new FetchProcessorTypesResponse(properties); + }; + + /** + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @static + * @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 + */ + FetchProcessorTypesResponse.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(); + return writer; + }; + + /** + * 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.FetchProcessorTypesResponse + * @static + * @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 + */ + FetchProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. + * @function decode + * @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.FetchProcessorTypesResponse} FetchProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.FetchProcessorTypesResponse(); + 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; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + FetchProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FetchProcessorTypesResponse message. + * @function verify + * @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 + */ + FetchProcessorTypesResponse.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; + } + } + return null; + }; + + /** + * Creates a FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse + */ + FetchProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.FetchProcessorTypesResponse) + return object; + 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 FetchProcessorTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.FetchProcessorTypesResponse} message FetchProcessorTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FetchProcessorTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + 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 FetchProcessorTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse + * @instance + * @returns {Object.} JSON object + */ + FetchProcessorTypesResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1.ListProcessorTypesRequest = (function() { + + /** + * Properties of a ListProcessorTypesRequest. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorTypesRequest + * @property {string|null} [parent] ListProcessorTypesRequest parent + * @property {number|null} [pageSize] ListProcessorTypesRequest pageSize + * @property {string|null} [pageToken] ListProcessorTypesRequest pageToken + */ + + /** + * Constructs a new ListProcessorTypesRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorTypesRequest. + * @implements IListProcessorTypesRequest + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest=} [properties] Properties to set + */ + function ListProcessorTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @instance + */ + ListProcessorTypesRequest.prototype.parent = ""; + + /** + * ListProcessorTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @instance + */ + ListProcessorTypesRequest.prototype.pageSize = 0; + + /** + * 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.ListProcessorTypesRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest instance + */ + ListProcessorTypesRequest.create = function create(properties) { + return new ListProcessorTypesRequest(properties); + }; + + /** + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @static + * @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 + */ + ListProcessorTypesRequest.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 ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @static + * @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 + */ + ListProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. + * @function decode + * @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.ListProcessorTypesRequest} ListProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.ListProcessorTypesRequest(); + 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 ListProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + ListProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorTypesRequest message. + * @function verify + * @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 + */ + ListProcessorTypesRequest.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 ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest + */ + ListProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorTypesRequest) + return object; + 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 ListProcessorTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @static + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.priority === "number") { + message.priority = object.priority; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.occurrenceType === "number") { + message.occurrenceType = object.occurrenceType; + break; + } + break; + 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] === undefined ? message.occurrenceType : $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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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.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 + * @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 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 + * @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.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; + }; + + /** + * 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 12: { + message.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.decode(reader, reader.uint32()); + 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.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: + 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); + 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") { + message.state = object.state; + break; + } + break; + 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.documentSchema = null; + 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] === 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")) + 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.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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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 + */ + 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.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")) + 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.v1.Processor + * @instance + * @returns {Object.} JSON object + */ + Processor.prototype.toJSON = function toJSON() { + 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 + * @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.ProcessorType = (function() { + + /** + * Properties of a ProcessorType. + * @memberof google.cloud.documentai.v1 + * @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 ProcessorType. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ProcessorType. + * @implements IProcessorType + * @constructor + * @param {google.cloud.documentai.v1.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.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.name = ""; + + /** + * ProcessorType type. + * @member {string} type + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.type = ""; + + /** + * ProcessorType category. + * @member {string} category + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.category = ""; + + /** + * ProcessorType availableLocations. + * @member {Array.} availableLocations + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.availableLocations = $util.emptyArray; + + /** + * 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.ProcessorType + * @static + * @param {google.cloud.documentai.v1.IProcessorType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType instance + */ + ProcessorType.create = function create(properties) { + return new ProcessorType(properties); + }; + + /** + * Encodes the specified ProcessorType message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessorType + * @static + * @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 + */ + 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.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 ProcessorType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorType + * @static + * @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 + */ + 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.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.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.v1.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.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; + } + } + return message; + }; + + /** + * Decodes a ProcessorType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1.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.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 "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a ProcessorType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessorType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType + */ + ProcessorType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorType) + return object; + 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) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + 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; + }; + + /** + * Creates a plain object from a ProcessorType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessorType + * @static + * @param {google.cloud.documentai.v1.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; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + } + 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] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + return object; + }; + + /** + * Converts this ProcessorType to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + * @returns {Object.} JSON object + */ + ProcessorType.prototype.toJSON = function toJSON() { + 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + return ProcessorType; + })(); + + 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|null|undefined} uri + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.uri = null; + + /** + * Document content. + * @member {Uint8Array|null|undefined} content + * @memberof google.cloud.documentai.v1beta1.Document + * @instance + */ + Document.prototype.content = null; + + /** + * 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 >= 0) + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; + 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] === undefined ? message.orientation : $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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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] === undefined ? message.type : $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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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() { + + /** + * Namespace v1beta2. + * @memberof google.cloud.documentai + * @namespace + */ + var v1beta2 = {}; + + v1beta2.Document = (function() { + + /** + * 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 {google.cloud.documentai.v1beta2.IDocument=} [properties] Properties to set + */ + 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]]; + } + + /** + * Document uri. + * @member {string|null|undefined} uri + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.uri = null; + + /** + * Document content. + * @member {Uint8Array|null|undefined} content + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.content = null; + + /** + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.mimeType = ""; + + /** + * Document text. + * @member {string} text + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.text = ""; + + /** + * Document textStyles. + * @member {Array.} textStyles + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.textStyles = $util.emptyArray; + + /** + * Document pages. + * @member {Array.} pages + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.pages = $util.emptyArray; + + /** + * Document entities. + * @member {Array.} entities + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.entities = $util.emptyArray; + + /** + * Document entityRelations. + * @member {Array.} entityRelations + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.entityRelations = $util.emptyArray; + + /** + * Document shardInfo. + * @member {google.cloud.documentai.v1beta2.Document.IShardInfo|null|undefined} shardInfo + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.shardInfo = null; + + /** + * Document labels. + * @member {Array.} labels + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + */ + Document.prototype.labels = $util.emptyArray; + + /** + * Document error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.documentai.v1beta2.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.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.v1beta2.Document + * @static + * @param {google.cloud.documentai.v1beta2.IDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Document + * @static + * @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 + */ + 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.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 && 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 && 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) + $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 Document message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.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; + } + } + return message; + }; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.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.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 Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.Document + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Document} Document + */ + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Document) + return object; + 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 >= 0) + 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.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 Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Document + * @static + * @param {google.cloud.documentai.v1beta2.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.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); + } + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + 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() { + + /** + * 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]]; + } + + /** + * 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 && 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.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); + }; + + /** + * 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; + })(); + + 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]]; + } + + /** + * Label automlModel. + * @member {string|null|undefined} automlModel + * @memberof google.cloud.documentai.v1beta2.Document.Label + * @instance + */ + Label.prototype.automlModel = null; + + /** + * 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 && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.automlModel != null && Object.hasOwnProperty.call(message, "automlModel")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.automlModel); + if (message.confidence != null && Object.hasOwnProperty.call(message, "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); + }; + + /** + * 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; + })(); + + 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]]; + } + + /** + * 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 && 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 && 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.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); + }; + + /** + * 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() { + + /** + * 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 && 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.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); + }; + + /** + * 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; + })(); + + 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 && 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.v1beta2.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.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); + }; + + /** + * 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() { + + /** + * 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 && 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.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); + }; + + /** + * 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; + })(); + + 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 && 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 && 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.v1beta2.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); + if (message.id != null && Object.hasOwnProperty.call(message, "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) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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.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 && 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) + $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); + }; + + /** + * 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; + })(); + + 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 && 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) + $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); + }; + + /** + * 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; + })(); + + 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 && 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) + $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); + }; + + /** + * 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; + })(); + + 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 && 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 && 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) + $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); + }; + + /** + * 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() { + + /** + * 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 && 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.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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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] === undefined ? message.type : $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); + }; + + /** + * 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 + * @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.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 && 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 && 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.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); + }; + + /** + * 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; + })(); + + 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 && 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) + $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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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 && 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 && 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.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); + }; + + /** + * 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; + })(); + + 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 && 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 && 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) + $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 && 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); + 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); + }; + + /** + * 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; + })(); + + 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 && 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.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); + }; + + /** + * 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; + })(); + + 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 + */ + + /** + * 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 = ""; + + /** + * 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 && 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 && 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.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); + 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; + } + 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"; + 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); + 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 = ""; + } + 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; + 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); + }; + + /** + * 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; + })(); + + 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 && 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.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); + }; + + /** + * 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; + })(); + + Document.TextAnchor = (function() { + + /** + * Properties of a TextAnchor. + * @memberof google.cloud.documentai.v1beta2.Document + * @interface ITextAnchor + * @property {Array.|null} [textSegments] TextAnchor textSegments + * @property {string|null} [content] TextAnchor content + */ + + /** + * 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; + + /** + * 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 + * @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(); + 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.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; + } + 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.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; + } + } + 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.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]); + } + } + 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.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 (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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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 && 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.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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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 && 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); + 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) { + default: + if (typeof object.layoutType === "number") { + message.layoutType = object.layoutType; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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; + })(); + + return Document; + })(); + + v1beta2.Vertex = (function() { + + /** + * Properties of a Vertex. + * @memberof google.cloud.documentai.v1beta2 + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y + */ + + /** + * 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 + */ + 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.v1beta2.Vertex + * @instance + */ + Vertex.prototype.x = 0; + + /** + * Vertex y. + * @member {number} y + * @memberof google.cloud.documentai.v1beta2.Vertex + * @instance + */ + Vertex.prototype.y = 0; + + /** + * Creates a new Vertex instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.Vertex + * @static + * @param {google.cloud.documentai.v1beta2.IVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.Vertex} Vertex instance + */ + Vertex.create = function create(properties) { + return new Vertex(properties); + }; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.documentai.v1beta2.Vertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.Vertex + * @static + * @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 + */ + 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.v1beta2.Vertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.Vertex + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.Vertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.Vertex} Vertex + */ + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.Vertex) + return object; + 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 Vertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.Vertex + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.Vertex + * @instance + * @returns {Object.} JSON object + */ + Vertex.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.NormalizedVertex = (function() { + + /** + * 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 NormalizedVertex. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.NormalizedVertex + * @instance + */ + NormalizedVertex.prototype.x = 0; + + /** + * 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.v1beta2.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta2.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.NormalizedVertex} NormalizedVertex instance + */ + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); + }; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.documentai.v1beta2.NormalizedVertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex + * @static + * @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 + */ + 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.v1beta2.NormalizedVertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.NormalizedVertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.NormalizedVertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.NormalizedVertex} NormalizedVertex + */ + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.NormalizedVertex) + return object; + 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 NormalizedVertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.NormalizedVertex + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.NormalizedVertex + * @instance + * @returns {Object.} JSON object + */ + NormalizedVertex.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.BoundingPoly = (function() { + + /** + * 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 BoundingPoly. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.BoundingPoly + * @instance + */ + BoundingPoly.prototype.vertices = $util.emptyArray; + + /** + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @instance + */ + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta2.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.BoundingPoly} BoundingPoly instance + */ + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); + }; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.documentai.v1beta2.BoundingPoly.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @static + * @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 + */ + 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.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 BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.BoundingPoly.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.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; + } + } + return message; + }; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.BoundingPoly + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.BoundingPoly} BoundingPoly + */ + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.BoundingPoly) + return object; + 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.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 BoundingPoly message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @static + * @param {google.cloud.documentai.v1beta2.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.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); + } + return object; + }; + + /** + * Converts this BoundingPoly to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.BoundingPoly + * @instance + * @returns {Object.} JSON object + */ + BoundingPoly.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.DocumentUnderstandingService = (function() { + + /** + * 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; + + /** + * 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.v1beta2.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.v1beta2.BatchProcessDocumentsRequest + * @instance + */ + BatchProcessDocumentsRequest.prototype.requests = $util.emptyArray; + + /** + * 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.v1beta2.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest instance + */ + BatchProcessDocumentsRequest.create = function create(properties) { + return new BatchProcessDocumentsRequest(properties); + }; + + /** + * Encodes the specified BatchProcessDocumentsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest + * @static + * @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 + */ + 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.v1beta2.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.v1beta2.BatchProcessDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.BatchProcessDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.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 a BatchProcessDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest} BatchProcessDocumentsRequest + */ + BatchProcessDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest) + return object; + 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 a BatchProcessDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.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.v1beta2.BatchProcessDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchProcessDocumentsRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.ProcessDocumentRequest = (function() { + + /** + * 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 ProcessDocumentRequest. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a ProcessDocumentRequest. + * @implements IProcessDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1beta2.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 parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.parent = ""; + + /** + * ProcessDocumentRequest inputConfig. + * @member {google.cloud.documentai.v1beta2.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.inputConfig = null; + + /** + * ProcessDocumentRequest outputConfig. + * @member {google.cloud.documentai.v1beta2.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.outputConfig = null; + + /** + * ProcessDocumentRequest documentType. + * @member {string} documentType + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.documentType = ""; + + /** + * ProcessDocumentRequest tableExtractionParams. + * @member {google.cloud.documentai.v1beta2.ITableExtractionParams|null|undefined} tableExtractionParams + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + */ + ProcessDocumentRequest.prototype.tableExtractionParams = null; + + /** + * 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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.OcrParams.encode(message.ocrParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + 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 && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.parent); + return writer; + }; + + /** + * 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.v1beta2.ProcessDocumentRequest + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.ProcessDocumentRequest(); + 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; + } + 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.v1beta2.ProcessDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.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.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; + } + return null; + }; + + /** + * Creates a ProcessDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentRequest} ProcessDocumentRequest + */ + ProcessDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.ProcessDocumentRequest) + return object; + 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.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); + } + return message; + }; + + /** + * Creates a plain object from a ProcessDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta2.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; + object.automlParams = null; + object.parent = ""; + } + 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 ProcessDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ProcessDocumentRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.BatchProcessDocumentsResponse = (function() { + + /** + * Properties of a BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta2 + * @interface IBatchProcessDocumentsResponse + * @property {Array.|null} [responses] BatchProcessDocumentsResponse responses + */ + + /** + * Constructs a new BatchProcessDocumentsResponse. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a BatchProcessDocumentsResponse. + * @implements IBatchProcessDocumentsResponse + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.BatchProcessDocumentsResponse + * @instance + */ + BatchProcessDocumentsResponse.prototype.responses = $util.emptyArray; + + /** + * Creates a new BatchProcessDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse instance + */ + BatchProcessDocumentsResponse.create = function create(properties) { + return new BatchProcessDocumentsResponse(properties); + }; + + /** + * Encodes the specified BatchProcessDocumentsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse + * @static + * @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 + */ + 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.v1beta2.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.v1beta2.BatchProcessDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.BatchProcessDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.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.v1beta2.BatchProcessDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse} BatchProcessDocumentsResponse + */ + BatchProcessDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse) + return object; + 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 BatchProcessDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.ProcessDocumentResponse.toObject(message.responses[j], options); + } + return object; + }; + + /** + * Converts this BatchProcessDocumentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + BatchProcessDocumentsResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.ProcessDocumentResponse = (function() { + + /** + * 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 ProcessDocumentResponse. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a ProcessDocumentResponse. + * @implements IProcessDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @instance + */ + ProcessDocumentResponse.prototype.inputConfig = null; + + /** + * ProcessDocumentResponse outputConfig. + * @member {google.cloud.documentai.v1beta2.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @instance + */ + ProcessDocumentResponse.prototype.outputConfig = null; + + /** + * Creates a new ProcessDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta2.IProcessDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentResponse} ProcessDocumentResponse instance + */ + ProcessDocumentResponse.create = function create(properties) { + return new ProcessDocumentResponse(properties); + }; + + /** + * Encodes the specified ProcessDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta2.ProcessDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @static + * @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 + */ + ProcessDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + 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 && 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; + }; + + /** + * 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.v1beta2.ProcessDocumentResponse + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.ProcessDocumentResponse(); + 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; + } + 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.v1beta2.ProcessDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.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; + } + return null; + }; + + /** + * Creates a ProcessDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.ProcessDocumentResponse} ProcessDocumentResponse + */ + ProcessDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.ProcessDocumentResponse) + return object; + 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); + } + return message; + }; + + /** + * Creates a plain object from a ProcessDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta2.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.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 ProcessDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.ProcessDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ProcessDocumentResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.OcrParams = (function() { + + /** + * Properties of an OcrParams. + * @memberof google.cloud.documentai.v1beta2 + * @interface IOcrParams + * @property {Array.|null} [languageHints] OcrParams languageHints + */ + + /** + * Constructs a new OcrParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an OcrParams. + * @implements IOcrParams + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.OcrParams + * @instance + */ + OcrParams.prototype.languageHints = $util.emptyArray; + + /** + * Creates a new OcrParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.OcrParams + * @static + * @param {google.cloud.documentai.v1beta2.IOcrParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.OcrParams} OcrParams instance + */ + OcrParams.create = function create(properties) { + return new OcrParams(properties); + }; + + /** + * Encodes the specified OcrParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.OcrParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.OcrParams + * @static + * @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 + */ + 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.v1beta2.OcrParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.OcrParams + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.OcrParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.OcrParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.OcrParams} OcrParams + */ + OcrParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.OcrParams) + return object; + 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 an OcrParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.OcrParams + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.OcrParams + * @instance + * @returns {Object.} JSON object + */ + OcrParams.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.TableExtractionParams = (function() { + + /** + * 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 TableExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a TableExtractionParams. + * @implements ITableExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.enabled = false; + + /** + * 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.v1beta2.TableExtractionParams + * @instance + */ + TableExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new TableExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta2.ITableExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.TableExtractionParams} TableExtractionParams instance + */ + TableExtractionParams.create = function create(properties) { + return new TableExtractionParams(properties); + }; + + /** + * Encodes the specified TableExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.TableExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @static + * @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 + */ + 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.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 && 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.v1beta2.TableExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.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; + } + } + return message; + }; + + /** + * Decodes a TableExtractionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.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"; + return null; + }; + + /** + * Creates a TableExtractionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.TableExtractionParams} TableExtractionParams + */ + TableExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.TableExtractionParams) + return object; + 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 a TableExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @static + * @param {google.cloud.documentai.v1beta2.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.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 TableExtractionParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.TableExtractionParams + * @instance + * @returns {Object.} JSON object + */ + TableExtractionParams.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.TableBoundHint = (function() { + + /** + * 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 TableBoundHint. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a TableBoundHint. + * @implements ITableBoundHint + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.TableBoundHint + * @instance + */ + TableBoundHint.prototype.pageNumber = 0; + + /** + * TableBoundHint boundingBox. + * @member {google.cloud.documentai.v1beta2.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.documentai.v1beta2.TableBoundHint + * @instance + */ + TableBoundHint.prototype.boundingBox = null; + + /** + * Creates a new TableBoundHint instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta2.ITableBoundHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.TableBoundHint} TableBoundHint instance + */ + TableBoundHint.create = function create(properties) { + return new TableBoundHint(properties); + }; + + /** + * Encodes the specified TableBoundHint message. Does not implicitly {@link google.cloud.documentai.v1beta2.TableBoundHint.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.TableBoundHint + * @static + * @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 + */ + 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.v1beta2.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.v1beta2.TableBoundHint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.TableBoundHint + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.TableBoundHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.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.v1beta2.TableBoundHint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.TableBoundHint} TableBoundHint + */ + TableBoundHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.TableBoundHint) + return object; + 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); + } + return message; + }; + + /** + * Creates a plain object from a TableBoundHint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.TableBoundHint + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.BoundingPoly.toObject(message.boundingBox, options); + return object; + }; + + /** + * Converts this TableBoundHint to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.TableBoundHint + * @instance + * @returns {Object.} JSON object + */ + TableBoundHint.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.FormExtractionParams = (function() { + + /** + * 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 FormExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a FormExtractionParams. + * @implements IFormExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.enabled = false; + + /** + * FormExtractionParams keyValuePairHints. + * @member {Array.} keyValuePairHints + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.keyValuePairHints = $util.emptyArray; + + /** + * FormExtractionParams modelVersion. + * @member {string} modelVersion + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams + * @instance + */ + FormExtractionParams.prototype.modelVersion = ""; + + /** + * Creates a new FormExtractionParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta2.IFormExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.FormExtractionParams} FormExtractionParams instance + */ + FormExtractionParams.create = function create(properties) { + return new FormExtractionParams(properties); + }; + + /** + * Encodes the specified FormExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.FormExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams + * @static + * @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 + */ + 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.v1beta2.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.v1beta2.FormExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.FormExtractionParams + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.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.v1beta2.FormExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.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.v1beta2.FormExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.FormExtractionParams} FormExtractionParams + */ + FormExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.FormExtractionParams) + return object; + 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.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.v1beta2.FormExtractionParams + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.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.v1beta2.FormExtractionParams + * @instance + * @returns {Object.} JSON object + */ + FormExtractionParams.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.KeyValuePairHint = (function() { + + /** + * 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 KeyValuePairHint. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a KeyValuePairHint. + * @implements IKeyValuePairHint + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.KeyValuePairHint + * @instance + */ + KeyValuePairHint.prototype.key = ""; + + /** + * 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.v1beta2.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta2.IKeyValuePairHint=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.KeyValuePairHint} KeyValuePairHint instance + */ + KeyValuePairHint.create = function create(properties) { + return new KeyValuePairHint(properties); + }; + + /** + * Encodes the specified KeyValuePairHint message. Does not implicitly {@link google.cloud.documentai.v1beta2.KeyValuePairHint.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint + * @static + * @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 + */ + 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.v1beta2.KeyValuePairHint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.KeyValuePairHint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.KeyValuePairHint + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.KeyValuePairHint} KeyValuePairHint + */ + KeyValuePairHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.KeyValuePairHint) + return object; + 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 KeyValuePairHint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.KeyValuePairHint + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.KeyValuePairHint + * @instance + * @returns {Object.} JSON object + */ + KeyValuePairHint.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.EntityExtractionParams = (function() { + + /** + * 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 EntityExtractionParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an EntityExtractionParams. + * @implements IEntityExtractionParams + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.EntityExtractionParams + * @instance + */ + EntityExtractionParams.prototype.enabled = false; + + /** + * 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.v1beta2.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta2.IEntityExtractionParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.EntityExtractionParams} EntityExtractionParams instance + */ + EntityExtractionParams.create = function create(properties) { + return new EntityExtractionParams(properties); + }; + + /** + * Encodes the specified EntityExtractionParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.EntityExtractionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams + * @static + * @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 + */ + 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.v1beta2.EntityExtractionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.EntityExtractionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.EntityExtractionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.EntityExtractionParams} EntityExtractionParams + */ + EntityExtractionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.EntityExtractionParams) + return object; + 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 an EntityExtractionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.EntityExtractionParams + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.EntityExtractionParams + * @instance + * @returns {Object.} JSON object + */ + EntityExtractionParams.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.AutoMlParams = (function() { + + /** + * Properties of an AutoMlParams. + * @memberof google.cloud.documentai.v1beta2 + * @interface IAutoMlParams + * @property {string|null} [model] AutoMlParams model + */ + + /** + * Constructs a new AutoMlParams. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an AutoMlParams. + * @implements IAutoMlParams + * @constructor + * @param {google.cloud.documentai.v1beta2.IAutoMlParams=} [properties] Properties to set + */ + function AutoMlParams(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AutoMlParams model. + * @member {string} model + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @instance + */ + AutoMlParams.prototype.model = ""; + + /** + * Creates a new AutoMlParams instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @static + * @param {google.cloud.documentai.v1beta2.IAutoMlParams=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.AutoMlParams} AutoMlParams instance + */ + AutoMlParams.create = function create(properties) { + return new AutoMlParams(properties); + }; + + /** + * Encodes the specified AutoMlParams message. Does not implicitly {@link google.cloud.documentai.v1beta2.AutoMlParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @static + * @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 + */ + AutoMlParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); + return writer; + }; + + /** + * Encodes the specified AutoMlParams message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta2.AutoMlParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @static + * @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 + */ + AutoMlParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutoMlParams message from the specified reader or buffer. + * @function decode + * @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.v1beta2.AutoMlParams} AutoMlParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.v1beta2.AutoMlParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutoMlParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + AutoMlParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutoMlParams message. + * @function verify + * @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 + */ + AutoMlParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates an AutoMlParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.AutoMlParams} AutoMlParams + */ + AutoMlParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.AutoMlParams) + return object; + 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 AutoMlParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @static + * @param {google.cloud.documentai.v1beta2.AutoMlParams} message AutoMlParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutoMlParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.model = ""; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; + + /** + * Converts this AutoMlParams to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.AutoMlParams + * @instance + * @returns {Object.} JSON object + */ + AutoMlParams.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.InputConfig = (function() { + + /** + * 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 InputConfig. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an InputConfig. + * @implements IInputConfig + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @instance + */ + InputConfig.prototype.gcsSource = null; + + /** + * InputConfig contents. + * @member {Uint8Array|null|undefined} contents + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @instance + */ + InputConfig.prototype.contents = null; + + /** + * 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.v1beta2.InputConfig + * @static + * @param {google.cloud.documentai.v1beta2.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.InputConfig} InputConfig instance + */ + InputConfig.create = function create(properties) { + return new InputConfig(properties); + }; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta2.InputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @static + * @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 + */ + InputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + 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 && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.contents != null && Object.hasOwnProperty.call(message, "contents")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.contents); + return writer; + }; + + /** + * 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.v1beta2.InputConfig + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.InputConfig(); + 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; + } + 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.v1beta2.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.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 an InputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.InputConfig} InputConfig + */ + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.InputConfig) + return object; + 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 >= 0) + message.contents = object.contents; + 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.v1beta2.InputConfig + * @static + * @param {google.cloud.documentai.v1beta2.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.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"; + } + return object; + }; + + /** + * Converts this InputConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta2.InputConfig + * @instance + * @returns {Object.} JSON object + */ + InputConfig.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.OutputConfig = (function() { + + /** + * 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 OutputConfig. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.documentai.v1beta2.OutputConfig + * @instance + */ + OutputConfig.prototype.gcsDestination = null; + + /** + * OutputConfig pagesPerShard. + * @member {number} pagesPerShard + * @memberof google.cloud.documentai.v1beta2.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.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.v1beta2.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta2.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.OutputConfig} OutputConfig instance + */ + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); + }; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.documentai.v1beta2.OutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.OutputConfig + * @static + * @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 + */ + OutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + 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 && 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.v1beta2.OutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.OutputConfig + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.OutputConfig(); + 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; + } + 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.v1beta2.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.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 an OutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta2.OutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.OutputConfig} OutputConfig + */ + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.OutputConfig) + return object; + 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 an OutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.OutputConfig + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.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.v1beta2.OutputConfig + * @instance + * @returns {Object.} JSON object + */ + OutputConfig.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta2.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.documentai.v1beta2 + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.documentai.v1beta2 + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.documentai.v1beta2.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.v1beta2.GcsSource + * @instance + */ + GcsSource.prototype.uri = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta2.GcsSource + * @static + * @param {google.cloud.documentai.v1beta2.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta2.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.documentai.v1beta2.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta2.GcsSource + * @static + * @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 + */ + 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.v1beta2.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta2.GcsSource + * @static + * @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 + */ + 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.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.v1beta2.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.v1beta2.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.v1beta2.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta2.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.v1beta2.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta2.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta2.GcsSource) + return object; + 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 GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta2.GcsSource + * @static + * @param {google.cloud.documentai.v1beta2.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.v1beta2.GcsSource + * @instance + * @returns {Object.} JSON object + */ + GcsSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GcsSource + * @function getTypeUrl + * @memberof google.cloud.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; + })(); + + v1beta2.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.documentai.v1beta2 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ + + /** + * 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]]; + } + + /** + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.documentai.v1beta2.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; + + /** + * 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); + }; + + /** + * 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 && 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.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(); + }; + + /** + * 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; + }; + + /** + * 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()); + }; + + /** + * 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; + }; + + /** + * 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; + }; + + /** + * 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + v1beta2.OperationMetadata = (function() { + + /** + * 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]]; + } + + /** + * OperationMetadata state. + * @member {google.cloud.documentai.v1beta2.OperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.state = 0; + + /** + * OperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.stateMessage = ""; + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta2.OperationMetadata + * @instance + */ + OperationMetadata.prototype.updateTime = null; + + /** + * 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); + }; + + /** + * 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 && 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.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(); + }; + + /** + * 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; + }; + + /** + * 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()); + }; + + /** + * 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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 v1beta2; + })(); + + documentai.v1beta3 = (function() { + + /** + * Namespace v1beta3. + * @memberof google.cloud.documentai + * @namespace + */ + 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); + }; + + /** + * 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; + })(); + + v1beta3.Document = (function() { + + /** + * 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} [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 + */ + + /** + * 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.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|null|undefined} uri + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.uri = null; + + /** + * Document content. + * @member {Uint8Array|null|undefined} content + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.content = null; + + /** + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.mimeType = ""; + + /** + * Document text. + * @member {string} text + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.text = ""; + + /** + * Document textStyles. + * @member {Array.} textStyles + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.textStyles = $util.emptyArray; + + /** + * Document pages. + * @member {Array.} pages + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.pages = $util.emptyArray; + + /** + * Document entities. + * @member {Array.} entities + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.entities = $util.emptyArray; + + /** + * Document entityRelations. + * @member {Array.} entityRelations + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.entityRelations = $util.emptyArray; + + /** + * Document textChanges. + * @member {Array.} textChanges + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.textChanges = $util.emptyArray; + + /** + * Document shardInfo. + * @member {google.cloud.documentai.v1beta3.Document.IShardInfo|null|undefined} shardInfo + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.shardInfo = null; + + /** + * Document error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.documentai.v1beta3.Document + * @instance + */ + Document.prototype.error = null; + + /** + * Document revisions. + * @member {Array.} revisions + * @memberof google.cloud.documentai.v1beta3.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.v1beta3.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.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); + }; + + /** + * 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.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; + }; + + /** + * 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(); + }; + + /** + * 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 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.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 >= 0) + 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.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.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.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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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 + * @property {Array.|null} [symbols] Page symbols + * @property {Array.|null} [detectedBarcodes] Page detectedBarcodes + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Page provenance + */ + + /** + * 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 = []; + this.symbols = []; + this.detectedBarcodes = []; + if (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; + + /** + * Page symbols. + * @member {Array.} symbols + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + 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 + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.provenance = null; + + /** + * 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.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) + 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; + }; + + /** + * 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; + } + 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; + } + } + 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; + } + } + 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.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) + return "provenance." + 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]); + } + } + 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.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"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } + 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.symbols = []; + object.transforms = []; + object.detectedBarcodes = []; + } + if (options.defaults) { + object.pageNumber = 0; + object.dimension = null; + object.layout = null; + object.image = null; + object.provenance = 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.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) { + 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); + } + 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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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 >= 0) + 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); + }; + + /** + * 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; + })(); + + 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 >= 0) + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.orientation === "number") { + message.orientation = object.orientation; + break; + } + break; + 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] === undefined ? message.orientation : $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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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] === undefined ? message.type : $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); + }; + + /** + * 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 + * @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.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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 + * @property {string|null} [correctedKeyText] FormField correctedKeyText + * @property {string|null} [correctedValueText] FormField correctedValueText + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] FormField provenance + */ + + /** + * 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 = ""; + + /** + * FormField correctedKeyText. + * @member {string} correctedKeyText + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + FormField.prototype.correctedKeyText = ""; + + /** + * FormField correctedValueText. + * @member {string} correctedValueText + * @memberof google.cloud.documentai.v1beta3.Document.Page.FormField + * @instance + */ + 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); + }; + + /** + * 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); + 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; + }; + + /** + * 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; + } + 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; + } + } + 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"; + 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) + return "provenance." + 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.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); + 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"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } + 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 = ""; + object.correctedKeyText = ""; + object.correctedValueText = ""; + object.provenance = null; + } + 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; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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 {boolean|null} [booleanValue] NormalizedValue booleanValue + * @property {number|null} [integerValue] NormalizedValue integerValue + * @property {number|null} [floatValue] NormalizedValue floatValue + * @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 booleanValue. + * @member {boolean|null|undefined} booleanValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue + * @instance + */ + 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 + * @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"|"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", "integerValue", "floatValue"]), + 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(); + 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; + }; + + /** + * 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 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; + } + } + 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.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.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"; + 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.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; + }; + + /** + * 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"; + } + if (message.booleanValue != null && message.hasOwnProperty("booleanValue")) { + object.booleanValue = message.booleanValue; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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 + * @property {number|null} [confidence] PageRef confidence + */ + + /** + * 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; + + /** + * 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 + * @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(); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + 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; + } + case 5: { + message.confidence = reader.float(); + 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; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number 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.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) { + default: + if (typeof object.layoutType === "number") { + message.layoutType = object.layoutType; + break; + } + break; + 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); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + 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; + object.confidence = 0; + } + 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] === 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")) + 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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: + 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.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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + 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.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] === undefined ? message.type : $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); + }; + + /** + * 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() { + + /** + * Properties of a Parent. + * @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 + */ + + /** + * 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 index. + * @member {number} index + * @memberof google.cloud.documentai.v1beta3.Document.Provenance.Parent + * @instance + */ + Parent.prototype.index = 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); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.index); + 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 3: { + message.index = 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.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"; + 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.index != null) + message.index = object.index | 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; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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 + * @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.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 {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 + */ + + /** + * 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 = []; + this.parentIds = []; + if (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|null|undefined} agent + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.agent = null; + + /** + * Revision processor. + * @member {string|null|undefined} processor + * @memberof google.cloud.documentai.v1beta3.Document.Revision + * @instance + */ + Revision.prototype.processor = null; + + /** + * 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 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 + * @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(); + 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; + }; + + /** + * 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 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; + } + } + 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.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) + 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.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"); + 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 = []; + object.parentIds = []; + } + 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); + 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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + v1beta3.RawDocument = (function() { + + /** + * Properties of a RawDocument. + * @memberof google.cloud.documentai.v1beta3 + * @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 {google.cloud.documentai.v1beta3.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.v1beta3.RawDocument + * @instance + */ + RawDocument.prototype.content = $util.newBuffer([]); + + /** + * 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.RawDocument + * @static + * @param {google.cloud.documentai.v1beta3.IRawDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.RawDocument} RawDocument instance + */ + RawDocument.create = function create(properties) { + return new RawDocument(properties); + }; + + /** + * 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; + }; + + /** + * 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 + */ + 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.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 >= 0) + 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 + * @returns {Object.} JSON object + */ + RawDocument.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.GcsDocument = (function() { + + /** + * Properties of a GcsDocument. + * @memberof google.cloud.documentai.v1beta3 + * @interface IGcsDocument + * @property {string|null} [gcsUri] GcsDocument gcsUri + * @property {string|null} [mimeType] GcsDocument mimeType + */ + + /** + * 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 + */ + GcsDocument.prototype.gcsUri = ""; + + /** + * GcsDocument mimeType. + * @member {string} mimeType + * @memberof google.cloud.documentai.v1beta3.GcsDocument + * @instance + */ + GcsDocument.prototype.mimeType = ""; + + /** + * 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); + }; + + /** + * 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 + */ + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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|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|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 + * @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|getProcessor}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef GetProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.Processor} [response] Processor + */ + + /** + * Calls GetProcessor. + * @function getProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @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.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 GetProcessor. + * @function getProcessor + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @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|getProcessorVersion}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef GetProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.ProcessorVersion} [response] ProcessorVersion + */ + + /** + * Calls GetProcessorVersion. + * @function getProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @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.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 GetProcessorVersion. + * @function getProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @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|listProcessorVersions}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ListProcessorVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} [response] ListProcessorVersionsResponse + */ + + /** + * Calls ListProcessorVersions. + * @function listProcessorVersions + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @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.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 ListProcessorVersions. + * @function listProcessorVersions + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @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|deleteProcessorVersion}. + * @memberof google.cloud.documentai.v1beta3.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.v1beta3.DocumentProcessorService + * @instance + * @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.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 DeleteProcessorVersion. + * @function deleteProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @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|deployProcessorVersion}. + * @memberof google.cloud.documentai.v1beta3.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.v1beta3.DocumentProcessorService + * @instance + * @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.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 DeployProcessorVersion. + * @function deployProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest} request DeployProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * 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 + */ + + /** + * 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 + */ + 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" }); + + /** + * 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 + */ + + /** + * 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 + */ + 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; + + /** + * 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; + + /** + * 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(); + 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; + }; + + /** + * 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; + } + case 6: { + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + 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"; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } + 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); + 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; + }; + + /** + * 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; + object.fieldMask = null; + } + 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"; + } + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) + object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); + 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); + }; + + /** + * 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; + })(); + + v1beta3.HumanReviewStatus = (function() { + + /** + * Properties of a HumanReviewStatus. + * @memberof google.cloud.documentai.v1beta3 + * @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 HumanReviewStatus. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a HumanReviewStatus. + * @implements IHumanReviewStatus + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.HumanReviewStatus.State} state + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @instance + */ + HumanReviewStatus.prototype.state = 0; + + /** + * HumanReviewStatus stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @instance + */ + HumanReviewStatus.prototype.stateMessage = ""; + + /** + * HumanReviewStatus humanReviewOperation. + * @member {string} humanReviewOperation + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @instance + */ + HumanReviewStatus.prototype.humanReviewOperation = ""; + + /** + * Creates a new HumanReviewStatus instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @static + * @param {google.cloud.documentai.v1beta3.IHumanReviewStatus=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.HumanReviewStatus} HumanReviewStatus instance + */ + HumanReviewStatus.create = function create(properties) { + return new HumanReviewStatus(properties); + }; + + /** + * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1beta3.HumanReviewStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @static + * @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 + */ + 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.v1beta3.HumanReviewStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.HumanReviewStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.HumanReviewStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.HumanReviewStatus} HumanReviewStatus + */ + HumanReviewStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.HumanReviewStatus) + 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; + 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.v1beta3.HumanReviewStatus + * @static + * @param {google.cloud.documentai.v1beta3.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.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")) + object.humanReviewOperation = message.humanReviewOperation; + return object; + }; + + /** + * Converts this HumanReviewStatus to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.HumanReviewStatus + * @instance + * @returns {Object.} JSON object + */ + HumanReviewStatus.prototype.toJSON = function toJSON() { + 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 + * @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() { + + /** + * 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 + * @property {google.cloud.documentai.v1beta3.IHumanReviewStatus|null} [humanReviewStatus] ProcessResponse humanReviewStatus + */ + + /** + * 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 = ""; + + /** + * 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 + * @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); + 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; + }; + + /** + * 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; + } + case 3: { + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.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.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"; + 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; + }; + + /** + * 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); + 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; + }; + + /** + * 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 = ""; + 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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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 + * @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 + */ + + /** + * 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; + + /** + * 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 + * @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(); + 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; + }; + + /** + * 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; + } + 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; + } + } + 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; + } + 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; + }; + + /** + * 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); + } + 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; + }; + + /** + * 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; + object.skipHumanReview = false; + object.inputDocuments = null; + object.documentOutputConfig = 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); + 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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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() { + + /** + * 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 + * @property {google.cloud.documentai.v1beta3.IHumanReviewStatus|null} [humanReviewStatus] IndividualProcessStatus humanReviewStatus + */ + + /** + * 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 = ""; + + /** + * 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. + * @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); + 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; + }; + + /** + * 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; + } + case 5: { + message.humanReviewStatus = $root.google.cloud.documentai.v1beta3.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.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"; + 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; + }; + + /** + * 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); + 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; + }; + + /** + * 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 = ""; + 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.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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * 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.FetchProcessorTypesRequest = (function() { + + /** + * Properties of a FetchProcessorTypesRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IFetchProcessorTypesRequest + * @property {string|null} [parent] FetchProcessorTypesRequest parent + */ + + /** + * Constructs a new FetchProcessorTypesRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a FetchProcessorTypesRequest. + * @implements IFetchProcessorTypesRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest=} [properties] Properties to set + */ + function FetchProcessorTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FetchProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @instance + */ + FetchProcessorTypesRequest.prototype.parent = ""; + + /** + * Creates a new FetchProcessorTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @static + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} FetchProcessorTypesRequest instance + */ + FetchProcessorTypesRequest.create = function create(properties) { + return new FetchProcessorTypesRequest(properties); + }; + + /** + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @static + * @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 + */ + FetchProcessorTypesRequest.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); + return writer; + }; + + /** + * 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.FetchProcessorTypesRequest + * @static + * @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 + */ + FetchProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. + * @function decode + * @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.FetchProcessorTypesRequest} FetchProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.FetchProcessorTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + FetchProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FetchProcessorTypesRequest message. + * @function verify + * @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 + */ + FetchProcessorTypesRequest.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"; + return null; + }; + + /** + * Creates a FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} FetchProcessorTypesRequest + */ + FetchProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest) + return object; + 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 FetchProcessorTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @static + * @param {google.cloud.documentai.v1beta3.FetchProcessorTypesRequest} message FetchProcessorTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FetchProcessorTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this FetchProcessorTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesRequest + * @instance + * @returns {Object.} JSON object + */ + FetchProcessorTypesRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.FetchProcessorTypesResponse = (function() { + + /** + * Properties of a FetchProcessorTypesResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IFetchProcessorTypesResponse + * @property {Array.|null} [processorTypes] FetchProcessorTypesResponse processorTypes + */ + + /** + * Constructs a new FetchProcessorTypesResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a FetchProcessorTypesResponse. + * @implements IFetchProcessorTypesResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse=} [properties] Properties to set + */ + function FetchProcessorTypesResponse(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]]; + } + + /** + * FetchProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @instance + */ + FetchProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; + + /** + * Creates a new FetchProcessorTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1beta3.IFetchProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} FetchProcessorTypesResponse instance + */ + FetchProcessorTypesResponse.create = function create(properties) { + return new FetchProcessorTypesResponse(properties); + }; + + /** + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @static + * @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 + */ + FetchProcessorTypesResponse.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.v1beta3.ProcessorType.encode(message.processorTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * 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.FetchProcessorTypesResponse + * @static + * @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 + */ + FetchProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. + * @function decode + * @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.FetchProcessorTypesResponse} FetchProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.FetchProcessorTypesResponse(); + 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; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + FetchProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FetchProcessorTypesResponse message. + * @function verify + * @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 + */ + FetchProcessorTypesResponse.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.v1beta3.ProcessorType.verify(message.processorTypes[i]); + if (error) + return "processorTypes." + error; + } + } + return null; + }; + + /** + * Creates a FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} FetchProcessorTypesResponse + */ + FetchProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse) + return object; + 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 FetchProcessorTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1beta3.FetchProcessorTypesResponse} message FetchProcessorTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FetchProcessorTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + 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 FetchProcessorTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.FetchProcessorTypesResponse + * @instance + * @returns {Object.} JSON object + */ + FetchProcessorTypesResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.ListProcessorTypesRequest = (function() { + + /** + * Properties of a ListProcessorTypesRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IListProcessorTypesRequest + * @property {string|null} [parent] ListProcessorTypesRequest parent + * @property {number|null} [pageSize] ListProcessorTypesRequest pageSize + * @property {string|null} [pageToken] ListProcessorTypesRequest pageToken + */ + + /** + * Constructs a new ListProcessorTypesRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ListProcessorTypesRequest. + * @implements IListProcessorTypesRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest=} [properties] Properties to set + */ + function ListProcessorTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @instance + */ + ListProcessorTypesRequest.prototype.parent = ""; + + /** + * ListProcessorTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @instance + */ + ListProcessorTypesRequest.prototype.pageSize = 0; + + /** + * ListProcessorTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @instance + */ + ListProcessorTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @static + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesRequest} ListProcessorTypesRequest instance + */ + ListProcessorTypesRequest.create = function create(properties) { + return new ListProcessorTypesRequest(properties); + }; + + /** + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @static + * @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 + */ + ListProcessorTypesRequest.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 ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @static + * @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 + */ + ListProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. + * @function decode + * @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.ListProcessorTypesRequest} ListProcessorTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.ListProcessorTypesRequest(); + 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 ListProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + ListProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorTypesRequest message. + * @function verify + * @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 + */ + ListProcessorTypesRequest.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 ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesRequest} ListProcessorTypesRequest + */ + ListProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorTypesRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.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 ListProcessorTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ListProcessorTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorTypesRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.ListProcessorTypesResponse = (function() { + + /** + * Properties of a ListProcessorTypesResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IListProcessorTypesResponse + * @property {Array.|null} [processorTypes] ListProcessorTypesResponse processorTypes + * @property {string|null} [nextPageToken] ListProcessorTypesResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorTypesResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ListProcessorTypesResponse. + * @implements IListProcessorTypesResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ListProcessorTypesResponse + * @instance + */ + ListProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; + + /** + * ListProcessorTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse + * @instance + */ + ListProcessorTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1beta3.IListProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} ListProcessorTypesResponse instance + */ + ListProcessorTypesResponse.create = function create(properties) { + return new ListProcessorTypesResponse(properties); + }; + + /** + * Encodes the specified ListProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse + * @static + * @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 + */ + 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.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 ListProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorTypesResponse + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListProcessorTypesResponse} ListProcessorTypesResponse + */ + ListProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorTypesResponse) + return object; + 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) + 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.v1beta3.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.ListProcessorTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorTypesResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.ListProcessorsRequest = (function() { + + /** + * Properties of a ListProcessorsRequest. + * @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 + */ + + /** + * Constructs a new ListProcessorsRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ListProcessorsRequest. + * @implements IListProcessorsRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.parent = ""; + + /** + * ListProcessorsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.pageSize = 0; + + /** + * 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.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1beta3.IListProcessorsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest instance + */ + ListProcessorsRequest.create = function create(properties) { + return new ListProcessorsRequest(properties); + }; + + /** + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @static + * @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 + */ + 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.v1beta3.ListProcessorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.ListProcessorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.ListProcessorsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListProcessorsRequest} ListProcessorsRequest + */ + ListProcessorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsRequest) + return object; + 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 ListProcessorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ListProcessorsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorsRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.ListProcessorsResponse = (function() { + + /** + * Properties of a ListProcessorsResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IListProcessorsResponse + * @property {Array.|null} [processors] ListProcessorsResponse processors + * @property {string|null} [nextPageToken] ListProcessorsResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorsResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ListProcessorsResponse. + * @implements IListProcessorsResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ListProcessorsResponse + * @instance + */ + ListProcessorsResponse.prototype.processors = $util.emptyArray; + + /** + * 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.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1beta3.IListProcessorsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse instance + */ + ListProcessorsResponse.create = function create(properties) { + return new ListProcessorsResponse(properties); + }; + + /** + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @static + * @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 + */ + 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.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 ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.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 ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ListProcessorsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListProcessorsResponse} ListProcessorsResponse + */ + ListProcessorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorsResponse) + 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]); + } + } + 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.v1beta3.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.ListProcessorsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorsResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.GetProcessorRequest = (function() { + + /** + * Properties of a GetProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IGetProcessorRequest + * @property {string|null} [name] GetProcessorRequest name + */ + + /** + * Constructs a new GetProcessorRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a GetProcessorRequest. + * @implements IGetProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.GetProcessorRequest + * @instance + */ + GetProcessorRequest.prototype.name = ""; + + /** + * Creates a new GetProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.IGetProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GetProcessorRequest} GetProcessorRequest instance + */ + GetProcessorRequest.create = function create(properties) { + return new GetProcessorRequest(properties); + }; + + /** + * Encodes the specified GetProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest + * @static + * @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 + */ + 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.v1beta3.GetProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.GetProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.GetProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.GetProcessorRequest} GetProcessorRequest + */ + GetProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GetProcessorRequest) + return object; + 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 GetProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.GetProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + GetProcessorRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.GetProcessorVersionRequest = (function() { + + /** + * Properties of a GetProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IGetProcessorVersionRequest + * @property {string|null} [name] GetProcessorVersionRequest name + */ + + /** + * Constructs a new GetProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a GetProcessorVersionRequest. + * @implements IGetProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.GetProcessorVersionRequest + * @instance + */ + GetProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new GetProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.IGetProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GetProcessorVersionRequest} GetProcessorVersionRequest instance + */ + GetProcessorVersionRequest.create = function create(properties) { + return new GetProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified GetProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest + * @static + * @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 + */ + 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.v1beta3.GetProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.GetProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.GetProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.GetProcessorVersionRequest} GetProcessorVersionRequest + */ + GetProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GetProcessorVersionRequest) + return object; + 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 a GetProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.GetProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetProcessorVersionRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.ListProcessorVersionsRequest = (function() { + + /** + * Properties of a ListProcessorVersionsRequest. + * @memberof google.cloud.documentai.v1beta3 + * @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.v1beta3 + * @classdesc Represents a ListProcessorVersionsRequest. + * @implements IListProcessorVersionsRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.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.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.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsRequest} ListProcessorVersionsRequest instance + */ + ListProcessorVersionsRequest.create = function create(properties) { + return new ListProcessorVersionsRequest(properties); + }; + + /** + * Encodes the specified ListProcessorVersionsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @static + * @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 + */ + 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.v1beta3.ListProcessorVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @static + * @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 + */ + 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.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.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.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; + } + } + return message; + }; + + /** + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.ListProcessorVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsRequest} ListProcessorVersionsRequest + */ + ListProcessorVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest) + return object; + 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 a ListProcessorVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ListProcessorVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorVersionsRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.ListProcessorVersionsResponse = (function() { + + /** + * Properties of a ListProcessorVersionsResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IListProcessorVersionsResponse + * @property {Array.|null} [processorVersions] ListProcessorVersionsResponse processorVersions + * @property {string|null} [nextPageToken] ListProcessorVersionsResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorVersionsResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ListProcessorVersionsResponse. + * @implements IListProcessorVersionsResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ListProcessorVersionsResponse + * @instance + */ + ListProcessorVersionsResponse.prototype.processorVersions = $util.emptyArray; + + /** + * 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.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1beta3.IListProcessorVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} ListProcessorVersionsResponse instance + */ + ListProcessorVersionsResponse.create = function create(properties) { + return new ListProcessorVersionsResponse(properties); + }; + + /** + * Encodes the specified ListProcessorVersionsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse + * @static + * @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 + */ + 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.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 ListProcessorVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListProcessorVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.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.v1beta3.ListProcessorVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.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 a ListProcessorVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListProcessorVersionsResponse} ListProcessorVersionsResponse + */ + ListProcessorVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListProcessorVersionsResponse) + return object; + 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 a ListProcessorVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.ListProcessorVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorVersionsResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.DeleteProcessorVersionRequest = (function() { + + /** + * Properties of a DeleteProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeleteProcessorVersionRequest + * @property {string|null} [name] DeleteProcessorVersionRequest name + */ + + /** + * Constructs a new DeleteProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeleteProcessorVersionRequest. + * @implements IDeleteProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.DeleteProcessorVersionRequest + * @instance + */ + DeleteProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new DeleteProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest instance + */ + DeleteProcessorVersionRequest.create = function create(properties) { + return new DeleteProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified DeleteProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest + * @static + * @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 + */ + 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.v1beta3.DeleteProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.DeleteProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.DeleteProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest + */ + DeleteProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest) + return object; + 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 DeleteProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.DeleteProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorVersionRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.DeleteProcessorVersionMetadata = (function() { + + /** + * Properties of a DeleteProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeleteProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new DeleteProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeleteProcessorVersionMetadata. + * @implements IDeleteProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.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.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.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata instance + */ + DeleteProcessorVersionMetadata.create = function create(properties) { + return new DeleteProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + * @static + * @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 + */ + 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 DeleteProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + * @static + * @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 + */ + 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.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.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.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; + } + } + return message; + }; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.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.v1beta3.DeleteProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata + */ + DeleteProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata) + return object; + 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 DeleteProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeleteProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorVersionMetadata.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.DeployProcessorVersionRequest = (function() { + + /** + * Properties of a DeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeployProcessorVersionRequest + * @property {string|null} [name] DeployProcessorVersionRequest name + */ + + /** + * Constructs a new DeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeployProcessorVersionRequest. + * @implements IDeployProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.DeployProcessorVersionRequest + * @instance + */ + DeployProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new DeployProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionRequest} DeployProcessorVersionRequest instance + */ + DeployProcessorVersionRequest.create = function create(properties) { + return new DeployProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest + * @static + * @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 + */ + 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.v1beta3.DeployProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.DeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.DeployProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionRequest} DeployProcessorVersionRequest + */ + DeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest) + return object; + 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 DeployProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.DeployProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.DeployProcessorVersionResponse = (function() { + + /** + * Properties of a DeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeployProcessorVersionResponse + */ + + /** + * Constructs a new DeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeployProcessorVersionResponse. + * @implements IDeployProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionResponse} DeployProcessorVersionResponse instance + */ + DeployProcessorVersionResponse.create = function create(properties) { + return new DeployProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse + * @static + * @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 + */ + 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.v1beta3.DeployProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.DeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.DeployProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionResponse} DeployProcessorVersionResponse + */ + DeployProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse(); + }; + + /** + * Creates a plain object from a DeployProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.DeployProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.DeployProcessorVersionMetadata = (function() { + + /** + * Properties of a DeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDeployProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] DeployProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new DeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DeployProcessorVersionMetadata. + * @implements IDeployProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @instance + */ + DeployProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeployProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata instance + */ + DeployProcessorVersionMetadata.create = function create(properties) { + return new DeployProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @static + * @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 + */ + DeployProcessorVersionMetadata.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 DeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @static + * @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 + */ + 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.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.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.v1beta3.DeployProcessorVersionMetadata(); + 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 DeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.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.v1beta3.DeployProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata + */ + DeployProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata) + return object; + 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 DeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeployProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionMetadata.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.UndeployProcessorVersionRequest = (function() { + + /** + * Properties of an UndeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IUndeployProcessorVersionRequest + * @property {string|null} [name] UndeployProcessorVersionRequest name + */ + + /** + * Constructs a new UndeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an UndeployProcessorVersionRequest. + * @implements IUndeployProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.UndeployProcessorVersionRequest + * @instance + */ + UndeployProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new UndeployProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest instance + */ + UndeployProcessorVersionRequest.create = function create(properties) { + return new UndeployProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest + * @static + * @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 + */ + 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.v1beta3.UndeployProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest + * @static + * @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 + */ + 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.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.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.v1beta3.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.v1beta3.UndeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.v1beta3.UndeployProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest + */ + UndeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest) + return object; + 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 an UndeployProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.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.v1beta3.UndeployProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionRequest.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.UndeployProcessorVersionResponse = (function() { + + /** + * Properties of an UndeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IUndeployProcessorVersionResponse + */ + + /** + * Constructs a new UndeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an UndeployProcessorVersionResponse. + * @implements IUndeployProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.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.v1beta3.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse instance + */ + UndeployProcessorVersionResponse.create = function create(properties) { + return new UndeployProcessorVersionResponse(properties); + }; + + /** + * 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 + */ + 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.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 + */ + 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.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 + */ + UndeployProcessorVersionResponse.prototype.toJSON = function toJSON() { + 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; + })(); + + v1beta3.UndeployProcessorVersionMetadata = (function() { + + /** + * 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.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata instance + */ + UndeployProcessorVersionMetadata.create = function create(properties) { + return new UndeployProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @static + * @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 + */ + UndeployProcessorVersionMetadata.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 UndeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @static + * @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 + */ + 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.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.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.v1beta3.UndeployProcessorVersionMetadata(); + 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 an UndeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + 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.v1beta3.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.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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.priority === "number") { + message.priority = object.priority; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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; + }; + + /** + * 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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.occurrenceType === "number") { + message.occurrenceType = object.occurrenceType; + break; + } + break; + 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] === undefined ? message.occurrenceType : $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); + }; + + /** + * 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 + * @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); + }; + + /** + * 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; + })(); + + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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() { + + /** + * 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.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.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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.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; + })(); + + 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) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + 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] === 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")) + 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); + }; + + /** + * 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 + * @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 + * @property {google.api.LaunchStage|null} [launchStage] ProcessorType launchStage + */ + + /** + * 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; + + /** + * 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 + * @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); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.launchStage); + 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; + } + case 8: { + message.launchStage = reader.int32(); + 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"; + 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; + }; + + /** + * 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); + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + 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; + }; + + /** + * 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; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + } + 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; + if (message.launchStage != null && message.hasOwnProperty("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; + }; + + /** + * 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + return ProcessorType; + })(); + + 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 + * @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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; + + /** + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = null; + + /** + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === 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")) + 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]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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 + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + 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 + * @property {string|null} [edition] FileDescriptorProto edition + */ + + /** + * 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 = ""; + + /** + * FileDescriptorProto edition. + * @member {string} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = ""; + + /** + * 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); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); + 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; + } + case 13: { + message.edition = 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"; + if (message.edition != null && message.hasOwnProperty("edition")) + if (!$util.isString(message.edition)) + return "edition: 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); + if (object.edition != null) + message.edition = String(object.edition); + 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 = ""; + object.edition = ""; + } + 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; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = message.edition; + 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); + }; + + /** + * 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; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + 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) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === 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] === 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")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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 + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions phpGenericServices. + * @member {boolean} phpGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) + writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 42: { + message.phpGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (typeof message.phpGenericServices !== "boolean") + return "phpGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + 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] === 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")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + object.phpGenericServices = message.phpGenericServices; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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 + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + 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} [unverifiedLazy] FieldOptions unverifiedLazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.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(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { + writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.int32(message[".google.api.fieldBehavior"][i]); + writer.ldelim(); + } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 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()); + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.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"; + 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: + case 6: + case 7: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; + 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) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + 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.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + 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: + 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; + 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; + case "UNORDERED_LIST": + 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) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object.unverifiedLazy = 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] === 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")) + 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] === 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")) + object.unverifiedLazy = message.unverifiedLazy; + 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]] === 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); + 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); + }; + + /** + * 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 + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @property {google.longrunning.IOperationInfo|null} [".google.longrunning.operationInfo"] MethodOptions .google.longrunning.operationInfo + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.methodSignature"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions idempotencyLevel. + * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.idempotencyLevel = 0; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * MethodOptions .google.api.methodSignature. + * @member {Array.} .google.api.methodSignature + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + + /** + * MethodOptions .google.longrunning.operationInfo. + * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.longrunning.operationInfo"] = null; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) + $root.google.longrunning.OperationInfo.encode(message[".google.longrunning.operationInfo"], writer.uint32(/* id 1049, wireType 2 =*/8394).fork()).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + case 1049: { + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + switch (message.idempotencyLevel) { + default: + return "idempotencyLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { + if (!Array.isArray(message[".google.api.methodSignature"])) + return ".google.api.methodSignature: array expected"; + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + if (!$util.isString(message[".google.api.methodSignature"][i])) + return ".google.api.methodSignature: string[] expected"; + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) { + var error = $root.google.longrunning.OperationInfo.verify(message[".google.longrunning.operationInfo"]); + if (error) + return ".google.longrunning.operationInfo." + error; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; + 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] === 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) + 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); + }; + + /** + * 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 + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value + */ + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length >= 0) + 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); + }; + + /** + * 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() { + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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() { + + /** + * 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 + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic + */ + + /** + * 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; + + /** + * 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 + * @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); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); + 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; + } + case 5: { + message.semantic = 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"; + 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; + }; + + /** + * 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; + switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; + 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; + }; + + /** + * 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; + object.semantic = options.enums === String ? "NONE" : 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; + if (message.semantic != null && message.hasOwnProperty("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; + }; + + /** + * 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); + }; + + /** + * 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; + })(); + + 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); + }; + + /** + * 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; + })(); + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + 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); + }; + + /** + * 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; + })(); + + protobuf.DoubleValue = (function() { + + /** + * Properties of a DoubleValue. + * @memberof google.protobuf + * @interface IDoubleValue + * @property {number|null} [value] DoubleValue value + */ + + /** + * Constructs a new DoubleValue. + * @memberof google.protobuf + * @classdesc Represents a DoubleValue. + * @implements IDoubleValue + * @constructor + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + */ + function DoubleValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DoubleValue value. + * @member {number} value + * @memberof google.protobuf.DoubleValue + * @instance + */ + DoubleValue.prototype.value = 0; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @function create + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + * @returns {google.protobuf.DoubleValue} DoubleValue instance + */ + DoubleValue.create = function create(properties) { + return new DoubleValue(properties); + }; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); + return writer; + }; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoubleValue message. + * @function verify + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoubleValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DoubleValue} DoubleValue + */ + DoubleValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DoubleValue) + return object; + var message = new $root.google.protobuf.DoubleValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.DoubleValue} message DoubleValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoubleValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this DoubleValue to JSON. + * @function toJSON + * @memberof google.protobuf.DoubleValue + * @instance + * @returns {Object.} JSON object + */ + DoubleValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.FloatValue = (function() { + + /** + * Properties of a FloatValue. + * @memberof google.protobuf + * @interface IFloatValue + * @property {number|null} [value] FloatValue value + */ + + /** + * Constructs a new FloatValue. + * @memberof google.protobuf + * @classdesc Represents a FloatValue. + * @implements IFloatValue + * @constructor + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + */ + function FloatValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FloatValue value. + * @member {number} value + * @memberof google.protobuf.FloatValue + * @instance + */ + FloatValue.prototype.value = 0; + + /** + * Creates a new FloatValue instance using the specified properties. + * @function create + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @returns {google.protobuf.FloatValue} FloatValue instance + */ + FloatValue.create = function create(properties) { + return new FloatValue(properties); + }; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); + return writer; + }; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FloatValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FloatValue message. + * @function verify + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FloatValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FloatValue} FloatValue + */ + FloatValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FloatValue) + return object; + var message = new $root.google.protobuf.FloatValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.FloatValue} message FloatValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FloatValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this FloatValue to JSON. + * @function toJSON + * @memberof google.protobuf.FloatValue + * @instance + * @returns {Object.} JSON object + */ + FloatValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.Int64Value = (function() { + + /** + * Properties of an Int64Value. + * @memberof google.protobuf + * @interface IInt64Value + * @property {number|Long|null} [value] Int64Value value + */ + + /** + * Constructs a new Int64Value. + * @memberof google.protobuf + * @classdesc Represents an Int64Value. + * @implements IInt64Value + * @constructor + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + */ + function Int64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int64Value value. + * @member {number|Long} value + * @memberof google.protobuf.Int64Value + * @instance + */ + Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Int64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + * @returns {google.protobuf.Int64Value} Int64Value instance + */ + Int64Value.create = function create(properties) { + return new Int64Value(properties); + }; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + return writer; + }; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int64Value message. + * @function verify + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int64Value} Int64Value + */ + Int64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int64Value) + return object; + var message = new $root.google.protobuf.Int64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = false; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.Int64Value} message Int64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + return object; + }; + + /** + * Converts this Int64Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int64Value + * @instance + * @returns {Object.} JSON object + */ + Int64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.UInt64Value = (function() { + + /** + * Properties of a UInt64Value. + * @memberof google.protobuf + * @interface IUInt64Value + * @property {number|Long|null} [value] UInt64Value value + */ + + /** + * Constructs a new UInt64Value. + * @memberof google.protobuf + * @classdesc Represents a UInt64Value. + * @implements IUInt64Value + * @constructor + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + */ + function UInt64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt64Value value. + * @member {number|Long} value + * @memberof google.protobuf.UInt64Value + * @instance + */ + UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new UInt64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @returns {google.protobuf.UInt64Value} UInt64Value instance + */ + UInt64Value.create = function create(properties) { + return new UInt64Value(properties); + }; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); + return writer; + }; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.uint64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt64Value message. + * @function verify + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt64Value} UInt64Value + */ + UInt64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt64Value) + return object; + var message = new $root.google.protobuf.UInt64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = true; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.UInt64Value} message UInt64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; + return object; + }; + + /** + * Converts this UInt64Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt64Value + * @instance + * @returns {Object.} JSON object + */ + UInt64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.Int32Value = (function() { + + /** + * Properties of an Int32Value. + * @memberof google.protobuf + * @interface IInt32Value + * @property {number|null} [value] Int32Value value + */ + + /** + * Constructs a new Int32Value. + * @memberof google.protobuf + * @classdesc Represents an Int32Value. + * @implements IInt32Value + * @constructor + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + */ + function Int32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int32Value value. + * @member {number} value + * @memberof google.protobuf.Int32Value + * @instance + */ + Int32Value.prototype.value = 0; + + /** + * Creates a new Int32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + * @returns {google.protobuf.Int32Value} Int32Value instance + */ + Int32Value.create = function create(properties) { + return new Int32Value(properties); + }; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); + return writer; + }; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int32Value message. + * @function verify + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int32Value} Int32Value + */ + Int32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int32Value) + return object; + var message = new $root.google.protobuf.Int32Value(); + if (object.value != null) + message.value = object.value | 0; + return message; + }; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.Int32Value} message Int32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this Int32Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int32Value + * @instance + * @returns {Object.} JSON object + */ + Int32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.UInt32Value = (function() { + + /** + * Properties of a UInt32Value. + * @memberof google.protobuf + * @interface IUInt32Value + * @property {number|null} [value] UInt32Value value + */ + + /** + * Constructs a new UInt32Value. + * @memberof google.protobuf + * @classdesc Represents a UInt32Value. + * @implements IUInt32Value + * @constructor + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + */ + function UInt32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt32Value value. + * @member {number} value + * @memberof google.protobuf.UInt32Value + * @instance + */ + UInt32Value.prototype.value = 0; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @returns {google.protobuf.UInt32Value} UInt32Value instance + */ + UInt32Value.create = function create(properties) { + return new UInt32Value(properties); + }; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); + return writer; + }; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt32Value message. + * @function verify + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt32Value} UInt32Value + */ + UInt32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt32Value) + return object; + var message = new $root.google.protobuf.UInt32Value(); + if (object.value != null) + message.value = object.value >>> 0; + return message; + }; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.UInt32Value} message UInt32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this UInt32Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt32Value + * @instance + * @returns {Object.} JSON object + */ + UInt32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.BoolValue = (function() { + + /** + * Properties of a BoolValue. + * @memberof google.protobuf + * @interface IBoolValue + * @property {boolean|null} [value] BoolValue value + */ + + /** + * Constructs a new BoolValue. + * @memberof google.protobuf + * @classdesc Represents a BoolValue. + * @implements IBoolValue + * @constructor + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + */ + function BoolValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoolValue value. + * @member {boolean} value + * @memberof google.protobuf.BoolValue + * @instance + */ + BoolValue.prototype.value = false; + + /** + * Creates a new BoolValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @returns {google.protobuf.BoolValue} BoolValue instance + */ + BoolValue.create = function create(properties) { + return new BoolValue(properties); + }; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); + return writer; + }; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BoolValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoolValue message. + * @function verify + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoolValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "boolean") + return "value: boolean expected"; + return null; + }; + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BoolValue} BoolValue + */ + BoolValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BoolValue) + return object; + var message = new $root.google.protobuf.BoolValue(); + if (object.value != null) + message.value = Boolean(object.value); + return message; + }; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.BoolValue} message BoolValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoolValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = false; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this BoolValue to JSON. + * @function toJSON + * @memberof google.protobuf.BoolValue + * @instance + * @returns {Object.} JSON object + */ + BoolValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.StringValue = (function() { + + /** + * Properties of a StringValue. + * @memberof google.protobuf + * @interface IStringValue + * @property {string|null} [value] StringValue value + */ + + /** + * Constructs a new StringValue. + * @memberof google.protobuf + * @classdesc Represents a StringValue. + * @implements IStringValue + * @constructor + * @param {google.protobuf.IStringValue=} [properties] Properties to set + */ + function StringValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StringValue value. + * @member {string} value + * @memberof google.protobuf.StringValue + * @instance + */ + StringValue.prototype.value = ""; + + /** + * Creates a new StringValue instance using the specified properties. + * @function create + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @returns {google.protobuf.StringValue} StringValue instance + */ + StringValue.create = function create(properties) { + return new StringValue(properties); + }; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.StringValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StringValue message. + * @function verify + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StringValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.StringValue} StringValue + */ + StringValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.StringValue) + return object; + var message = new $root.google.protobuf.StringValue(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.StringValue} message StringValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StringValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this StringValue to JSON. + * @function toJSON + * @memberof google.protobuf.StringValue + * @instance + * @returns {Object.} JSON object + */ + StringValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.BytesValue = (function() { + + /** + * Properties of a BytesValue. + * @memberof google.protobuf + * @interface IBytesValue + * @property {Uint8Array|null} [value] BytesValue value + */ + + /** + * Constructs a new BytesValue. + * @memberof google.protobuf + * @classdesc Represents a BytesValue. + * @implements IBytesValue + * @constructor + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + */ + function BytesValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BytesValue value. + * @member {Uint8Array} value + * @memberof google.protobuf.BytesValue + * @instance + */ + BytesValue.prototype.value = $util.newBuffer([]); + + /** + * Creates a new BytesValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @returns {google.protobuf.BytesValue} BytesValue instance + */ + BytesValue.create = function create(properties) { + return new BytesValue(properties); + }; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BytesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BytesValue message. + * @function verify + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BytesValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BytesValue} BytesValue + */ + BytesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BytesValue) + return object; + var message = new $root.google.protobuf.BytesValue(); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + 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); + }; + + /** + * 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; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + return protobuf; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) + return object; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + return rpc; + })(); + + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + type.Color = (function() { + + /** + * 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 Color. + * @memberof google.type + * @classdesc Represents a Color. + * @implements IColor + * @constructor + * @param {google.type.IColor=} [properties] Properties to set + */ + function Color(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Color red. + * @member {number} red + * @memberof google.type.Color + * @instance + */ + Color.prototype.red = 0; + + /** + * 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.type.Color + * @static + * @param {google.type.IColor=} [properties] Properties to set + * @returns {google.type.Color} Color instance + */ + Color.create = function create(properties) { + return new Color(properties); + }; + + /** + * Encodes the specified Color message. Does not implicitly {@link google.type.Color.verify|verify} messages. + * @function encode + * @memberof google.type.Color + * @static + * @param {google.type.IColor} message Color message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Color.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(); + return writer; + }; + + /** + * Encodes the specified Color message, length delimited. Does not implicitly {@link google.type.Color.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Color + * @static + * @param {google.type.IColor} message Color message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Color.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Color message from the specified reader or buffer. + * @function decode + * @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.type.Color} Color + * @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) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + 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.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; + } + } + return message; + }; + + /** + * Decodes a Color message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Color + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + Color.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Color message. + * @function verify + * @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 + */ + Color.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; + } + return null; + }; + + /** + * Creates a Color message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Color + * @static + * @param {Object.} object Plain object + * @returns {google.type.Color} Color + */ + Color.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Color) + 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); + } + return message; + }; + + /** + * Creates a plain object from a Color message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Color + * @static + * @param {google.type.Color} message Color + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Color.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + 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 Color to JSON. + * @function toJSON + * @memberof google.type.Color + * @instance + * @returns {Object.} JSON object + */ + Color.prototype.toJSON = function toJSON() { + 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; + })(); + + type.Date = (function() { + + /** + * 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 Date. + * @memberof google.type + * @classdesc Represents a Date. + * @implements IDate + * @constructor + * @param {google.type.IDate=} [properties] Properties to set + */ + function Date(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Date year. + * @member {number} year + * @memberof google.type.Date + * @instance + */ + Date.prototype.year = 0; + + /** + * Date month. + * @member {number} month + * @memberof google.type.Date + * @instance + */ + Date.prototype.month = 0; + + /** + * 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.type.Date + * @static + * @param {google.type.IDate=} [properties] Properties to set + * @returns {google.type.Date} Date instance + */ + Date.create = function create(properties) { + return new Date(properties); + }; + + /** + * Encodes the specified Date message. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @function encode + * @memberof google.type.Date + * @static + * @param {google.type.IDate} message Date message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Date.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); + return writer; + }; + + /** + * Encodes the specified Date message, length delimited. Does not implicitly {@link google.type.Date.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Date + * @static + * @param {google.type.IDate} message Date message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Date.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Date message from the specified reader or buffer. + * @function decode + * @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.type.Date} Date + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.type.Date(); + 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; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Date message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Date + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + Date.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Date message. + * @function verify + * @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 + */ + Date.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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 Date message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Date + * @static + * @param {Object.} object Plain object + * @returns {google.type.Date} Date + */ + Date.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Date) + return object; + 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 Date message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Date + * @static + * @param {google.type.Date} message Date + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Date.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.year = 0; + object.month = 0; + object.day = 0; + } + if (message.year != null && message.hasOwnProperty("year")) + object.year = message.year; + if (message.month != null && message.hasOwnProperty("month")) + object.month = message.month; + if (message.day != null && message.hasOwnProperty("day")) + object.day = message.day; + return object; + }; + + /** + * Converts this Date to JSON. + * @function toJSON + * @memberof google.type.Date + * @instance + * @returns {Object.} JSON object + */ + Date.prototype.toJSON = function toJSON() { + 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; + })(); + + type.DateTime = (function() { + + /** + * 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 DateTime. + * @memberof google.type + * @classdesc Represents a DateTime. + * @implements IDateTime + * @constructor + * @param {google.type.IDateTime=} [properties] Properties to set + */ + function DateTime(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * 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.type.DateTime + * @static + * @param {google.type.IDateTime=} [properties] Properties to set + * @returns {google.type.DateTime} DateTime instance + */ + DateTime.create = function create(properties) { + return new DateTime(properties); + }; + + /** + * Encodes the specified DateTime message. Does not implicitly {@link google.type.DateTime.verify|verify} messages. + * @function encode + * @memberof google.type.DateTime + * @static + * @param {google.type.IDateTime} message DateTime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} 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 DateTime message, length delimited. Does not implicitly {@link google.type.DateTime.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.DateTime + * @static + * @param {google.type.IDateTime} message DateTime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DateTime.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DateTime message from the specified reader or buffer. + * @function decode + * @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.type.DateTime} DateTime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.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; + } + } + return message; + }; + + /** + * Decodes a DateTime message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.DateTime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + DateTime.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DateTime message. + * @function verify + * @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 + */ + 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 a DateTime message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.DateTime + * @static + * @param {Object.} object Plain object + * @returns {google.type.DateTime} DateTime + */ + DateTime.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.DateTime) + return object; + 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 a DateTime message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.DateTime + * @static + * @param {google.type.DateTime} message DateTime + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + 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 DateTime to JSON. + * @function toJSON + * @memberof google.type.DateTime + * @instance + * @returns {Object.} JSON object + */ + DateTime.prototype.toJSON = function toJSON() { + 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; + })(); + + type.TimeZone = (function() { + + /** + * Properties of a TimeZone. + * @memberof google.type + * @interface ITimeZone + * @property {string|null} [id] TimeZone id + * @property {string|null} [version] TimeZone version + */ + + /** + * Constructs a new TimeZone. + * @memberof google.type + * @classdesc Represents a TimeZone. + * @implements ITimeZone + * @constructor + * @param {google.type.ITimeZone=} [properties] Properties to set + */ + function TimeZone(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeZone id. + * @member {string} id + * @memberof google.type.TimeZone + * @instance + */ + TimeZone.prototype.id = ""; + + /** + * TimeZone version. + * @member {string} version + * @memberof google.type.TimeZone + * @instance + */ + TimeZone.prototype.version = ""; + + /** + * Creates a new TimeZone instance using the specified properties. + * @function create + * @memberof google.type.TimeZone + * @static + * @param {google.type.ITimeZone=} [properties] Properties to set + * @returns {google.type.TimeZone} TimeZone instance + */ + TimeZone.create = function create(properties) { + return new TimeZone(properties); + }; + + /** + * Encodes the specified TimeZone message. Does not implicitly {@link google.type.TimeZone.verify|verify} messages. + * @function encode + * @memberof google.type.TimeZone + * @static + * @param {google.type.ITimeZone} message TimeZone message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeZone.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.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + return writer; + }; + + /** + * Encodes the specified TimeZone message, length delimited. Does not implicitly {@link google.type.TimeZone.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.TimeZone + * @static + * @param {google.type.ITimeZone} message TimeZone message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeZone.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeZone message from the specified reader or buffer. + * @function decode + * @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.type.TimeZone} TimeZone + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.type.TimeZone(); + 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; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeZone message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.TimeZone + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + TimeZone.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeZone message. + * @function verify + * @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 + */ + TimeZone.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a TimeZone message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.TimeZone + * @static + * @param {Object.} object Plain object + * @returns {google.type.TimeZone} TimeZone + */ + TimeZone.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.TimeZone) + return object; + 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 TimeZone message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.TimeZone + * @static + * @param {google.type.TimeZone} message TimeZone + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeZone.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.version = ""; + } + 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 TimeZone to JSON. + * @function toJSON + * @memberof google.type.TimeZone + * @instance + * @returns {Object.} JSON object + */ + TimeZone.prototype.toJSON = function toJSON() { + 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; + })(); + + type.Money = (function() { + + /** + * 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 Money. + * @memberof google.type + * @classdesc Represents a Money. + * @implements IMoney + * @constructor + * @param {google.type.IMoney=} [properties] Properties to set + */ + function Money(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Money currencyCode. + * @member {string} currencyCode + * @memberof google.type.Money + * @instance + */ + Money.prototype.currencyCode = ""; + + /** + * Money units. + * @member {number|Long} units + * @memberof google.type.Money + * @instance + */ + Money.prototype.units = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Money nanos. + * @member {number} nanos + * @memberof google.type.Money + * @instance + */ + Money.prototype.nanos = 0; + + /** + * Creates a new Money instance using the specified properties. + * @function create + * @memberof google.type.Money + * @static + * @param {google.type.IMoney=} [properties] Properties to set + * @returns {google.type.Money} Money instance + */ + Money.create = function create(properties) { + return new Money(properties); + }; + + /** + * Encodes the specified Money message. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @function encode + * @memberof google.type.Money + * @static + * @param {google.type.IMoney} message Money message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Money.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.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 Money message, length delimited. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Money + * @static + * @param {google.type.IMoney} message Money message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Money.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Money message from the specified reader or buffer. + * @function decode + * @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.type.Money} Money + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.type.Money(); + 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; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Money message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Money + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + Money.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Money message. + * @function verify + * @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 + */ + Money.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.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 Money message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Money + * @static + * @param {Object.} object Plain object + * @returns {google.type.Money} Money + */ + Money.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Money) + return object; + 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 Money message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Money + * @static + * @param {google.type.Money} message Money + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Money.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + 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 Money to JSON. + * @function toJSON + * @memberof google.type.Money + * @instance + * @returns {Object.} JSON object + */ + Money.prototype.toJSON = function toJSON() { + 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; + })(); + + type.PostalAddress = (function() { + + /** + * Properties of a PostalAddress. + * @memberof google.type + * @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 PostalAddress. + * @implements IPostalAddress + * @constructor + * @param {google.type.IPostalAddress=} [properties] Properties to set + */ + 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) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PostalAddress revision. + * @member {number} revision + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.revision = 0; + + /** + * PostalAddress regionCode. + * @member {string} regionCode + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.regionCode = ""; + + /** + * PostalAddress languageCode. + * @member {string} languageCode + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.languageCode = ""; + + /** + * PostalAddress postalCode. + * @member {string} postalCode + * @memberof google.type.PostalAddress + * @instance + */ + PostalAddress.prototype.postalCode = ""; + + /** + * 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.PostalAddress + * @static + * @param {google.type.IPostalAddress=} [properties] Properties to set + * @returns {google.type.PostalAddress} PostalAddress instance + */ + PostalAddress.create = function create(properties) { + return new PostalAddress(properties); + }; + + /** + * Encodes the specified PostalAddress message. Does not implicitly {@link google.type.PostalAddress.verify|verify} messages. + * @function encode + * @memberof google.type.PostalAddress + * @static + * @param {google.type.IPostalAddress} message PostalAddress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostalAddress.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.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 PostalAddress message, length delimited. Does not implicitly {@link google.type.PostalAddress.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.PostalAddress + * @static + * @param {google.type.IPostalAddress} message PostalAddress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostalAddress.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PostalAddress message from the specified reader or buffer. + * @function decode + * @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.PostalAddress} PostalAddress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + 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.PostalAddress(); + 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; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PostalAddress message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.PostalAddress + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @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 + */ + PostalAddress.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PostalAddress message. + * @function verify + * @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 + */ + PostalAddress.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.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 PostalAddress message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.PostalAddress + * @static + * @param {Object.} object Plain object + * @returns {google.type.PostalAddress} PostalAddress + */ + PostalAddress.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.PostalAddress) + return object; + 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 PostalAddress message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.PostalAddress + * @static + * @param {google.type.PostalAddress} message PostalAddress + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PostalAddress.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.addressLines = []; + object.recipients = []; + } + if (options.defaults) { + object.revision = 0; + object.regionCode = ""; + object.languageCode = ""; + object.postalCode = ""; + object.sortingCode = ""; + object.administrativeArea = ""; + object.locality = ""; + object.sublocality = ""; + object.organization = ""; + } + 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 PostalAddress to JSON. + * @function toJSON + * @memberof google.type.PostalAddress + * @instance + * @returns {Object.} JSON object + */ + PostalAddress.prototype.toJSON = function toJSON() { + 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; + })(); + + return type; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + + /** + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; + + /** + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Operations} RPC service. Useful where requests and/or responses are streamed. + */ + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse + */ + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Operations; + })(); + + longrunning.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response + */ + + /** + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.longrunning.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.metadata = null; + + /** + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.done = false; + + /** + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encode + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.response != null && Object.hasOwnProperty.call(message, "response")) + $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 3: { + message.done = reader.bool(); + break; + } + case 4: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 5: { + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.longrunning.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Any.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.done != null && message.hasOwnProperty("done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.response != null && message.hasOwnProperty("response")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.protobuf.Any.verify(message.response); + if (error) + return "response." + error; + } + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.Operation) + return object; + var message = new $root.google.longrunning.Operation(); + if (object.name != null) + message.name = String(object.name); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.longrunning.Operation.metadata: object expected"); + message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); + } + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.longrunning.Operation.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.response != null) { + if (typeof object.response !== "object") + throw TypeError(".google.longrunning.Operation.response: object expected"); + message.response = $root.google.protobuf.Any.fromObject(object.response); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.metadata = null; + object.done = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); + if (message.done != null && message.hasOwnProperty("done")) + object.done = message.done; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; + } + if (message.response != null && message.hasOwnProperty("response")) { + object.response = $root.google.protobuf.Any.toObject(message.response, options); + if (options.oneofs) + object.result = "response"; + } + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.longrunning.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + longrunning.GetOperationRequest = (function() { + + /** + * Properties of a GetOperationRequest. + * @memberof google.longrunning + * @interface IGetOperationRequest + * @property {string|null} [name] GetOperationRequest name + */ + + /** + * Constructs a new GetOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a GetOperationRequest. + * @implements IGetOperationRequest + * @constructor + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + */ + function GetOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetOperationRequest name. + * @member {string} name + * @memberof google.longrunning.GetOperationRequest + * @instance + */ + GetOperationRequest.prototype.name = ""; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + */ + GetOperationRequest.create = function create(properties) { + return new GetOperationRequest(properties); + }; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.GetOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetOperationRequest message. + * @function verify + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + */ + GetOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.GetOperationRequest) + return object; + var message = new $root.google.longrunning.GetOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.GetOperationRequest} message GetOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.GetOperationRequest + * @instance + * @returns {Object.} JSON object + */ + GetOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + longrunning.ListOperationsRequest = (function() { + + /** + * Properties of a ListOperationsRequest. + * @memberof google.longrunning + * @interface IListOperationsRequest + * @property {string|null} [name] ListOperationsRequest name + * @property {string|null} [filter] ListOperationsRequest filter + * @property {number|null} [pageSize] ListOperationsRequest pageSize + * @property {string|null} [pageToken] ListOperationsRequest pageToken + */ + + /** + * Constructs a new ListOperationsRequest. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsRequest. + * @implements IListOperationsRequest + * @constructor + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + */ + function ListOperationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsRequest name. + * @member {string} name + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.name = ""; + + /** + * ListOperationsRequest filter. + * @member {string} filter + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.filter = ""; + + /** + * ListOperationsRequest pageSize. + * @member {number} pageSize + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageSize = 0; + + /** + * ListOperationsRequest pageToken. + * @member {string} pageToken + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest instance + */ + ListOperationsRequest.create = function create(properties) { + return new ListOperationsRequest(properties); + }; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.name = reader.string(); + break; + } + case 1: { + message.filter = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsRequest message. + * @function verify + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + */ + ListOperationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsRequest) + return object; + var message = new $root.google.longrunning.ListOperationsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.ListOperationsRequest} message ListOperationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListOperationsRequest to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListOperationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + longrunning.ListOperationsResponse = (function() { + + /** + * Properties of a ListOperationsResponse. + * @memberof google.longrunning + * @interface IListOperationsResponse + * @property {Array.|null} [operations] ListOperationsResponse operations + * @property {string|null} [nextPageToken] ListOperationsResponse nextPageToken + */ + + /** + * Constructs a new ListOperationsResponse. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsResponse. + * @implements IListOperationsResponse + * @constructor + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + */ + function ListOperationsResponse(properties) { + this.operations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsResponse operations. + * @member {Array.} operations + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.operations = $util.emptyArray; + + /** + * ListOperationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse instance + */ + ListOperationsResponse.create = function create(properties) { + return new ListOperationsResponse(properties); + }; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operations != null && message.operations.length) + for (var i = 0; i < message.operations.length; ++i) + $root.google.longrunning.Operation.encode(message.operations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsResponse message. + * @function verify + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operations != null && message.hasOwnProperty("operations")) { + if (!Array.isArray(message.operations)) + return "operations: array expected"; + for (var i = 0; i < message.operations.length; ++i) { + var error = $root.google.longrunning.Operation.verify(message.operations[i]); + if (error) + return "operations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + */ + ListOperationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsResponse) + return object; + var message = new $root.google.longrunning.ListOperationsResponse(); + if (object.operations) { + if (!Array.isArray(object.operations)) + throw TypeError(".google.longrunning.ListOperationsResponse.operations: array expected"); + message.operations = []; + for (var i = 0; i < object.operations.length; ++i) { + if (typeof object.operations[i] !== "object") + throw TypeError(".google.longrunning.ListOperationsResponse.operations: object expected"); + message.operations[i] = $root.google.longrunning.Operation.fromObject(object.operations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.ListOperationsResponse} message ListOperationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.operations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.operations && message.operations.length) { + object.operations = []; + for (var j = 0; j < message.operations.length; ++j) + object.operations[j] = $root.google.longrunning.Operation.toObject(message.operations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListOperationsResponse to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListOperationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + longrunning.CancelOperationRequest = (function() { + + /** + * Properties of a CancelOperationRequest. + * @memberof google.longrunning + * @interface ICancelOperationRequest + * @property {string|null} [name] CancelOperationRequest name + */ + + /** + * Constructs a new CancelOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a CancelOperationRequest. + * @implements ICancelOperationRequest + * @constructor + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + */ + function CancelOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CancelOperationRequest name. + * @member {string} name + * @memberof google.longrunning.CancelOperationRequest + * @instance + */ + CancelOperationRequest.prototype.name = ""; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest instance + */ + CancelOperationRequest.create = function create(properties) { + return new CancelOperationRequest(properties); + }; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.CancelOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelOperationRequest message. + * @function verify + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + */ + CancelOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.CancelOperationRequest) + return object; + var message = new $root.google.longrunning.CancelOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.CancelOperationRequest} message CancelOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CancelOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.CancelOperationRequest + * @instance + * @returns {Object.} JSON object + */ + CancelOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + longrunning.DeleteOperationRequest = (function() { + + /** + * Properties of a DeleteOperationRequest. + * @memberof google.longrunning + * @interface IDeleteOperationRequest + * @property {string|null} [name] DeleteOperationRequest name + */ + + /** + * Constructs a new DeleteOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a DeleteOperationRequest. + * @implements IDeleteOperationRequest + * @constructor + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + */ + function DeleteOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteOperationRequest name. + * @member {string} name + * @memberof google.longrunning.DeleteOperationRequest + * @instance + */ + DeleteOperationRequest.prototype.name = ""; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest instance + */ + DeleteOperationRequest.create = function create(properties) { + return new DeleteOperationRequest(properties); + }; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.DeleteOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteOperationRequest message. + * @function verify + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + */ + DeleteOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.DeleteOperationRequest) + return object; + var message = new $root.google.longrunning.DeleteOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.DeleteOperationRequest} message DeleteOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.DeleteOperationRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + longrunning.WaitOperationRequest = (function() { + + /** + * Properties of a WaitOperationRequest. + * @memberof google.longrunning + * @interface IWaitOperationRequest + * @property {string|null} [name] WaitOperationRequest name + * @property {google.protobuf.IDuration|null} [timeout] WaitOperationRequest timeout + */ + + /** + * Constructs a new WaitOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a WaitOperationRequest. + * @implements IWaitOperationRequest + * @constructor + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + */ + function WaitOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitOperationRequest name. + * @member {string} name + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.name = ""; + + /** + * WaitOperationRequest timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.timeout = null; + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest instance + */ + WaitOperationRequest.create = function create(properties) { + return new WaitOperationRequest(properties); + }; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.WaitOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitOperationRequest message. + * @function verify + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + return null; + }; + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + */ + WaitOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.WaitOperationRequest) + return object; + var message = new $root.google.longrunning.WaitOperationRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + return message; + }; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.timeout = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + return object; + }; + + /** + * Converts this WaitOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.WaitOperationRequest + * @instance + * @returns {Object.} JSON object + */ + WaitOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + longrunning.OperationInfo = (function() { + + /** + * Properties of an OperationInfo. + * @memberof google.longrunning + * @interface IOperationInfo + * @property {string|null} [responseType] OperationInfo responseType + * @property {string|null} [metadataType] OperationInfo metadataType + */ + + /** + * Constructs a new OperationInfo. + * @memberof google.longrunning + * @classdesc Represents an OperationInfo. + * @implements IOperationInfo + * @constructor + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + */ + function OperationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationInfo responseType. + * @member {string} responseType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.responseType = ""; + + /** + * OperationInfo metadataType. + * @member {string} metadataType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.metadataType = ""; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @function create + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + * @returns {google.longrunning.OperationInfo} OperationInfo instance + */ + OperationInfo.create = function create(properties) { + return new OperationInfo(properties); + }; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encode + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); + return writer; + }; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.OperationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.responseType = reader.string(); + break; + } + case 2: { + message.metadataType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationInfo message. + * @function verify + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseType != null && message.hasOwnProperty("responseType")) + if (!$util.isString(message.responseType)) + return "responseType: string expected"; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + if (!$util.isString(message.metadataType)) + return "metadataType: string expected"; + return null; + }; + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.OperationInfo} OperationInfo + */ + OperationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.OperationInfo) + return object; + var message = new $root.google.longrunning.OperationInfo(); + if (object.responseType != null) + message.responseType = String(object.responseType); + if (object.metadataType != null) + message.metadataType = String(object.metadataType); + return message; + }; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.OperationInfo} message OperationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseType = ""; + object.metadataType = ""; + } + if (message.responseType != null && message.hasOwnProperty("responseType")) + object.responseType = message.responseType; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + object.metadataType = message.metadataType; + return object; + }; + + /** + * Converts this OperationInfo to JSON. + * @function toJSON + * @memberof google.longrunning.OperationInfo + * @instance + * @returns {Object.} JSON object + */ + OperationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + return longrunning; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json new file mode 100644 index 00000000000..f8ada9d376b --- /dev/null +++ b/packages/google-cloud-documentai/protos/protos.json @@ -0,0 +1,8443 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "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": "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/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": { + "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 + }, + "fontFamily": { + "type": "string", + "id": 8 + } + }, + "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 + }, + "symbols": { + "rule": "repeated", + "type": "Symbol", + "id": 12 + }, + "detectedBarcodes": { + "rule": "repeated", + "type": "DetectedBarcode", + "id": 15 + }, + "imageQualityScores": { + "type": "ImageQualityScores", + "id": 17 + }, + "provenance": { + "type": "Provenance", + "id": 16, + "options": { + "deprecated": true + } + } + }, + "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, + "options": { + "deprecated": true + } + } + } + }, + "Paragraph": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3, + "options": { + "deprecated": true + } + } + } + }, + "Line": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + }, + "provenance": { + "type": "Provenance", + "id": 3, + "options": { + "deprecated": true + } + } + } + }, + "Token": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedBreak": { + "type": "DetectedBreak", + "id": 2 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 3 + }, + "provenance": { + "type": "Provenance", + "id": 4, + "options": { + "deprecated": true + } + } + }, + "nested": { + "DetectedBreak": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "SPACE": 1, + "WIDE_SPACE": 2, + "HYPHEN": 3 + } + } + } + } + } + }, + "Symbol": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "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 + }, + "provenance": { + "type": "Provenance", + "id": 5 + } + }, + "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 + }, + "provenance": { + "type": "Provenance", + "id": 8 + } + } + }, + "DetectedBarcode": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "barcode": { + "type": "Barcode", + "id": 2 + } + } + }, + "DetectedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "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 + } + } + } + } + } + } + }, + "Entity": { + "fields": { + "textAnchor": { + "type": "TextAnchor", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "type": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "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", + "integerValue", + "floatValue" + ] + } + }, + "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 + }, + "integerValue": { + "type": "int32", + "id": 7 + }, + "floatValue": { + "type": "float", + "id": 8 + }, + "text": { + "type": "string", + "id": 1, + "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 + }, + "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" + } + }, + "confidence": { + "type": "float", + "id": 5, + "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, + "options": { + "deprecated": true + } + }, + "parents": { + "rule": "repeated", + "type": "Parent", + "id": 3 + }, + "type": { + "type": "OperationType", + "id": 4 + } + }, + "nested": { + "Parent": { + "fields": { + "revision": { + "type": "int32", + "id": 1 + }, + "index": { + "type": "int32", + "id": 3 + }, + "id": { + "type": "int32", + "id": 2, + "options": { + "deprecated": true + } + } + } + }, + "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, + "options": { + "deprecated": true + } + }, + "parentIds": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "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, + "options": { + "deprecated": true + } + } + } + } + } + }, + "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 + }, + "fieldMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + } + } + }, + "DocumentProcessorService": { + "options": { + "(google.api.default_host)": "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.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": "*", + "additional_bindings": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}: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.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" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*}:batchProcess", + "body": "*", + "additional_bindings": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchProcessResponse", + "metadata_type": "BatchProcessMetadata" + } + } + ] + }, + "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).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)": "name", + "(google.longrunning.operation_info).response_type": "DeployProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "DeployProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{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": "/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" + } + } + ] + }, + "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" + } + ] + }, + "DeleteProcessor": { + "requestType": "DeleteProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(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 + } + } + } + } + }, + "CommonOperationMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "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, + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 + } + } + } + }, + "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 + }, + "documentSchema": { + "type": "DocumentSchema", + "id": 12 + }, + "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", + "(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, + "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 + } + }, + "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 + }, + "launchStage": { + "type": "google.api.LaunchStage", + "id": 8 + } + }, + "nested": { + "LocationInfo": { + "fields": { + "locationId": { + "type": "string", + "id": 1 + } + } + } + } + } + } + }, + "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, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "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", + "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", + "php_namespace": "Google\\Cloud\\DocumentAI\\V1beta2", + "ruby_package": "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, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "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" + } + } + } + }, + "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": { + "(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.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "BatchProcessDocuments": { + "requestType": "BatchProcessDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta2/{parent=projects/*/locations/*}/documents:batchProcess", + "(google.api.http).body": "*", + "(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" + }, + "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", + "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": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta2/{parent=projects/*/locations/*}/documents:process", + "body": "*", + "additional_bindings": { + "post": "/v1beta2/{parent=projects/*}/documents:process", + "body": "*" + } + } + } + ] + } + } + }, + "BatchProcessDocumentsRequest": { + "fields": { + "requests": { + "rule": "repeated", + "type": "ProcessDocumentRequest", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parent": { + "type": "string", + "id": 2 + } + } + }, + "ProcessDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 9 + }, + "inputConfig": { + "type": "InputConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "OutputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "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 + }, + "automlParams": { + "type": "AutoMlParams", + "id": 8 + } + } + }, + "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 + } + } + }, + "AutoMlParams": { + "fields": { + "model": { + "type": "string", + "id": 1 + } + } + }, + "InputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource", + "contents" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + }, + "contents": { + "type": "bytes", + "id": 3 + }, + "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 + } + } + } + } + } + }, + "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": "DocumentAiProcessorType", + "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/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": { + "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 + }, + "symbols": { + "rule": "repeated", + "type": "Symbol", + "id": 12 + }, + "detectedBarcodes": { + "rule": "repeated", + "type": "DetectedBarcode", + "id": 15 + }, + "provenance": { + "type": "Provenance", + "id": 16 + } + }, + "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 + } + } + } + } + } + }, + "Symbol": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, + "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 + }, + "provenance": { + "type": "Provenance", + "id": 8 + } + } + }, + "DetectedBarcode": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "barcode": { + "type": "Barcode", + "id": 2 + } + } + }, + "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, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "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", + "integerValue", + "floatValue" + ] + } + }, + "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 + }, + "integerValue": { + "type": "int32", + "id": 7 + }, + "floatValue": { + "type": "float", + "id": 8 + }, + "text": { + "type": "string", + "id": 1, + "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 + }, + "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" + } + }, + "confidence": { + "type": "float", + "id": 5, + "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, + "options": { + "deprecated": true + } + }, + "parents": { + "rule": "repeated", + "type": "Parent", + "id": 3 + }, + "type": { + "type": "OperationType", + "id": 4 + } + }, + "nested": { + "Parent": { + "fields": { + "revision": { + "type": "int32", + "id": 1 + }, + "index": { + "type": "int32", + "id": 3 + }, + "id": { + "type": "int32", + "id": 2, + "options": { + "deprecated": true + } + } + } + }, + "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, + "options": { + "deprecated": true + } + }, + "parentIds": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "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)": "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.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": "*", + "additional_bindings": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:process", + "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.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" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*}:batchProcess", + "body": "*", + "additional_bindings": { + "post": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchProcessResponse", + "metadata_type": "BatchProcessMetadata" + } + } + ] + }, + "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" + } + ] + }, + "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", + "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" + } + ] + }, + "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", + "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" + } + } + ] + }, + "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", + "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" + }, + "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" + } + } + ] + } + } + }, + "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": "*" + } + }, + "document": { + "type": "Document", + "id": 2, + "options": { + "deprecated": true + } + }, + "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 + }, + "humanReviewOperation": { + "type": "string", + "id": 2, + "options": { + "deprecated": true + } + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 3 + } + } + }, + "BatchProcessRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "inputConfigs": { + "rule": "repeated", + "type": "BatchInputConfig", + "id": 2, + "options": { + "deprecated": true + } + }, + "outputConfig": { + "type": "BatchOutputConfig", + "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", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "BatchOutputConfig": { + "options": { + "deprecated": true + }, + "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, + "options": { + "deprecated": true + } + }, + "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" + } + }, + "document": { + "type": "Document", + "id": 2, + "options": { + "deprecated": true + } + }, + "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": { + "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 + }, + "questionId": { + "type": "string", + "id": 6 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 + } + } + } + }, + "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": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "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, + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 + } + } + } + }, + "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", + "(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, + "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 + } + }, + "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 + }, + "launchStage": { + "type": "google.api.LaunchStage", + "id": 8 + } + }, + "nested": { + "LocationInfo": { + "fields": { + "locationId": { + "type": "string", + "id": 1 + } + } + } + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api;api", + "java_multiple_files": true, + "java_outer_classname": "LaunchStageProto", + "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, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 + } + }, + "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" + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + }, + "LaunchStage": { + "values": { + "LAUNCH_STAGE_UNSPECIFIED": 0, + "UNIMPLEMENTED": 6, + "PRELAUNCH": 7, + "EARLY_ACCESS": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5 + } + } + } + }, + "protobuf": { + "options": { + "go_package": "google.golang.org/protobuf/types/descriptorpb", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + } + }, + "FileDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10, + "options": { + "packed": false + } + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11, + "options": { + "packed": false + } + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + }, + "edition": { + "type": "string", + "id": 13 + } + } + }, + "DescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "FieldDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18 + } + }, + "Label": { + "values": { + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3 + } + } + } + }, + "OneofDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "options": { + "type": "OneofOptions", + "id": 2 + } + } + }, + "EnumDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "id": 2 + }, + "options": { + "type": "EnumOptions", + "id": 3 + }, + "reservedRange": { + "rule": "repeated", + "type": "EnumReservedRange", + "id": 4 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 5 + } + }, + "nested": { + "EnumReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "EnumValueDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "EnumValueOptions", + "id": 3 + } + } + }, + "ServiceDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "method": { + "rule": "repeated", + "type": "MethodDescriptorProto", + "id": 2 + }, + "options": { + "type": "ServiceOptions", + "id": 3 + } + } + }, + "MethodDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "inputType": { + "type": "string", + "id": 2 + }, + "outputType": { + "type": "string", + "id": 3 + }, + "options": { + "type": "MethodOptions", + "id": 4 + }, + "clientStreaming": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "serverStreaming": { + "type": "bool", + "id": 6, + "options": { + "default": false + } + } + } + }, + "FileOptions": { + "fields": { + "javaPackage": { + "type": "string", + "id": 1 + }, + "javaOuterClassname": { + "type": "string", + "id": 8 + }, + "javaMultipleFiles": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "javaGenerateEqualsAndHash": { + "type": "bool", + "id": 20, + "options": { + "deprecated": true + } + }, + "javaStringCheckUtf8": { + "type": "bool", + "id": 27, + "options": { + "default": false + } + }, + "optimizeFor": { + "type": "OptimizeMode", + "id": 9, + "options": { + "default": "SPEED" + } + }, + "goPackage": { + "type": "string", + "id": 11 + }, + "ccGenericServices": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "javaGenericServices": { + "type": "bool", + "id": 17, + "options": { + "default": false + } + }, + "pyGenericServices": { + "type": "bool", + "id": 18, + "options": { + "default": false + } + }, + "phpGenericServices": { + "type": "bool", + "id": 42, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 23, + "options": { + "default": false + } + }, + "ccEnableArenas": { + "type": "bool", + "id": 31, + "options": { + "default": true + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], + [ + 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 + } + }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "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 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } + } + } + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "DoubleValue": { + "fields": { + "value": { + "type": "double", + "id": 1 + } + } + }, + "FloatValue": { + "fields": { + "value": { + "type": "float", + "id": 1 + } + } + }, + "Int64Value": { + "fields": { + "value": { + "type": "int64", + "id": 1 + } + } + }, + "UInt64Value": { + "fields": { + "value": { + "type": "uint64", + "id": 1 + } + } + }, + "Int32Value": { + "fields": { + "value": { + "type": "int32", + "id": 1 + } + } + }, + "UInt32Value": { + "fields": { + "value": { + "type": "uint32", + "id": 1 + } + } + }, + "BoolValue": { + "fields": { + "value": { + "type": "bool", + "id": 1 + } + } + }, + "StringValue": { + "fields": { + "value": { + "type": "string", + "id": 1 + } + } + }, + "BytesValue": { + "fields": { + "value": { + "type": "bytes", + "id": 1 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Empty": { + "fields": {} + } + } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + }, + "type": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/type/postaladdress;postaladdress", + "java_multiple_files": true, + "java_outer_classname": "PostalAddressProto", + "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 + } + } + }, + "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 + } + } + } + } + }, + "longrunning": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.LongRunning", + "go_package": "google.golang.org/genproto/googleapis/longrunning;longrunning", + "java_multiple_files": true, + "java_outer_classname": "OperationsProto", + "java_package": "com.google.longrunning", + "php_namespace": "Google\\LongRunning" + }, + "nested": { + "operationInfo": { + "type": "google.longrunning.OperationInfo", + "id": 1049, + "extend": "google.protobuf.MethodOptions" + }, + "Operations": { + "options": { + "(google.api.default_host)": "longrunning.googleapis.com" + }, + "methods": { + "ListOperations": { + "requestType": "ListOperationsRequest", + "responseType": "ListOperationsResponse", + "options": { + "(google.api.http).get": "/v1/{name=operations}", + "(google.api.method_signature)": "name,filter" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations}" + } + }, + { + "(google.api.method_signature)": "name,filter" + } + ] + }, + "GetOperation": { + "requestType": "GetOperationRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteOperation": { + "requestType": "DeleteOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CancelOperation": { + "requestType": "CancelOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/{name=operations/**}:cancel", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=operations/**}:cancel", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "WaitOperation": { + "requestType": "WaitOperationRequest", + "responseType": "Operation" + } + } + }, + "Operation": { + "oneofs": { + "result": { + "oneof": [ + "error", + "response" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "metadata": { + "type": "google.protobuf.Any", + "id": 2 + }, + "done": { + "type": "bool", + "id": 3 + }, + "error": { + "type": "google.rpc.Status", + "id": 4 + }, + "response": { + "type": "google.protobuf.Any", + "id": 5 + } + } + }, + "GetOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "ListOperationsRequest": { + "fields": { + "name": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 1 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListOperationsResponse": { + "fields": { + "operations": { + "rule": "repeated", + "type": "Operation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CancelOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "DeleteOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "WaitOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 2 + } + } + }, + "OperationInfo": { + "fields": { + "responseType": { + "type": "string", + "id": 1 + }, + "metadataType": { + "type": "string", + "id": 2 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-documentai/samples/.eslintrc.yml b/packages/google-cloud-documentai/samples/.eslintrc.yml new file mode 100644 index 00000000000..98634adbeff --- /dev/null +++ b/packages/google-cloud-documentai/samples/.eslintrc.yml @@ -0,0 +1,4 @@ +--- +rules: + no-console: off + node/no-unsupported-features/node-builtins: off diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md new file mode 100644 index 00000000000..c3fdc979a96 --- /dev/null +++ b/packages/google-cloud-documentai/samples/README.md @@ -0,0 +1,734 @@ +[//]: # "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/google-cloud-node) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [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/google-cloud-node#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### 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/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) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/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/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) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/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/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) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/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/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) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/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/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) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/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/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) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1/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/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) + +__Usage:__ + + +`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` + + +----- + + + + +### Quickstart + +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/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/test/quickstart.test.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/test/quickstart.test.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/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/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..c099efd7b6c --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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' + /** + * 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.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js new file mode 100644 index 00000000000..24da55f864f --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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..2c087b70d5b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..2f19c69d877 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..09379736014 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..80a52d09a2e --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..8d66f45c069 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..5bb5c2383e4 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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..91913575c66 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..31bcc81a04f --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..a900fd1e249 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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. + */ + /** + * 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..490c0fb5038 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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. + */ + /** + * 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..62b63c5ce60 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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. + */ + /** + * 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 new file mode 100644 index 00000000000..dfcb92d5a7d --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js @@ -0,0 +1,85 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * An inline document proto. + */ + // const inlineDocument = {} + /** + * A raw document content (bytes). + */ + // const rawDocument = {} + /** + * 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' + /** + * Whether Human Review feature should be skipped for this request. Default to + * false. + */ + // 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 = {} + + // 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..583b5a9b150 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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 = {} + /** + * The document schema of the human review task. + */ + // const documentSchema = {} + + // 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/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..64556b986f5 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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..5c84587ee7b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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 new file mode 100644 index 00000000000..eae3a1d5f10 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -0,0 +1,771 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "6.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": 77, + "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" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "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": 71, + "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_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": 55, + "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": 67, + "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": 67, + "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": 53, + "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": 53, + "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": 67, + "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": 54, + "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": 54, + "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": 54, + "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": 60, + "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": 54, + "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": 54, + "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": 54, + "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": 61, + "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", + "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": 71, + "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" + }, + { + "name": "document_schema", + "type": ".google.cloud.documentai.v1.DocumentSchema" + } + ], + "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/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..1c7c32af24f --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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/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..e512be85388 --- /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": "6.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": 60, + "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/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..d8b7a19700e --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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..caf92fe342a --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js @@ -0,0 +1,104 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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(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. + */ + /** + * 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/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..468d13fb3f4 --- /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": "6.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": 60, + "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": 96, + "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/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..25bd5f659c2 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js @@ -0,0 +1,87 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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_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. + */ + /** + * 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' + /** + * 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..fc1916f0a92 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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..ae5e7227c34 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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.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..a2c34c8befc --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..416d46b66b0 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js new file mode 100644 index 00000000000..2fa77f79000 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..e2ee9079f41 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..4fc8c1275e3 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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').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.get_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js new file mode 100644 index 00000000000..4b89803a0c3 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..9c30f2d02fd --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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..7500d1d6dd7 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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. + */ + /** + * 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..c922f46fadc --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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. + */ + /** + * 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 new file mode 100644 index 00000000000..c136a802329 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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. + */ + /** + * 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..1a6657cabc9 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js @@ -0,0 +1,87 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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_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. + */ + /** + * An inline document proto. + */ + // const inlineDocument = {} + /** + * A raw document content (bytes). + */ + // const rawDocument = {} + /** + * 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' + /** + * 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 + /** + * Specifies which fields to include in ProcessResponse's document. + */ + // const fieldMask = {} + + // 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..cb7b942ae57 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js @@ -0,0 +1,83 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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(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. + */ + /** + * 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 = {} + /** + * The document schema of the human review task. + */ + // const documentSchema = {} + + // 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/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..44d9177db6b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. + */ + /** + * 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..6bc7a006fb6 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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. + */ + /** + * 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 new file mode 100644 index 00000000000..bd2acbac3df --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -0,0 +1,787 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "6.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": 79, + "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" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "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": 79, + "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. 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": 55, + "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_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": 67, + "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", + "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": 67, + "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_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": 53, + "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": 53, + "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": 67, + "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": 54, + "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": 54, + "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": 54, + "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", + "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": 60, + "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": 54, + "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": 54, + "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": 54, + "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_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": 61, + "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", + "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": 75, + "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" + }, + { + "name": "document_schema", + "type": ".google.cloud.documentai.v1beta3.DocumentSchema" + } + ], + "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 diff --git a/packages/google-cloud-documentai/samples/package.json b/packages/google-cloud-documentai/samples/package.json new file mode 100644 index 00000000000..5f5b7a6ae39 --- /dev/null +++ b/packages/google-cloud-documentai/samples/package.json @@ -0,0 +1,25 @@ +{ + "name": "nodejs-document-ai-samples", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=12.0.0" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "mocha test/*.js --timeout 600000" + }, + "dependencies": { + "@google-cloud/documentai": "^6.1.0", + "@google-cloud/storage": "^6.0.0", + "p-queue": "^6.6.2", + "uuid": "^9.0.0" + }, + "devDependencies": { + "chai": "^4.2.0", + "mocha": "^8.0.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..a1fe28e1ad5 --- /dev/null +++ b/packages/google-cloud-documentai/samples/quickstart.js @@ -0,0 +1,94 @@ +/** + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +async function main(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 processorId = 'YOUR_PROCESSOR_ID'; // Create processor in Cloud Console + // const filePath = '/path/to/local/pdf'; + + 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() { + // 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 = { + name, + rawDocument: { + 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} = document; + + // Extract shards from the text field + 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 paragraph of paragraphs) { + const paragraphText = getText(paragraph.layout.textAnchor); + console.log(`Paragraph text:\n${paragraphText}`); + } + } + // [END documentai_quickstart] + await quickstart(); +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err); + process.exitCode = 1; +}); 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 00000000000..7722734a430 Binary files /dev/null and b/packages/google-cloud-documentai/samples/resources/invoice.pdf differ diff --git a/packages/google-cloud-documentai/samples/test/quickstart.test.js b/packages/google-cloud-documentai/samples/test/quickstart.test.js new file mode 100644 index 00000000000..de00aec977f --- /dev/null +++ b/packages/google-cloud-documentai/samples/test/quickstart.test.js @@ -0,0 +1,53 @@ +/** + * 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('assert'); +const cp = require('child_process'); +const {describe, it, before} = require('mocha'); + +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 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} ${PROCESSOR_ID} ${filePath}`, + { + cwd, + } + ); + assert.notStrictEqual(stdout.indexOf('Paragraph'), -1); + }); +}); diff --git a/packages/google-cloud-documentai/src/index.ts b/packages/google-cloud-documentai/src/index.ts new file mode 100644 index 00000000000..75c5e3d2de6 --- /dev/null +++ b/packages/google-cloud-documentai/src/index.ts @@ -0,0 +1,30 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +import * as v1beta1 from './v1beta1'; +import * as v1beta2 from './v1beta2'; +import * as v1beta3 from './v1beta3'; + +const DocumentProcessorServiceClient = v1.DocumentProcessorServiceClient; +type DocumentProcessorServiceClient = v1.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..33fffdda1f0 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -0,0 +1,3486 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/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'; +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 _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + 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/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new 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; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options set scopes. + if (!('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + 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); + // 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(lroOptions) + .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 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; + 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) + ), + 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), + 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 = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const documentProcessorServiceStubMethods = [ + 'processDocument', + 'batchProcessDocuments', + 'fetchProcessorTypes', + 'listProcessorTypes', + 'listProcessors', + 'getProcessor', + 'getProcessorVersion', + 'listProcessorVersions', + 'deleteProcessorVersion', + 'deployProcessorVersion', + 'undeployProcessorVersion', + 'createProcessor', + 'deleteProcessor', + 'enableProcessor', + 'disableProcessor', + 'setDefaultProcessorVersion', + '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.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.documentProcessorServiceStub; + } + + /** + * 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 -- + // ------------------- + /** + * 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 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. + * 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. + * 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 + ): 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; + 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'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.processDocument(request, options, callback); + } + /** + * 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. + * 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 [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1.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/v1/document_processor_service.fetch_processor_types.js + * region_tag:documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async + */ + fetchProcessorTypes( + request?: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest | undefined, + {} | undefined + ] + >; + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, + callback: Callback< + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + fetchProcessorTypes( + request?: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + protos.google.cloud.documentai.v1.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'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + 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.v1.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/v1/document_processor_service.get_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_GetProcessor_async + */ + getProcessor( + request?: protos.google.cloud.documentai.v1.IGetProcessorRequest, + options?: CallOptions + ): Promise< + [ + 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 + > + ): 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'] = + this._gaxModule.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.v1.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/v1/document_processor_service.get_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async + */ + getProcessorVersion( + request?: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorVersion, + protos.google.cloud.documentai.v1.IGetProcessorVersionRequest | undefined, + {} | undefined + ] + >; + getProcessorVersion( + request: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getProcessorVersion( + request: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getProcessorVersion( + request?: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorVersion, + protos.google.cloud.documentai.v1.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'] = + this._gaxModule.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. + * + * @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#regular-methods) + * for more details and examples. + * @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'] = + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteProcessorVersion, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deployProcessorVersion, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.undeployProcessorVersion, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteProcessor, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.enableProcessor, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.disableProcessor, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.setDefaultProcessorVersion, + this._gaxModule.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'] = + this._gaxModule.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 + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.ReviewDocumentResponse, + protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 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'] = + this._gaxModule.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 {}, + 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'] = + this._gaxModule.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'] = + this._gaxModule.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 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'] = + this._gaxModule.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 {}, + 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'] = + this._gaxModule.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'] = + this._gaxModule.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 GaxCall, + request, + callSettings + ); + } + + /** + * 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'] = + this._gaxModule.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 {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified 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 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. + * + * @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; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.documentProcessorServiceStub && !this._terminated) { + return this.documentProcessorServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.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..d5b952a9834 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json @@ -0,0 +1,97 @@ +{ + "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" + }, + "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", + "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..a19f0a8b0ca --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json @@ -0,0 +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/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 new file mode 100644 index 00000000000..0c0e9a859b2 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/gapic_metadata.json @@ -0,0 +1,205 @@ +{ + "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" + ] + }, + "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" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentProcessorServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "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/src/v1/index.ts b/packages/google-cloud-documentai/src/v1/index.ts new file mode 100644 index 00000000000..db3b76d115a --- /dev/null +++ b/packages/google-cloud-documentai/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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..edd67bc8609 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -0,0 +1,499 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, +} from 'google-gax'; + +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`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +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 v1beta1 + */ +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: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + 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/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DocumentUnderstandingServiceClient({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 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 = + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + 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(lroOptions) + .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 = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const 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._opts.fallback + ); + + 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 -- + // ------------------- + + /** + * 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 + ): 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; + 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'] = + this._gaxModule.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 include:samples/generated/v1beta1/document_understanding_service.batch_process_documents.js + * region_tag:documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta1.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + this._gaxModule.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 { + if (this.documentUnderstandingServiceStub && !this._terminated) { + return this.documentUnderstandingServiceStub.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_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..a283d1de127 --- /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": "@google-cloud/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..c274d629b37 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/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..295893caf18 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -0,0 +1,629 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, +} from 'google-gax'; + +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`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +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 _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + 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/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DocumentUnderstandingServiceClient({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 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 = + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + 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(lroOptions) + .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 = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.documentai.v1beta2 + .DocumentUnderstandingService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const documentUnderstandingServiceStubMethods = [ + 'batchProcessDocuments', + 'processDocument', + ]; + 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._opts.fallback + ); + + 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 -- + // ------------------- + /** + * 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}. + * 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/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?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1beta2.IDocument, + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta2.IDocument, + ( + | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.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 + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata + >, + 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; + batchProcessDocuments( + request?: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.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'] = + this._gaxModule.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 include:samples/generated/v1beta2/document_understanding_service.batch_process_documents.js + * region_tag:documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse, + protos.google.cloud.documentai.v1beta2.OperationMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + this._gaxModule.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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.documentUnderstandingServiceStub && !this._terminated) { + 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_config.json b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json new file mode 100644 index 00000000000..1dea85e9656 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.documentai.v1beta2.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": 120000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ProcessDocument": { + "timeout_millis": 120000, + "retry_codes_name": "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/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/v1beta2/index.ts b/packages/google-cloud-documentai/src/v1beta2/index.ts new file mode 100644 index 00000000000..c274d629b37 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta2/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/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..230e98be983 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -0,0 +1,3517 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/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'; +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 _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + 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/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new 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; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options set scopes. + if (!('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + 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); + // 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: '/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) + .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 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; + 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 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; + 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) + ), + 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), + 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 = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.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, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const documentProcessorServiceStubMethods = [ + 'processDocument', + 'batchProcessDocuments', + 'fetchProcessorTypes', + 'listProcessorTypes', + 'listProcessors', + 'getProcessor', + 'getProcessorVersion', + 'listProcessorVersions', + 'deleteProcessorVersion', + 'deployProcessorVersion', + 'undeployProcessorVersion', + 'createProcessor', + 'deleteProcessor', + 'enableProcessor', + 'disableProcessor', + 'setDefaultProcessorVersion', + '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.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.documentProcessorServiceStub; + } + + /** + * 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 -- + // ------------------- + /** + * 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 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. + * 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 + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessResponse, + protos.google.cloud.documentai.v1beta3.IProcessRequest | undefined, + {} | undefined + ] + >; + processDocument( + request: protos.google.cloud.documentai.v1beta3.IProcessRequest, + options: 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; + processDocument( + request?: protos.google.cloud.documentai.v1beta3.IProcessRequest, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.processDocument(request, options, callback); + } + /** + * 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. + * 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 [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 + ): 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; + 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'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + 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'] = + this._gaxModule.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'] = + this._gaxModule.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. + * + * @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 + ): 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; + 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'] = + this._gaxModule.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.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 + * 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 + ): 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: 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; + batchProcessDocuments( + request?: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest, + optionsOrCallback?: + | 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: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.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/v1beta3/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.BatchProcessResponse, + protos.google.cloud.documentai.v1beta3.BatchProcessMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.BatchProcessResponse, + protos.google.cloud.documentai.v1beta3.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/v1beta3/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_async + */ + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.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'] = + this._gaxModule.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/v1beta3/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessorVersion_async + */ + async checkDeleteProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteProcessorVersion, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1beta3.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/v1beta3/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_async + */ + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + 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.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.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'] = + this._gaxModule.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/v1beta3/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeployProcessorVersion_async + */ + async checkDeployProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.DeployProcessorVersionMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deployProcessorVersion, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.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/v1beta3/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_async + */ + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + 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.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.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'] = + this._gaxModule.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/v1beta3/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_UndeployProcessorVersion_async + */ + async checkUndeployProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.undeployProcessorVersion, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.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/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 + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessor( + request: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessor( + request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + 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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteProcessor, + this._gaxModule.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; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.enableProcessor, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.disableProcessor, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.setDefaultProcessorVersion, + this._gaxModule.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'] = + this._gaxModule.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 this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + this._gaxModule.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'] = + this._gaxModule.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'] = + this._gaxModule.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 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'] = + this._gaxModule.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 {}, + 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'] = + this._gaxModule.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'] = + this._gaxModule.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 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'] = + this._gaxModule.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 {}, + 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.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 `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.v1beta3.IListProcessorVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessorVersion[], + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse + ] + >; + listProcessorVersions( + request: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorVersion + > + ): void; + listProcessorVersions( + request: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorVersion + > + ): void; + listProcessorVersions( + request?: protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorVersion + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1beta3.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IProcessorVersion + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IProcessorVersion[], + protos.google.cloud.documentai.v1beta3.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1beta3.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'] = + this._gaxModule.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.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 `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.v1beta3.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'] = + this._gaxModule.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 GaxCall, + request, + callSettings + ); + } + + /** + * 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.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_processor_versions.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListProcessorVersions_async + */ + listProcessorVersionsAsync( + request?: protos.google.cloud.documentai.v1beta3.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'] = + this._gaxModule.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 {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified 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 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. + * + * @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; + } + + /** + * 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. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.documentProcessorServiceStub && !this._terminated) { + return this.documentProcessorServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.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..7f6b23b7082 --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json @@ -0,0 +1,97 @@ +{ + "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" + }, + "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", + "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..8264c6d698a --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json @@ -0,0 +1,11 @@ +[ + "../../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", + "../../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 new file mode 100644 index 00000000000..120820fcb8e --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json @@ -0,0 +1,205 @@ +{ + "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" + ] + }, + "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" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentProcessorServiceClient", + "rpcs": { + "ProcessDocument": { + "methods": [ + "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/src/v1beta3/index.ts b/packages/google-cloud-documentai/src/v1beta3/index.ts new file mode 100644 index 00000000000..db3b76d115a --- /dev/null +++ b/packages/google-cloud-documentai/src/v1beta3/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/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/fixtures/sample/src/index.js b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..68ef68b55fd --- /dev/null +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 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 new file mode 100644 index 00000000000..c92c9a088ce --- /dev/null +++ b/packages/google-cloud-documentai/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,34 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {DocumentProcessorServiceClient} from '@google-cloud/documentai'; + +// check that the client class type name can be used +function doStuffWithDocumentProcessorServiceClient( + client: DocumentProcessorServiceClient +) { + client.close(); +} + +function main() { + // 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 new file mode 100644 index 00000000000..6dd1eaadafa --- /dev/null +++ b/packages/google-cloud-documentai/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); + }); + + it('JavaScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(options); + }); +}); diff --git a/packages/google-cloud-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..67db38aeeb0 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -0,0 +1,4691 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.DocumentProcessorServiceClient', () => { + 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 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 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(); + }); + }); + + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + describe('fetchProcessorTypes', () => { + it('invokes fetchProcessorTypes 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.FetchProcessorTypesRequest() + ); + 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() + ); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.fetchProcessorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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.FetchProcessorTypesRequest() + ); + 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() + ); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchProcessorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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.FetchProcessorTypesRequest() + ); + 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); + 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 () => { + 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.FetchProcessorTypesRequest() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + describe('getProcessorVersion', () => { + it('invokes getProcessorVersion 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.GetProcessorVersionRequest() + ); + 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() + ); + client.innerApiCalls.getProcessorVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.getProcessorVersion(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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.GetProcessorVersionRequest() + ); + 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() + ); + client.innerApiCalls.getProcessorVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProcessorVersion( + 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); + 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 () => { + 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.GetProcessorVersionRequest() + ); + 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); + 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 () => { + 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.GetProcessorVersionRequest() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.deleteProcessorVersion(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.deployProcessorVersion(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.undeployProcessorVersion(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.undeployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessor(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.enableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.disableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.setDefaultProcessorVersion(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.setDefaultProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.listProcessorVersions(request), + expectedError + ); + 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 () => { + 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() + ); + 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() + ), + 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( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new 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) + ); + }); + }); + 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.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new 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 + ); + }); + }); + + 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('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 = { + 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) + ); + }); + }); + + 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) + ); + }); + }); + }); +}); 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..3791385f73f --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -0,0 +1,4950 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta3.DocumentProcessorServiceClient', () => { + 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 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 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 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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() + ); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.fetchProcessorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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() + ); + client.innerApiCalls.getProcessorVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.getProcessorVersion(request); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.BatchProcessRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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('deleteProcessorVersion', () => { + it('invokes deleteProcessorVersion 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.DeleteProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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.DeleteProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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.v1beta3.IDeleteProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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.DeleteProcessorVersionRequest() + ); + 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, + expectedError + ); + await assert.rejects( + client.deleteProcessorVersion(request), + expectedError + ); + 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 () => { + 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.DeleteProcessorVersionRequest() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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.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.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.checkDeleteProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deployProcessorVersion', () => { + it('invokes deployProcessorVersion 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.DeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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.DeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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.DeployProcessorVersionRequest() + ); + 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, + expectedError + ); + await assert.rejects( + client.deployProcessorVersion(request), + expectedError + ); + 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 () => { + 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.DeployProcessorVersionRequest() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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.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.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.checkDeployProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('undeployProcessorVersion', () => { + it('invokes undeployProcessorVersion 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.UndeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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.UndeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IUndeployProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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.UndeployProcessorVersionRequest() + ); + 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, + expectedError + ); + await assert.rejects( + client.undeployProcessorVersion(request), + expectedError + ); + 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 () => { + 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.UndeployProcessorVersionRequest() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.undeployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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.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.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.checkUndeployProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProcessor', () => { + it('invokes deleteProcessor 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.DeleteProcessorRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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.DeleteProcessorRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeleteProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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.v1beta3.IDeleteProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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.DeleteProcessorRequest() + ); + 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); + 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 () => { + 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.DeleteProcessorRequest() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessor(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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.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.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.checkDeleteProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EnableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.enableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DisableProcessorRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.disableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest', + ['processor'] + ); + request.processor = defaultValue1; + const expectedHeaderRequestParams = `processor=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.setDefaultProcessorVersion(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.setDefaultProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + 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 () => { + 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() + ); + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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() + ), + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.listProcessorVersions(request), + expectedError + ); + 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 () => { + 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() + ); + 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() + ), + 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.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( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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() + ), + 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( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + 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); + 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( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new 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( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new 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) => { + 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.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.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation 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.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.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) => { + 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.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.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.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.v1beta3.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 + ); + }); + }); + + 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('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 = { + 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) + ); + }); + }); + + 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('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 = { + 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) + ); + }); + }); + }); +}); 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..c1494ea8f35 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta1.ts @@ -0,0 +1,427 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function 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', () => { + 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 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 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 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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)); + }); + }); +}); 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..1d81f5d0306 --- /dev/null +++ b/packages/google-cloud-documentai/test/gapic_document_understanding_service_v1beta2.ts @@ -0,0 +1,578 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +describe('v1beta2.DocumentUnderstandingServiceClient', () => { + 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 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 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 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() + ); + 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); + 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 () => { + 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() + ); + 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 = + 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); + 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 () => { + 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() + ); + 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); + 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 () => { + 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() + ); + 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); + }); + }); + + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + 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 () => { + 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() + ); + 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, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + 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 () => { + 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() + ); + 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, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + 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 () => { + 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)); + }); + }); +}); diff --git a/packages/google-cloud-documentai/tsconfig.json b/packages/google-cloud-documentai/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /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": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/packages/google-cloud-documentai/webpack.config.js b/packages/google-cloud-documentai/webpack.config.js new file mode 100644 index 00000000000..50f90447431 --- /dev/null +++ b/packages/google-cloud-documentai/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'DocumentProcessorService', + filename: './document-processor-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/, + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader', + }, + ], + }, + mode: 'production', +}; diff --git a/release-please-config.json b/release-please-config.json index 0201dd61132..7d5f77b694d 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -23,6 +23,7 @@ "packages/google-cloud-deploy": {}, "packages/google-cloud-dialogflow": {}, "packages/google-cloud-discoveryengine": {}, + "packages/google-cloud-documentai": {}, "packages/google-cloud-gkeconnect-gateway": {}, "packages/google-cloud-gkemulticloud": {}, "packages/google-cloud-iot": {},