diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b35093bdd48..837f9f7a715 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -29,6 +29,7 @@ "packages/google-cloud-resourcemanager": "4.1.3", "packages/google-cloud-security-publicca": "0.1.3", "packages/google-cloud-shell": "2.0.4", + "packages/google-cloud-translate": "7.0.4", "packages/google-cloud-videointelligence": "4.1.1", "packages/google-devtools-artifactregistry": "2.0.2", "packages/google-iam": "0.2.2", diff --git a/packages/google-cloud-translate/.OwlBot.yaml b/packages/google-cloud-translate/.OwlBot.yaml new file mode 100644 index 00000000000..a23f55d15ff --- /dev/null +++ b/packages/google-cloud-translate/.OwlBot.yaml @@ -0,0 +1,24 @@ +# 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/translate/(v.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-translate/$1 + +begin-after-commit-hash: f43939eac6a0bb5998c1fa0f79063194e699230e + diff --git a/packages/google-cloud-translate/.eslintignore b/packages/google-cloud-translate/.eslintignore new file mode 100644 index 00000000000..ea5b04aebe6 --- /dev/null +++ b/packages/google-cloud-translate/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ +samples/generated/ diff --git a/packages/google-cloud-translate/.eslintrc.json b/packages/google-cloud-translate/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-translate/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-translate/.gitattributes b/packages/google-cloud-translate/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-translate/.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-translate/.gitignore b/packages/google-cloud-translate/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-translate/.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-translate/.jsdoc.js b/packages/google-cloud-translate/.jsdoc.js new file mode 100644 index 00000000000..2f0f785e54e --- /dev/null +++ b/packages/google-cloud-translate/.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/translate', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-translate/.mocharc.js b/packages/google-cloud-translate/.mocharc.js new file mode 100644 index 00000000000..cdb7b752160 --- /dev/null +++ b/packages/google-cloud-translate/.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-translate/.nycrc b/packages/google-cloud-translate/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-translate/.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-translate/.prettierignore b/packages/google-cloud-translate/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-translate/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-translate/.prettierrc.js b/packages/google-cloud-translate/.prettierrc.js new file mode 100644 index 00000000000..d546a4ad546 --- /dev/null +++ b/packages/google-cloud-translate/.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-translate/.readme-partials.yml b/packages/google-cloud-translate/.readme-partials.yml new file mode 100644 index 00000000000..8aa2b4edd78 --- /dev/null +++ b/packages/google-cloud-translate/.readme-partials.yml @@ -0,0 +1,68 @@ +introduction: |- + The [Cloud Translation API](https://cloud.google.com/translate/docs/), + can dynamically translate text between thousands + of language pairs. The Cloud Translation API lets websites and programs + integrate with the translation service programmatically. The Cloud Translation + API is part of the larger Cloud Machine Learning API family. +samples_body: |- + ### Choosing between Advanced v3 and Basic v2 + + Basic supports language detection and text translation [Cloud Translation - Basic v2](https://cloud.google.com/translate/docs/editions#basic). + + The advanced edition of [Cloud Translation - V3](https://cloud.google.com/translate/docs/editions#advanced) is optimized for customization and long form content use cases including glossary, batch, and model selection. + + ### Translate V3 Beta Samples + + #### Install Dependencies + + From the [root directory](https://github.com/googleapis/nodejs-translate) of the client library install the dependencies: + + ``` + npm install + ``` + + Change to the samples directory, link the google-cloud/translate library from the parent, and install its dependencies: + + ``` + cd samples/ + npm link ../ + npm install + ``` + + #### Run the Tests + + To run the tests for the entire sample, run + + ``` + npm test + ``` + + To run the tests for only the translate v3 samples, run + + ``` + npm run test-v3 + ``` + + To run the tests for a single translate v3 sample, run this command, substituting FILE_NAME with the name of a valid test file. + + ``` + ./node_modules/.bin/mocha test/v3beta1/FILE_NAME + ``` + + For example, to test the `translate_list_language_names_beta` sample, the command would be + + ``` + ./node_modules/.bin/mocha test/v3beta1/translate_list_language_names_beta.test.js + ``` + + To run a sample directly, call the file with the `node` command and any required CLI arguments: + + ``` + node v3beta1/FILE_NAME + ``` + + For example, to run the `translate_list_codes_beta` sample, you would run the following command, substituting your project ID in place of "your_project_id" + + ``` + node v3beta1/translate_list_codes_beta.js "your_project_id" + ``` diff --git a/packages/google-cloud-translate/.repo-metadata.json b/packages/google-cloud-translate/.repo-metadata.json new file mode 100644 index 00000000000..331a181f16c --- /dev/null +++ b/packages/google-cloud-translate/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "distribution_name": "@google-cloud/translate", + "release_level": "stable", + "product_documentation": "https://cloud.google.com/translate/docs/", + "repo": "googleapis/google-cloud-node", + "default_version": "v3", + "language": "nodejs", + "requires_billing": true, + "issue_tracker": "https://issuetracker.google.com/savedsearches/559749", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/translate/latest", + "name": "translate", + "name_pretty": "Cloud Translation", + "api_id": "translate.googleapis.com", + "codeowner_team": "@googleapis/ml-apis", + "api_shortname": "translate", + "library_type": "GAPIC_AUTO" +} diff --git a/packages/google-cloud-translate/CHANGELOG.md b/packages/google-cloud-translate/CHANGELOG.md new file mode 100644 index 00000000000..a1a7e00d98b --- /dev/null +++ b/packages/google-cloud-translate/CHANGELOG.md @@ -0,0 +1,648 @@ +# Changelog + +[npm history][1] + +[1]: https://www.npmjs.com/package/nodejs-translate?activeTab=versions + +## [7.0.4](https://github.com/googleapis/nodejs-translate/compare/v7.0.3...v7.0.4) (2022-11-09) + + +### Bug Fixes + +* **deps:** Use google-gax v3.5.2 ([#879](https://github.com/googleapis/nodejs-translate/issues/879)) ([c425c4d](https://github.com/googleapis/nodejs-translate/commit/c425c4dae9fa6dcf73d1e27381e561add26a1ffb)) +* update proto definitions ([933973b](https://github.com/googleapis/nodejs-translate/commit/933973b971c59a9a018b5b63d27f1a64da530b76)) +* Update proto definitions ([#883](https://github.com/googleapis/nodejs-translate/issues/883)) ([933973b](https://github.com/googleapis/nodejs-translate/commit/933973b971c59a9a018b5b63d27f1a64da530b76)) + +## [7.0.3](https://github.com/googleapis/nodejs-translate/compare/v7.0.2...v7.0.3) (2022-09-22) + + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#814](https://github.com/googleapis/nodejs-translate/issues/814)) ([ddc93f9](https://github.com/googleapis/nodejs-translate/commit/ddc93f97e2f312287624ef877071aa4e8f8b5309)) +* **deps:** Update dependency @google-cloud/vision to v3 ([#816](https://github.com/googleapis/nodejs-translate/issues/816)) ([331c65b](https://github.com/googleapis/nodejs-translate/commit/331c65b6e91efab89f22c976fb117fb99ed0ff3d)) +* Preserve default values in x-goog-request-params header ([#820](https://github.com/googleapis/nodejs-translate/issues/820)) ([913ac11](https://github.com/googleapis/nodejs-translate/commit/913ac11a735b25ae7182bc0f57f9ce0e2a1c5738)) + +## [7.0.2](https://github.com/googleapis/nodejs-translate/compare/v7.0.1...v7.0.2) (2022-08-27) + + +### Bug Fixes + +* better support for fallback mode ([#809](https://github.com/googleapis/nodejs-translate/issues/809)) ([1a90646](https://github.com/googleapis/nodejs-translate/commit/1a9064602582090468e9371ddfe830bd32dad566)) +* change import long to require ([#810](https://github.com/googleapis/nodejs-translate/issues/810)) ([2fa0935](https://github.com/googleapis/nodejs-translate/commit/2fa09350e03c4abd34ab00956a0349627baa5196)) +* do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-translate/issues/1553)) ([#813](https://github.com/googleapis/nodejs-translate/issues/813)) ([15e8ec9](https://github.com/googleapis/nodejs-translate/commit/15e8ec92bfa95adcfd31f8f8945f7ad6b7f02a79)) +* remove pip install statements ([#1546](https://github.com/googleapis/nodejs-translate/issues/1546)) ([#812](https://github.com/googleapis/nodejs-translate/issues/812)) ([d82da1f](https://github.com/googleapis/nodejs-translate/commit/d82da1f4788f273931324e8a84a2d06abc9a7e7e)) +* use google-gax v3.3.0 ([15e8ec9](https://github.com/googleapis/nodejs-translate/commit/15e8ec92bfa95adcfd31f8f8945f7ad6b7f02a79)) + +## [7.0.1](https://github.com/googleapis/nodejs-translate/compare/v7.0.0...v7.0.1) (2022-08-10) + + +### Bug Fixes + +* **deps:** do not depend on protobufjs ([#802](https://github.com/googleapis/nodejs-translate/issues/802)) ([e8f13e4](https://github.com/googleapis/nodejs-translate/commit/e8f13e412c2ee9c8cded6cd4efed31b3d78f8170)) +* **deps:** update dependency @google-cloud/automl to v3 ([#796](https://github.com/googleapis/nodejs-translate/issues/796)) ([440b1cb](https://github.com/googleapis/nodejs-translate/commit/440b1cb267a8d737038881d5525c4096629d64aa)) +* **deps:** update dependency @google-cloud/text-to-speech to v4 ([#797](https://github.com/googleapis/nodejs-translate/issues/797)) ([a210e6e](https://github.com/googleapis/nodejs-translate/commit/a210e6e7d154e137a8ed3eb344f322552cd785a8)) + +## [7.0.0](https://github.com/googleapis/nodejs-translate/compare/v6.3.1...v7.0.0) (2022-06-30) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#789) + +### Features + +* support regapic LRO ([#798](https://github.com/googleapis/nodejs-translate/issues/798)) ([9f1ddc1](https://github.com/googleapis/nodejs-translate/commit/9f1ddc167b20e1b5c3eeadf68867ba2294f2bb12)) + + +### Bug Fixes + +* **deps:** update dependency @google-cloud/common to v4 ([#793](https://github.com/googleapis/nodejs-translate/issues/793)) ([a2d079b](https://github.com/googleapis/nodejs-translate/commit/a2d079b6b36c67a21d2c3860c1c1fb497f56c499)) +* **test:** fix language detection test ([#779](https://github.com/googleapis/nodejs-translate/issues/779)) ([b6df5e2](https://github.com/googleapis/nodejs-translate/commit/b6df5e27ce37bab53f654bcfdfabf40b8db3e8a0)) + + +### Build System + +* update library to use Node 12 ([#789](https://github.com/googleapis/nodejs-translate/issues/789)) ([3060301](https://github.com/googleapis/nodejs-translate/commit/30603014cecb2da9cc73c561bd1fb127a158d84d)) + +### [6.3.1](https://www.github.com/googleapis/nodejs-translate/compare/v6.3.0...v6.3.1) (2021-10-18) + + +### Bug Fixes + +* add model signature for batch document translation ([#735](https://www.github.com/googleapis/nodejs-translate/issues/735)) ([406c768](https://www.github.com/googleapis/nodejs-translate/commit/406c7684babb00dcda8dfbb07c6210f810972262)) + +## [6.3.0](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.7...v6.3.0) (2021-09-13) + + +### Features + +* added v3 proto for online/batch document translation and updated v3beta1 proto for format conversion ([#719](https://www.github.com/googleapis/nodejs-translate/issues/719)) ([76c9a13](https://www.github.com/googleapis/nodejs-translate/commit/76c9a13a0bb8b9dadc9f671e649af82f58c943f6)) +* turns on self-signed JWT feature flag ([#713](https://www.github.com/googleapis/nodejs-translate/issues/713)) ([41062a6](https://www.github.com/googleapis/nodejs-translate/commit/41062a675ae8bb19d921b5612ae325383d219725)) + + +### Bug Fixes + +* add missing annotation for batch document translation ([#715](https://www.github.com/googleapis/nodejs-translate/issues/715)) ([b893e3d](https://www.github.com/googleapis/nodejs-translate/commit/b893e3dcc532813d29d96950fc90962215ad6e51)) +* **build:** set default branch to main ([#722](https://www.github.com/googleapis/nodejs-translate/issues/722)) ([26b9ba7](https://www.github.com/googleapis/nodejs-translate/commit/26b9ba7850d25234e1bfb8035dd5ef7a1108b31c)) +* remove unnecessary assertion ([#721](https://www.github.com/googleapis/nodejs-translate/issues/721)) ([a5a1f82](https://www.github.com/googleapis/nodejs-translate/commit/a5a1f82b9b78f465ef6bbbfba55dda8937d90dfa)) + +### [6.2.7](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.6...v6.2.7) (2021-08-17) + + +### Bug Fixes + +* **deps:** google-gax v2.24.1 ([#711](https://www.github.com/googleapis/nodejs-translate/issues/711)) ([87604a3](https://www.github.com/googleapis/nodejs-translate/commit/87604a30f57186c90e8edfe7a3259c41da8c03d2)) +* increase timeout for batch translate document ([#708](https://www.github.com/googleapis/nodejs-translate/issues/708)) ([ef154ad](https://www.github.com/googleapis/nodejs-translate/commit/ef154ad287820890a4aaedbf40e91b1cb2f798cc)) + +### [6.2.6](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.5...v6.2.6) (2021-07-21) + + +### Bug Fixes + +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#699](https://www.github.com/googleapis/nodejs-translate/issues/699)) ([41e7ba3](https://www.github.com/googleapis/nodejs-translate/commit/41e7ba31041a2138c7068ce0e14528d044cb3606)) + +### [6.2.5](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.4...v6.2.5) (2021-07-12) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#695](https://www.github.com/googleapis/nodejs-translate/issues/695)) ([20bac38](https://www.github.com/googleapis/nodejs-translate/commit/20bac38c89480e4e221419bab13e3f10d626df6c)) + +### [6.2.4](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.3...v6.2.4) (2021-06-29) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#691](https://www.github.com/googleapis/nodejs-translate/issues/691)) ([5de0327](https://www.github.com/googleapis/nodejs-translate/commit/5de03274c69ae1e0be252e32d42b4fc4554d8e64)) + +### [6.2.3](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.2...v6.2.3) (2021-06-24) + + +### Bug Fixes + +* make request optional in all cases ([#687](https://www.github.com/googleapis/nodejs-translate/issues/687)) ([621dc99](https://www.github.com/googleapis/nodejs-translate/commit/621dc99db8de832328731c3176e7bf44842062db)) + +### [6.2.2](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.1...v6.2.2) (2021-06-01) + + +### Bug Fixes + +* GoogleAdsError missing using generator version after 1.3.0 ([#672](https://www.github.com/googleapis/nodejs-translate/issues/672)) ([55ca7e7](https://www.github.com/googleapis/nodejs-translate/commit/55ca7e7acd102fb6590a8440c403df8600109357)) + +### [6.2.1](https://www.github.com/googleapis/nodejs-translate/compare/v6.2.0...v6.2.1) (2021-05-11) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#657](https://www.github.com/googleapis/nodejs-translate/issues/657)) ([71d695d](https://www.github.com/googleapis/nodejs-translate/commit/71d695d5e217b96e688b4bb71887b19ebedae1ff)) +* use require() to load JSON protos ([#661](https://www.github.com/googleapis/nodejs-translate/issues/661)) ([5294080](https://www.github.com/googleapis/nodejs-translate/commit/529408087d68461651f1ce80b5fba460bde0f5bc)) + +## [6.2.0](https://www.github.com/googleapis/nodejs-translate/compare/v6.1.0...v6.2.0) (2021-04-07) + + +### Features + +* added v3beta1 proto for online and batch document translation ([#639](https://www.github.com/googleapis/nodejs-translate/issues/639)) ([513c21a](https://www.github.com/googleapis/nodejs-translate/commit/513c21aabf2ece278708bca56a94bde33e80f072)) + +## [6.1.0](https://www.github.com/googleapis/nodejs-translate/compare/v6.0.5...v6.1.0) (2021-01-09) + + +### Features + +* adds style enumeration ([#611](https://www.github.com/googleapis/nodejs-translate/issues/611)) ([3189de4](https://www.github.com/googleapis/nodejs-translate/commit/3189de48c865e86e86475819a95698bc9c7e6822)) + +### [6.0.5](https://www.github.com/googleapis/nodejs-translate/compare/v6.0.4...v6.0.5) (2020-12-04) + + +### Bug Fixes + +* **browser:** check for fetch on window ([de3e562](https://www.github.com/googleapis/nodejs-translate/commit/de3e5624981cd07249bd2aad6fcb0f53a6383a3f)) + +### [6.0.4](https://www.github.com/googleapis/nodejs-translate/compare/v6.0.3...v6.0.4) (2020-11-07) + + +### Bug Fixes + +* do not modify options object, use defaultScopes ([#593](https://www.github.com/googleapis/nodejs-translate/issues/593)) ([f38bbcd](https://www.github.com/googleapis/nodejs-translate/commit/f38bbcdb6df9f5e3849c20ff0cc2dfd020284c61)) + +### [6.0.3](https://www.github.com/googleapis/nodejs-translate/compare/v6.0.2...v6.0.3) (2020-09-17) + + +### Bug Fixes + +* **deps:** update dependency yargs to v16 ([#577](https://www.github.com/googleapis/nodejs-translate/issues/577)) ([6ca7d9a](https://www.github.com/googleapis/nodejs-translate/commit/6ca7d9aea43a8934f6426d7c99d9c48a5a81f9fb)) + +### [6.0.2](https://www.github.com/googleapis/nodejs-translate/compare/v6.0.1...v6.0.2) (2020-07-15) + + +### Bug Fixes + +* typeo in nodejs .gitattribute ([#556](https://www.github.com/googleapis/nodejs-translate/issues/556)) ([f774b0c](https://www.github.com/googleapis/nodejs-translate/commit/f774b0cae621be822b80b34c67adbbebb995ceec)) + +### [6.0.1](https://www.github.com/googleapis/nodejs-translate/compare/v6.0.0...v6.0.1) (2020-06-29) + + +### Bug Fixes + +* handle fallback option properly ([#547](https://www.github.com/googleapis/nodejs-translate/issues/547)) ([9146de2](https://www.github.com/googleapis/nodejs-translate/commit/9146de2a08565418dc118d1c8f3034f90ef9778e)) +* **deps:** update dependency @google-cloud/text-to-speech to v3 ([#538](https://www.github.com/googleapis/nodejs-translate/issues/538)) ([423dba3](https://www.github.com/googleapis/nodejs-translate/commit/423dba36a2c82ac6335c279edb1d246add55b754)) +* **deps:** update dependency @google-cloud/vision to v2 ([#539](https://www.github.com/googleapis/nodejs-translate/issues/539)) ([5dbeac4](https://www.github.com/googleapis/nodejs-translate/commit/5dbeac4e9a3133a6008cd8fb882046fe4a9946bc)) +* **samples:** typo in CLI invocation ([9755e2d](https://www.github.com/googleapis/nodejs-translate/commit/9755e2deff080d8a250ecbd251c7810288cd92d9)) +* update node issue template ([#551](https://www.github.com/googleapis/nodejs-translate/issues/551)) ([548d1e5](https://www.github.com/googleapis/nodejs-translate/commit/548d1e5219141b293631087723ee111382a8e857)) + +## [6.0.0](https://www.github.com/googleapis/nodejs-translate/compare/v5.3.0...v6.0.0) (2020-06-03) + + +### ⚠ 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; fix linting ([#531](https://www.github.com/googleapis/nodejs-translate/issues/531)) ([6e6907d](https://www.github.com/googleapis/nodejs-translate/commit/6e6907da0187d05797967b80d2d75c25125658aa)) +* drop node8 support, support for async iterators ([#482](https://www.github.com/googleapis/nodejs-translate/issues/482)) ([4a5f047](https://www.github.com/googleapis/nodejs-translate/commit/4a5f047f141dbe5dd0d6979351a36d9c2232f22e)) + + +### Bug Fixes + +* ensure scoped protobuf ([#500](https://www.github.com/googleapis/nodejs-translate/issues/500)) ([5793c23](https://www.github.com/googleapis/nodejs-translate/commit/5793c2306f7c028be093465a08d41824e48ed492)) +* remove eslint, update gax, fix generated protos, run the generator ([#507](https://www.github.com/googleapis/nodejs-translate/issues/507)) ([8f43605](https://www.github.com/googleapis/nodejs-translate/commit/8f4360505e4b86fe6729f96f34488aec84a5a1b6)) +* **deps:** update dependency @google-cloud/automl to v2 ([#503](https://www.github.com/googleapis/nodejs-translate/issues/503)) ([8ba77fe](https://www.github.com/googleapis/nodejs-translate/commit/8ba77fe702fef017b9f59678f9503705d16efe75)) +* **deps:** update dependency @google-cloud/common to v3 ([#481](https://www.github.com/googleapis/nodejs-translate/issues/481)) ([fc719f0](https://www.github.com/googleapis/nodejs-translate/commit/fc719f08804299a3c8086a3eff393fbf8f1fde80)) +* **deps:** update dependency @google-cloud/promisify to v2 ([#476](https://www.github.com/googleapis/nodejs-translate/issues/476)) ([bbbfa9f](https://www.github.com/googleapis/nodejs-translate/commit/bbbfa9f3223d39b5b78b9972d61eb8fb77bddafa)) + +## [5.3.0](https://www.github.com/googleapis/nodejs-translate/compare/v5.2.0...v5.3.0) (2020-03-06) + + +### Features + +* deferred client initialization ([#460](https://www.github.com/googleapis/nodejs-translate/issues/460)) ([0ed76f4](https://www.github.com/googleapis/nodejs-translate/commit/0ed76f4e83528c2d087a26598535f5daf5a08444)) + +## [5.2.0](https://www.github.com/googleapis/nodejs-translate/compare/v5.1.6...v5.2.0) (2020-02-27) + + +### Features + +* export protos in src/index.ts ([#451](https://www.github.com/googleapis/nodejs-translate/issues/451)) ([a70079e](https://www.github.com/googleapis/nodejs-translate/commit/a70079ea24fe36d7efdd7d028a55fd6acbd6b3e1)) + +### [5.1.6](https://www.github.com/googleapis/nodejs-translate/compare/v5.1.5...v5.1.6) (2020-02-07) + + +### Bug Fixes + +* pass x-goog-request-params header for streaming calls ([40c90fa](https://www.github.com/googleapis/nodejs-translate/commit/40c90fa099ef0bd995b5923cd35ba4ac0f9344e1)) + +### [5.1.5](https://www.github.com/googleapis/nodejs-translate/compare/v5.1.4...v5.1.5) (2020-02-04) + + +### Bug Fixes + +* enum, bytes, and Long types now accept strings ([19891e0](https://www.github.com/googleapis/nodejs-translate/commit/19891e07b2f1aaad5552999f1701dc81b5447754)) + +### [5.1.4](https://www.github.com/googleapis/nodejs-translate/compare/v5.1.3...v5.1.4) (2020-01-04) + + +### Bug Fixes + +* better client close(), update .nycrc ([f476326](https://www.github.com/googleapis/nodejs-translate/commit/f476326b19e41253ba054cdfa5b7fcdfcb8dc1b2)) +* increase timeout from 20s to 60s ([#411](https://www.github.com/googleapis/nodejs-translate/issues/411)) ([40241fe](https://www.github.com/googleapis/nodejs-translate/commit/40241fea93a2315eae8344c58a9ffed87392eda4)) +* suppress unhandled promise rejection errors ([#417](https://www.github.com/googleapis/nodejs-translate/issues/417)) ([8eb6558](https://www.github.com/googleapis/nodejs-translate/commit/8eb655862b2d9c92f28f5b96eb1158dce3af704c)) + +### [5.1.3](https://www.github.com/googleapis/nodejs-translate/compare/v5.1.2...v5.1.3) (2019-12-16) + + +### Bug Fixes + +* refactored request call to supress unhandled promise rejection ([#406](https://www.github.com/googleapis/nodejs-translate/issues/406)) ([19fc9c7](https://www.github.com/googleapis/nodejs-translate/commit/19fc9c7d24e5b8d16f32d80023b81294e02d34d6)) +* removed display_name from sample ([f518b1a](https://www.github.com/googleapis/nodejs-translate/commit/f518b1a9b405626e058f9f143d3e8929af1401db)) +* update translate_create_glossary.js ([#403](https://www.github.com/googleapis/nodejs-translate/issues/403)) ([aa10fc7](https://www.github.com/googleapis/nodejs-translate/commit/aa10fc7ac9299895b7e87ebec574e27871e0bd1d)) + +### [5.1.2](https://www.github.com/googleapis/nodejs-translate/compare/v5.1.1...v5.1.2) (2019-12-11) + + +### Bug Fixes + +* make operationsClient and service stub public ([7ac1252](https://www.github.com/googleapis/nodejs-translate/commit/7ac12522ef96d6a37c15ca7847e6e872316c8a9d)) + +### [5.1.1](https://www.github.com/googleapis/nodejs-translate/compare/v5.1.0...v5.1.1) (2019-12-05) + + +### Bug Fixes + +* **deps:** pin TypeScript below 3.7.0 ([53f3cff](https://www.github.com/googleapis/nodejs-translate/commit/53f3cff821869347a8d34f3b0561d3b8158d171d)) + +## [5.1.0](https://www.github.com/googleapis/nodejs-translate/compare/v5.0.2...v5.1.0) (2019-11-22) + + +### Features + +* convert v3beta1 to TypeScript ([#389](https://www.github.com/googleapis/nodejs-translate/issues/389)) ([0a88c63](https://www.github.com/googleapis/nodejs-translate/commit/0a88c63a1cb0564958f8b2f9d9d11d504284a229)) + + +### Bug Fixes + +* get autosynth working again ([#387](https://www.github.com/googleapis/nodejs-translate/issues/387)) ([c226e58](https://www.github.com/googleapis/nodejs-translate/commit/c226e5811f898ad424a6bf85af197559bf668b25)) +* **deps:** update dependency yargs to v15 ([#386](https://www.github.com/googleapis/nodejs-translate/issues/386)) ([e87a80f](https://www.github.com/googleapis/nodejs-translate/commit/e87a80f201588b779728dd29c5dae96fb7055dbf)) +* **docs:** snippets are now replaced in jsdoc comments ([#381](https://www.github.com/googleapis/nodejs-translate/issues/381)) ([b14f7d4](https://www.github.com/googleapis/nodejs-translate/commit/b14f7d42b961400dfe9dec7bc3fff3a7688c0baa)) + +### [5.0.2](https://www.github.com/googleapis/nodejs-translate/compare/v5.0.1...v5.0.2) (2019-11-08) + + +### Bug Fixes + +* region tag ([#367](https://www.github.com/googleapis/nodejs-translate/issues/367)) ([13e75d2](https://www.github.com/googleapis/nodejs-translate/commit/13e75d2680e3c4f09e07b19cce650a91b212603f)) + +### [5.0.1](https://www.github.com/googleapis/nodejs-translate/compare/v5.0.0...v5.0.1) (2019-10-28) + + +### Bug Fixes + +* package.json in build/ caused bad publish ([#361](https://www.github.com/googleapis/nodejs-translate/issues/361)) ([e9c8955](https://www.github.com/googleapis/nodejs-translate/commit/e9c8955f68d18562cab50b8d0500dd62005887f8)) + +## [5.0.0](https://www.github.com/googleapis/nodejs-translate/compare/v4.2.1...v5.0.0) (2019-10-28) + + +### ⚠ BREAKING CHANGES + +* this significantly changes TypeScript types and API surface from the v2 API. Reference samples/ for help making the migration from v2 to v3. + +### Features + +* v3 is now the default API surface ([#355](https://www.github.com/googleapis/nodejs-translate/issues/355)) ([91169b4](https://www.github.com/googleapis/nodejs-translate/commit/91169b4b141289a6890e1da1ba04765fbfdfd617)) + + +### Bug Fixes + +* remove extra brace in snippet ([#347](https://www.github.com/googleapis/nodejs-translate/issues/347)) ([6c1e95b](https://www.github.com/googleapis/nodejs-translate/commit/6c1e95bd99ec84c48e73b85203562b5f1cfa46d9)) + +### [4.2.1](https://www.github.com/googleapis/nodejs-translate/compare/v4.2.0...v4.2.1) (2019-10-22) + + +### Bug Fixes + +* **deps:** bump google-gax to 1.7.5 ([#345](https://www.github.com/googleapis/nodejs-translate/issues/345)) ([2c89fd0](https://www.github.com/googleapis/nodejs-translate/commit/2c89fd090d6557d0387c442eaef59069371e4095)) + +## [4.2.0](https://www.github.com/googleapis/nodejs-translate/compare/v4.1.3...v4.2.0) (2019-10-10) + + +### Bug Fixes + +* **deps:** update dependency yargs to v14 ([3d6b18d](https://www.github.com/googleapis/nodejs-translate/commit/3d6b18d)) +* **deps:** use the latest extend ([#316](https://www.github.com/googleapis/nodejs-translate/issues/316)) ([f7ca873](https://www.github.com/googleapis/nodejs-translate/commit/f7ca873)) +* **docs:** stop linking reference documents to anchor ([f935f91](https://www.github.com/googleapis/nodejs-translate/commit/f935f91)) +* **samples:** use us-central1 region (not global) ([#322](https://www.github.com/googleapis/nodejs-translate/issues/322)) ([8500423](https://www.github.com/googleapis/nodejs-translate/commit/8500423)) +* add filter to method signature ([f6fb81e](https://www.github.com/googleapis/nodejs-translate/commit/f6fb81e)) +* hybrid glossaries ([#338](https://www.github.com/googleapis/nodejs-translate/issues/338)) ([d37671a](https://www.github.com/googleapis/nodejs-translate/commit/d37671a)) +* hybrid glossary tutorial region tag ([#334](https://www.github.com/googleapis/nodejs-translate/issues/334)) ([d61836d](https://www.github.com/googleapis/nodejs-translate/commit/d61836d)) +* use compatible version of google-gax ([620304e](https://www.github.com/googleapis/nodejs-translate/commit/620304e)) +* use correct version for x-goog-api-client header ([50950c9](https://www.github.com/googleapis/nodejs-translate/commit/50950c9)) + + +### Features + +* add label support ([#331](https://www.github.com/googleapis/nodejs-translate/issues/331)) ([c912f71](https://www.github.com/googleapis/nodejs-translate/commit/c912f71)) +* load protos from JSON, grpc-fallback support ([423c336](https://www.github.com/googleapis/nodejs-translate/commit/423c336)) +* samples for hybrid glossaries tutorial ([#327](https://www.github.com/googleapis/nodejs-translate/issues/327)) ([96ec12f](https://www.github.com/googleapis/nodejs-translate/commit/96ec12f)) + +### [4.1.3](https://www.github.com/googleapis/nodejs-translate/compare/v4.1.2...v4.1.3) (2019-08-05) + + +### Bug Fixes + +* allow calls with no request, add JSON proto ([#313](https://www.github.com/googleapis/nodejs-translate/issues/313)) ([01afc09](https://www.github.com/googleapis/nodejs-translate/commit/01afc09)) + +### [4.1.2](https://www.github.com/googleapis/nodejs-translate/compare/v4.1.1...v4.1.2) (2019-07-23) + + +### Bug Fixes + +* **deps:** drop unused dependency lodash.merge, related to sec vulnerability (fixes [#301](https://www.github.com/googleapis/nodejs-translate/issues/301)) ([#302](https://www.github.com/googleapis/nodejs-translate/issues/302)) ([018efd4](https://www.github.com/googleapis/nodejs-translate/commit/018efd4)) + +### [4.1.1](https://www.github.com/googleapis/nodejs-translate/compare/v4.1.0...v4.1.1) (2019-06-29) + + +### Bug Fixes + +* **docs:** link to reference docs section on googleapis.dev ([#298](https://www.github.com/googleapis/nodejs-translate/issues/298)) ([d49a68e](https://www.github.com/googleapis/nodejs-translate/commit/d49a68e)) + +## [4.1.0](https://www.github.com/googleapis/nodejs-translate/compare/v4.0.1...v4.1.0) (2019-06-14) + + +### Bug Fixes + +* **deps:** update dependency is-html to v2 ([#280](https://www.github.com/googleapis/nodejs-translate/issues/280)) ([00187c9](https://www.github.com/googleapis/nodejs-translate/commit/00187c9)) +* **deps:** update dependency teeny-request to v4 ([#292](https://www.github.com/googleapis/nodejs-translate/issues/292)) ([5d608f2](https://www.github.com/googleapis/nodejs-translate/commit/5d608f2)) +* **docs:** move to new client docs URL ([#294](https://www.github.com/googleapis/nodejs-translate/issues/294)) ([ecb6cab](https://www.github.com/googleapis/nodejs-translate/commit/ecb6cab)) +* **types:** use Metadata types for apiResponse ([#277](https://www.github.com/googleapis/nodejs-translate/issues/277)) ([cf7899f](https://www.github.com/googleapis/nodejs-translate/commit/cf7899f)) + + +### Features + +* support apiEndpoint override ([#285](https://www.github.com/googleapis/nodejs-translate/issues/285)) ([dc8fe12](https://www.github.com/googleapis/nodejs-translate/commit/dc8fe12)) +* support apiEndpoint override in client constructor ([#289](https://www.github.com/googleapis/nodejs-translate/issues/289)) ([35f1229](https://www.github.com/googleapis/nodejs-translate/commit/35f1229)) + +### [4.0.1](https://www.github.com/googleapis/nodejs-translate/compare/v4.0.0...v4.0.1) (2019-05-20) + + +### Bug Fixes + +* **deps:** update dependency @google-cloud/automl to v1 ([#267](https://www.github.com/googleapis/nodejs-translate/issues/267)) ([180d8f6](https://www.github.com/googleapis/nodejs-translate/commit/180d8f6)) + +## [4.0.0](https://www.github.com/googleapis/nodejs-translate/compare/v3.0.1...v4.0.0) (2019-05-13) + + +### Bug Fixes + +* **deps:** update dependency @google-cloud/common to v1 ([#262](https://www.github.com/googleapis/nodejs-translate/issues/262)) ([269018b](https://www.github.com/googleapis/nodejs-translate/commit/269018b)) +* **deps:** update dependency google-gax to v1 ([#263](https://www.github.com/googleapis/nodejs-translate/issues/263)) ([95efe30](https://www.github.com/googleapis/nodejs-translate/commit/95efe30)) +* DEADLINE_EXCEEDED is idempotent ([#264](https://www.github.com/googleapis/nodejs-translate/issues/264)) ([1c222f8](https://www.github.com/googleapis/nodejs-translate/commit/1c222f8)) +* DEADLINE_EXCEEDED is no longer retried ([#259](https://www.github.com/googleapis/nodejs-translate/issues/259)) ([4ea044e](https://www.github.com/googleapis/nodejs-translate/commit/4ea044e)) +* **deps:** update dependency @google-cloud/promisify to v1 ([#253](https://www.github.com/googleapis/nodejs-translate/issues/253)) ([672f6da](https://www.github.com/googleapis/nodejs-translate/commit/672f6da)) +* **deps:** update dependency google-gax to ^0.26.0 ([#248](https://www.github.com/googleapis/nodejs-translate/issues/248)) ([4412bbf](https://www.github.com/googleapis/nodejs-translate/commit/4412bbf)) + + +### Build System + +* upgrade engines field to >=8.10.0 ([#249](https://www.github.com/googleapis/nodejs-translate/issues/249)) ([88ec9e2](https://www.github.com/googleapis/nodejs-translate/commit/88ec9e2)) + + +### BREAKING CHANGES + +* upgrade engines field to >=8.10.0 (#249) + +## v3.0.1 + +04-09-2019 12:19 PDT + +### Fixes +- fix(build): include build/protos in npm package ([#241](https://github.com/googleapis/nodejs-translate/pull/241)) + +### Dependencies +- fix(deps): update dependency @google-cloud/automl to ^0.2.0 ([#236](https://github.com/googleapis/nodejs-translate/pull/236)) +- fix(deps): update dependency arrify to v2 +- fix(deps): update dependency @google-cloud/common to ^0.32.0 + +### Documentation / Samples +- Change region tag to translate_translate_text_with_glossary_beta ([#240](https://github.com/googleapis/nodejs-translate/pull/240)) +- docs(samples): Add samples for translate v3 beta ([#234](https://github.com/googleapis/nodejs-translate/pull/234)) + +### Internal / Testing Changes +- refactor: use execSync for tests ([#237](https://github.com/googleapis/nodejs-translate/pull/237)) + +## v3.0.0 + +BREAKING CHANGE: + +This release introduces the `grpc` dependency. + +In some environments, this will trigger a native compilation. + +### Implementation Changes + +### New Features + +- feat: add version v3beta1 ([#232](https://github.com/googleapis/nodejs-translate/pull/232)) + +### Dependencies + +- chore(deps): update dependency typescript to ~3.4.0 ([#231](https://github.com/googleapis/nodejs-translate/pull/231)) + +### Documentation + +### Internal / Testing Changes + +- chore: publish to npm using wombat ([#227](https://github.com/googleapis/nodejs-translate/pull/227)) +- build: use per-repo npm publish token ([#225](https://github.com/googleapis/nodejs-translate/pull/225)) + +## v2.1.4 + +03-12-2019 12:30 PDT + +This patch release has a few dependency bumps and doc updates. Enjoy! + +### Dependencies +- fix(deps): update dependency @google-cloud/promisify to ^0.4.0 ([#217](https://github.com/googleapis/nodejs-translate/pull/217)) +- fix(deps): update dependency yargs to v13 ([#215](https://github.com/googleapis/nodejs-translate/pull/215)) +- fix(deps): update dependency @google-cloud/common to ^0.31.0 ([#209](https://github.com/googleapis/nodejs-translate/pull/209)) + +### Documentation +- docs: update links in contrib guide ([#218](https://github.com/googleapis/nodejs-translate/pull/218)) +- docs: update contributing path in README ([#212](https://github.com/googleapis/nodejs-translate/pull/212)) +- docs: move CONTRIBUTING.md to root ([#211](https://github.com/googleapis/nodejs-translate/pull/211)) +- docs: add lint/fix example to contributing guide ([#208](https://github.com/googleapis/nodejs-translate/pull/208)) +- docs: brand issue - Translate API => Cloud Translation API ([#196](https://github.com/googleapis/nodejs-translate/pull/196)) + +### Internal / Testing Changes +- build: Add docuploader credentials to node publish jobs ([#222](https://github.com/googleapis/nodejs-translate/pull/222)) +- build: use node10 to run samples-test, system-test etc ([#221](https://github.com/googleapis/nodejs-translate/pull/221)) +- build: update release configuration +- chore(deps): update dependency mocha to v6 ([#219](https://github.com/googleapis/nodejs-translate/pull/219)) +- build: use linkinator for docs test ([#216](https://github.com/googleapis/nodejs-translate/pull/216)) +- build: create docs test npm scripts ([#214](https://github.com/googleapis/nodejs-translate/pull/214)) +- build: test using @grpc/grpc-js in CI ([#213](https://github.com/googleapis/nodejs-translate/pull/213)) +- chore(deps): update dependency eslint-config-prettier to v4 ([#206](https://github.com/googleapis/nodejs-translate/pull/206)) +- build: ignore googleapis.com in doc link check ([#204](https://github.com/googleapis/nodejs-translate/pull/204)) +- build: check broken links in generated docs ([#202](https://github.com/googleapis/nodejs-translate/pull/202)) +- refactor: modernize sample tests ([#199](https://github.com/googleapis/nodejs-translate/pull/199)) +- chore(build): inject yoshi automation key ([#195](https://github.com/googleapis/nodejs-translate/pull/195)) +- chore: update nyc and eslint configs ([#194](https://github.com/googleapis/nodejs-translate/pull/194)) +- chore: fix publish.sh permission +x ([#192](https://github.com/googleapis/nodejs-translate/pull/192)) +- fix(build): fix Kokoro release script ([#191](https://github.com/googleapis/nodejs-translate/pull/191)) +- build: add Kokoro configs for autorelease ([#190](https://github.com/googleapis/nodejs-translate/pull/190)) + +## v2.1.3 + +12-06-2018 17:12 PST + +### Dependencies +- fix(deps): update dependency @google-cloud/common to ^0.27.0 ([#176](https://github.com/googleapis/nodejs-translate/pull/176)) +- chore(deps): update dependency typescript to ~3.2.0 ([#177](https://github.com/googleapis/nodejs-translate/pull/177)) +- chore(deps): update dependency gts to ^0.9.0 ([#170](https://github.com/googleapis/nodejs-translate/pull/170)) +- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 ([#168](https://github.com/googleapis/nodejs-translate/pull/168)) +- chore(deps): update dependency @types/is to v0.0.21 ([#166](https://github.com/googleapis/nodejs-translate/pull/166)) +- chore(deps): update dependency eslint-plugin-node to v8 ([#157](https://github.com/googleapis/nodejs-translate/pull/157)) +- fix(deps): update dependency @google-cloud/common to ^0.26.0 ([#149](https://github.com/googleapis/nodejs-translate/pull/149)) +- chore(deps): update dependency sinon to v7 ([#142](https://github.com/googleapis/nodejs-translate/pull/142)) +- fix(deps): update dependency @google-cloud/translate to v2 ([#137](https://github.com/googleapis/nodejs-translate/pull/137)) +- chore(deps): update dependency eslint-plugin-prettier to v3 ([#139](https://github.com/googleapis/nodejs-translate/pull/139)) +- chore(deps): update dependency typescript to ~3.1.0 ([#136](https://github.com/googleapis/nodejs-translate/pull/136)) + +### Documentation +- fix(docs): place doc comment above the last overload ([#186](https://github.com/googleapis/nodejs-translate/pull/186)) +- docs: update readme badges ([#180](https://github.com/googleapis/nodejs-translate/pull/180)) +- docs(samples): updated samples code to use async await ([#154](https://github.com/googleapis/nodejs-translate/pull/154)) + +### Internal / Testing Changes +- chore: always nyc report before calling codecov ([#185](https://github.com/googleapis/nodejs-translate/pull/185)) +- chore: nyc ignore build/test by default ([#184](https://github.com/googleapis/nodejs-translate/pull/184)) +- chore: update license file ([#182](https://github.com/googleapis/nodejs-translate/pull/182)) +- fix(build): fix system key decryption ([#178](https://github.com/googleapis/nodejs-translate/pull/178)) +- chore: add a synth.metadata +- refactor(samples): convert sample tests from ava to mocha ([#171](https://github.com/googleapis/nodejs-translate/pull/171)) +- chore: update eslintignore config ([#169](https://github.com/googleapis/nodejs-translate/pull/169)) +- chore: drop contributors from multiple places ([#167](https://github.com/googleapis/nodejs-translate/pull/167)) +- chore: use latest npm on Windows ([#165](https://github.com/googleapis/nodejs-translate/pull/165)) +- chore(build): ignore build dir with eslint +- chore: update CircleCI config ([#163](https://github.com/googleapis/nodejs-translate/pull/163)) +- fix: fix the sample tests ([#156](https://github.com/googleapis/nodejs-translate/pull/156)) +- chore: update issue templates ([#155](https://github.com/googleapis/nodejs-translate/pull/155)) +- chore: remove old issue template ([#151](https://github.com/googleapis/nodejs-translate/pull/151)) +- build: run tests on node11 ([#150](https://github.com/googleapis/nodejs-translate/pull/150)) +- chores(build): do not collect sponge.xml from windows builds ([#148](https://github.com/googleapis/nodejs-translate/pull/148)) +- chores(build): run codecov on continuous builds ([#147](https://github.com/googleapis/nodejs-translate/pull/147)) +- chore: update new issue template ([#146](https://github.com/googleapis/nodejs-translate/pull/146)) +- build: fix codecov uploading on Kokoro ([#143](https://github.com/googleapis/nodejs-translate/pull/143)) +- Update kokoro config ([#140](https://github.com/googleapis/nodejs-translate/pull/140)) +- Update CI config ([#135](https://github.com/googleapis/nodejs-translate/pull/135)) +- samples: fixed incorrect end tag ([#134](https://github.com/googleapis/nodejs-translate/pull/134)) +- Update CI config ([#130](https://github.com/googleapis/nodejs-translate/pull/130)) +- Translate Automl samples ([#131](https://github.com/googleapis/nodejs-translate/pull/131)) +- Don't publish sourcemaps ([#132](https://github.com/googleapis/nodejs-translate/pull/132)) +- test: remove appveyor config ([#129](https://github.com/googleapis/nodejs-translate/pull/129)) +- build: update CI configs ([#127](https://github.com/googleapis/nodejs-translate/pull/127)) + +## v2.1.2 + +### Bug fixes +- fix: Improve typescript types ([#124](https://github.com/googleapis/nodejs-translate/pull/124)) + +### Dependencies +- fix(deps): update dependency @google-cloud/common to ^0.25.0 ([#122](https://github.com/googleapis/nodejs-translate/pull/122)) +- fix(deps): update dependency @google-cloud/common to ^0.24.0 ([#117](https://github.com/googleapis/nodejs-translate/pull/117)) + +### Internal / Testing Changes +- Enable prefer-const in the eslint config ([#123](https://github.com/googleapis/nodejs-translate/pull/123)) +- Enable no-var in eslint ([#121](https://github.com/googleapis/nodejs-translate/pull/121)) +- Update CI config ([#118](https://github.com/googleapis/nodejs-translate/pull/118)) +- Enable noImplicitThis in tsconfig ([#115](https://github.com/googleapis/nodejs-translate/pull/115)) + +## v2.1.1 + +### Internal / Testing Changes +- Retry npm install in CI (#113) +- fix: set request module (#112) +- Re-generate library using /synth.py (#111) +- fix: run the linter (#110) +- fix: always run all system-tests (#109) + +## v2.1.0 + +### Implementation Changes +- feat: Use small request dependency (#98) + +### Documentation +- doc: use new import syntax in samples (#100) + +### Internal / Testing Changes +- Re-generate library using /synth.py (#104) +- chore(deps): update dependency nyc to v13 (#103) +- Update the CI config (#102) +- chore: update CircleCI config +- chore(deps): update dependency eslint-config-prettier to v3 (#95) +- chore: run repo tools (#96) + +## v2.0.0 + +**This release has breaking changes**. + +Previous versions of the API would allow for creating new Translate objects directly from the imported module. To provide consistency with es modules, there are no default exports. + +#### Old code +```js +const translate = require('@google-cloud/translate')({ + keyFilename: '...' +}); +``` + +#### New code +```js +const {Translate} = require('@google-cloud/translate'); +const translate = new Translate({ + keyFilename: '...' +}); +``` + +### More Breaking changes +- fix: drop support for node.js 4.x and 9.x (#64) + +### New Features +- feat: convert to TypeScript (#63) + +### Documentation +- docs: fix link (#72) +- docs: fix small typos (#71) + +### Internal / Testing Changes +- fix: add a synth file (#93) +- chore: add better types (#92) +- chore: ignore package-lock.json (#91) +- chore: use promisify and upgrade common (#90) +- chore: update renovate config (#86) +- chore: remove propprop, clean up (#87) +- remove that whitespace (#85) +- chore(deps): update dependency typescript to v3 (#82) +- chore: move mocha options to mocha.opts (#78) +- chore: assert.deelEqual => assert.deepStrictEqual (#81) +- chore: enable linting and arrow functions (#80) +- chore: require node 8 for samples (#79) +- chore(deps): update dependency gts to ^0.8.0 (#73) +- chore(deps): update dependency eslint-plugin-node to v7 (#75) +- fix(deps): update dependency yargs to v12 (#59) +- chore(deps): update dependency sinon to v6.0.1 (#57) +- Configure Renovate (#52) +- refactor: drop repo-tool as an exec wrapper (#56) +- fix: update linking for samples (#54) +- chore(package): update eslint to version 5.0.0 (#53) +- chore: the ultimate fix for repo-tools EPERM (#45) +- chore: update all dependencies (#50) +- fix(package): update @google-cloud/common to version 0.20.0 (#49) +- fix: update all the dependencies (#48) +- Update nyc to the latest version 🚀 (#47) +- chore: timeout for system test (#44) +- chore: test on node10 (#41) +- chore: workaround for repo-tools EPERM (#36) +- chore: setup nighty build in CircleCI (#34) +- Upgrade repo-tools and regenerate scaffolding. (#33) +- Update proxyquire to the latest version 🚀 (#29) +- Update mocha to the latest version 🚀 (#22) +- Linting per prettier@1.9.0. (#21) diff --git a/packages/google-cloud-translate/CODE_OF_CONDUCT.md b/packages/google-cloud-translate/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..2add2547a81 --- /dev/null +++ b/packages/google-cloud-translate/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-translate/CONTRIBUTING.md b/packages/google-cloud-translate/CONTRIBUTING.md new file mode 100644 index 00000000000..cc99e9dc9fa --- /dev/null +++ b/packages/google-cloud-translate/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 Cloud Translation 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=translate.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-translate/LICENSE b/packages/google-cloud-translate/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-translate/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-translate/README.md b/packages/google-cloud-translate/README.md new file mode 100644 index 00000000000..29695d26fd9 --- /dev/null +++ b/packages/google-cloud-translate/README.md @@ -0,0 +1,187 @@ +[//]: # "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 + +# [Cloud Translation: 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/translate.svg)](https://www.npmjs.org/package/@google-cloud/translate) + + + + +Cloud Translation API Client Library 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-translate/CHANGELOG.md). + +* [Cloud Translation Node.js Client API Reference][client-docs] +* [Cloud Translation Documentation][product-docs] +* [github.com/googleapis/google-cloud-node/packages/google-cloud-translate](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-translate) + +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 Cloud Translation 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/translate +``` + + +### Using the client library + +```javascript +/** + * TODO(developer): Uncomment the following line before running the sample. + */ +// const projectId = 'YOUR_PROJECT_ID'; + +// Imports the Google Cloud client library +const {Translate} = require('@google-cloud/translate').v2; + +// Instantiates a client +const translate = new Translate({projectId}); + +async function quickStart() { + // The text to translate + const text = 'Hello, world!'; + + // The target language + const target = 'ru'; + + // Translates some text into Russian + const [translation] = await translate.translate(text, target); + console.log(`Text: ${text}`); + console.log(`Translation: ${translation}`); +} + +quickStart(); + +``` + + + +## 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 | +| --------------------------- | --------------------------------- | ------ | +| Translation_service.batch_translate_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_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-translate/samples/generated/v3/translation_service.batch_translate_document.js,samples/README.md) | +| Translation_service.batch_translate_text | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_text.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.batch_translate_text.js,samples/README.md) | +| Translation_service.create_glossary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.create_glossary.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.create_glossary.js,samples/README.md) | +| Translation_service.delete_glossary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.delete_glossary.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.delete_glossary.js,samples/README.md) | +| Translation_service.detect_language | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.detect_language.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.detect_language.js,samples/README.md) | +| Translation_service.get_glossary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.get_glossary.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.get_glossary.js,samples/README.md) | +| Translation_service.get_supported_languages | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.get_supported_languages.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.get_supported_languages.js,samples/README.md) | +| Translation_service.list_glossaries | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.list_glossaries.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.list_glossaries.js,samples/README.md) | +| Translation_service.translate_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_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-translate/samples/generated/v3/translation_service.translate_document.js,samples/README.md) | +| Translation_service.translate_text | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js) | [![Open in Cloud 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-translate/samples/generated/v3/translation_service.translate_text.js,samples/README.md) | +| Translation_service.batch_translate_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_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-translate/samples/generated/v3beta1/translation_service.batch_translate_document.js,samples/README.md) | +| Translation_service.batch_translate_text | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js,samples/README.md) | +| Translation_service.create_glossary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.create_glossary.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.create_glossary.js,samples/README.md) | +| Translation_service.delete_glossary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.delete_glossary.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.delete_glossary.js,samples/README.md) | +| Translation_service.detect_language | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.detect_language.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.detect_language.js,samples/README.md) | +| Translation_service.get_glossary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_glossary.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.get_glossary.js,samples/README.md) | +| Translation_service.get_supported_languages | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js,samples/README.md) | +| Translation_service.list_glossaries | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.list_glossaries.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.list_glossaries.js,samples/README.md) | +| Translation_service.translate_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_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-translate/samples/generated/v3beta1/translation_service.translate_document.js,samples/README.md) | +| Translation_service.translate_text | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_text.js) | [![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.translate_text.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/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-translate/samples/quickstart.js,samples/README.md) | +| Quickstart.test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/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-translate/samples/test/quickstart.test.js,samples/README.md) | + + + +The [Cloud Translation 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/translate@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/translate/latest +[product-docs]: https://cloud.google.com/translate/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=translate.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-translate/linkinator.config.json b/packages/google-cloud-translate/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/packages/google-cloud-translate/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-translate/owlbot.py b/packages/google-cloud-translate/owlbot.py new file mode 100644 index 00000000000..5aa32009522 --- /dev/null +++ b/packages/google-cloud-translate/owlbot.py @@ -0,0 +1,19 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool.languages.node_mono_repo as node + +node.owlbot_main(relative_dir="packages/google-cloud-translate",templates_excludes=['src/index.ts']) diff --git a/packages/google-cloud-translate/package.json b/packages/google-cloud-translate/package.json new file mode 100644 index 00000000000..0f46768de59 --- /dev/null +++ b/packages/google-cloud-translate/package.json @@ -0,0 +1,84 @@ +{ + "name": "@google-cloud/translate", + "description": "Cloud Translation API Client Library for Node.js", + "version": "7.0.4", + "license": "Apache-2.0", + "author": "Google Inc.", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "directory": "packages/google-cloud-translate", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "files": [ + "build/src", + "build/protos", + "!build/src/**/*.map" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google translate", + "translate" + ], + "scripts": { + "docs": "jsdoc -c .jsdoc.js", + "predocs": "npm run compile", + "lint": "gts check", + "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test", + "system-test": "npm run compile && c8 mocha build/system-test", + "test": "c8 mocha build/test", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "fix": "gts fix", + "prepare": "npm run compile-protos && npm run compile", + "pretest": "npm run compile", + "presystem-test": "npm run compile", + "docs-test": "linkinator docs", + "predocs-test": "npm run docs", + "prelint": "cd samples; npm link ../; npm install", + "clean": "gts clean", + "precompile": "gts clean" + }, + "dependencies": { + "@google-cloud/common": "^4.0.0", + "@google-cloud/promisify": "^2.0.0", + "arrify": "^2.0.0", + "extend": "^3.0.2", + "google-gax": "^3.5.2", + "is-html": "^2.0.0" + }, + "devDependencies": { + "@types/extend": "^3.0.0", + "@types/mocha": "^9.0.0", + "@types/node": "^18.0.0", + "@types/proxyquire": "^1.3.28", + "@types/request": "^2.47.1", + "@types/sinon": "^10.0.0", + "c8": "^7.0.0", + "codecov": "^3.0.2", + "google-auth-library": "^6.0.0", + "gts": "^3.1.0", + "http2spy": "^2.0.0", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.0", + "jsdoc-region-tag": "^2.0.0", + "linkinator": "^4.0.0", + "mocha": "^9.2.2", + "pack-n-play": "^1.0.0-2", + "proxyquire": "^2.0.1", + "sinon": "^14.0.0", + "typescript": "^4.6.4" + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-translate" +} diff --git a/packages/google-cloud-translate/protos/google/cloud/common_resources.proto b/packages/google-cloud-translate/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-translate/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-translate/protos/google/cloud/translate/v3/translation_service.proto b/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto new file mode 100644 index 00000000000..4ea17daddbe --- /dev/null +++ b/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto @@ -0,0 +1,1460 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.translation.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Translate.V3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/translate/v3;translate"; +option java_multiple_files = true; +option java_outer_classname = "TranslationServiceProto"; +option java_package = "com.google.cloud.translate.v3"; +option php_namespace = "Google\\Cloud\\Translate\\V3"; +option ruby_package = "Google::Cloud::Translate::V3"; + +// Proto file for the Cloud Translation API (v3 GA). + +// Provides natural language translation operations. +service TranslationService { + option (google.api.default_host) = "translate.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-translation"; + + // Translates input text and returns translated text. + rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:translateText" + body: "*" + additional_bindings { + post: "/v3/{parent=projects/*}:translateText" + body: "*" + } + }; + option (google.api.method_signature) = + "parent,target_language_code,contents"; + option (google.api.method_signature) = + "parent,model,mime_type,source_language_code,target_language_code,contents"; + } + + // Detects the language of text within a request. + rpc DetectLanguage(DetectLanguageRequest) returns (DetectLanguageResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:detectLanguage" + body: "*" + additional_bindings { + post: "/v3/{parent=projects/*}:detectLanguage" + body: "*" + } + }; + option (google.api.method_signature) = "parent,model,mime_type,content"; + } + + // Returns a list of supported languages for translation. + rpc GetSupportedLanguages(GetSupportedLanguagesRequest) + returns (SupportedLanguages) { + option (google.api.http) = { + get: "/v3/{parent=projects/*/locations/*}/supportedLanguages" + additional_bindings { get: "/v3/{parent=projects/*}/supportedLanguages" } + }; + option (google.api.method_signature) = "parent,model,display_language_code"; + } + + // Translates documents in synchronous mode. + rpc TranslateDocument(TranslateDocumentRequest) + returns (TranslateDocumentResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:translateDocument" + body: "*" + }; + } + + // Translates a large volume of text in asynchronous batch mode. + // This function provides real-time output as the inputs are being processed. + // If caller cancels a request, the partial results (for an input file, it's + // all or nothing) may still be available on the specified output location. + // + // This call returns immediately and you can + // use google.longrunning.Operation.name to poll the status of the call. + rpc BatchTranslateText(BatchTranslateTextRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:batchTranslateText" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateResponse" + metadata_type: "BatchTranslateMetadata" + }; + } + + // Translates a large volume of document in asynchronous batch mode. + // This function provides real-time output as the inputs are being processed. + // If caller cancels a request, the partial results (for an input file, it's + // all or nothing) may still be available on the specified output location. + // + // This call returns immediately and you can use + // google.longrunning.Operation.name to poll the status of the call. + rpc BatchTranslateDocument(BatchTranslateDocumentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:batchTranslateDocument" + body: "*" + }; + option (google.api.method_signature) = + "parent,source_language_code,target_language_codes,input_configs,output_config"; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateDocumentResponse" + metadata_type: "BatchTranslateDocumentMetadata" + }; + } + + // Creates a glossary and returns the long-running operation. Returns + // NOT_FOUND, if the project doesn't exist. + rpc CreateGlossary(CreateGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}/glossaries" + body: "glossary" + }; + option (google.api.method_signature) = "parent,glossary"; + option (google.longrunning.operation_info) = { + response_type: "Glossary" + metadata_type: "CreateGlossaryMetadata" + }; + } + + // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + // exist. + rpc ListGlossaries(ListGlossariesRequest) returns (ListGlossariesResponse) { + option (google.api.http) = { + get: "/v3/{parent=projects/*/locations/*}/glossaries" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + // exist. + rpc GetGlossary(GetGlossaryRequest) returns (Glossary) { + option (google.api.http) = { + get: "/v3/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a glossary, or cancels glossary construction + // if the glossary isn't created yet. + // Returns NOT_FOUND, if the glossary doesn't exist. + rpc DeleteGlossary(DeleteGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeleteGlossaryResponse" + metadata_type: "DeleteGlossaryMetadata" + }; + } +} + +// Configures which glossary should be used for a specific target language, +// and defines options for applying that glossary. +message TranslateTextGlossaryConfig { + // Required. The `glossary` to be applied for this translation. + // + // The format depends on glossary: + // + // - User provided custom glossary: + // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + string glossary = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates match is case-insensitive. + // Default value is false if missing. + bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for synchronous translation. +message TranslateTextRequest { + // Required. The content of the input in string format. + // We recommend the total content be less than 30k codepoints. The max length + // of this field is 1024. + // Use BatchTranslateText for larger text. + repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The BCP-47 language code of the input text if + // known, for example, "en-US" or "sr-Latn". Supported language codes are + // listed in Language Support. If the source language isn't specified, the API + // attempts to identify the source language automatically and returns the + // source language within the response. + string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The BCP-47 language code to use for translation of the input + // text, set to one of the language codes listed in Language Support. + string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for requests using AutoML models or + // custom glossaries. + // + // Models and glossaries must be within the same region (have same + // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The `model` type requested for this translation. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // For global (non-regionalized) requests, use `location-id` `global`. + // For example, + // `projects/{project-number-or-id}/locations/global/models/general/nmt`. + // + // If not provided, the default Google model (NMT) will be used. + string model = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossary to be applied. The glossary must be + // within the same region (have the same location-id) as the model, otherwise + // an INVALID_ARGUMENT (400) error is returned. + TranslateTextGlossaryConfig glossary_config = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. + map labels = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +message TranslateTextResponse { + // Text translation responses with no glossary applied. + // This field has the same length as + // [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + repeated Translation translations = 1; + + // Text translation responses if a glossary is provided in the request. + // This can be the same as + // [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + // if no terms apply. This field has the same length as + // [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + repeated Translation glossary_translations = 3; +} + +// A single translation response. +message Translation { + // Text translated into the target language. + // If an error occurs during translation, this field might be excluded from + // the response. + string translated_text = 1; + + // Only present when `model` is present in the request. + // `model` here is normalized to have project number. + // + // For example: + // If the `model` requested in TranslationTextRequest is + // `projects/{project-id}/locations/{location-id}/models/general/nmt` then + // `model` here would be normalized to + // `projects/{project-number}/locations/{location-id}/models/general/nmt`. + string model = 2; + + // The BCP-47 language code of source text in the initial request, detected + // automatically, if no source language was passed within the initial + // request. If the source language was passed, auto-detection of the language + // does not occur and this field is empty. + string detected_language_code = 4; + + // The `glossary_config` used for this translation. + TranslateTextGlossaryConfig glossary_config = 3; +} + +// The request message for language detection. +message DetectLanguageRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}` or + // `projects/{project-number-or-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Only models within the same region (has same location-id) can be used. + // Otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language detection model to be used. + // + // Format: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + // + // Only one language detection model is currently supported: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + // + // If not specified, the default model is used. + string model = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The source of the document from which to detect the language. + oneof source { + // The content of the input stored as a string. + string content = 1; + } + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for language detection. +message DetectedLanguage { + // The BCP-47 language code of source content in the request, detected + // automatically. + string language_code = 1; + + // The confidence of the detection result for this language. + float confidence = 2; +} + +// The response message for language detection. +message DetectLanguageResponse { + // The most probable language detected by the Translation API. For each + // request, the Translation API will always return only one result. + repeated DetectedLanguage languages = 1; +} + +// The request message for discovering supported languages. +message GetSupportedLanguagesRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for AutoML models. + // + // Only models within the same region (have same location-id) can be used, + // otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language to use to return localized, human readable names + // of supported languages. If missing, then display names are not returned + // in a response. + string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Get supported languages of this model. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // Returns languages supported by the specified model. + // If missing, we get supported languages of Google general NMT model. + string model = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for discovering supported languages. +message SupportedLanguages { + // A list of supported language responses. This list contains an entry + // for each language the Translation API supports. + repeated SupportedLanguage languages = 1; +} + +// A single supported language response corresponds to information related +// to one supported language. +message SupportedLanguage { + // Supported language code, generally consisting of its ISO 639-1 + // identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + // including language and region identifiers are returned (for example, + // 'zh-TW' and 'zh-CN') + string language_code = 1; + + // Human readable name of the language localized in the display language + // specified in the request. + string display_name = 2; + + // Can be used as source language. + bool support_source = 3; + + // Can be used as target language. + bool support_target = 4; +} + +// The Google Cloud Storage location for the input content. +message GcsSource { + // Required. Source data URI. For example, `gs://my_bucket/my_object`. + string input_uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Input configuration for BatchTranslateText request. +message InputConfig { + // Optional. Can be "text/plain" or "text/html". + // For `.tsv`, "text/html" is used if mime_type is missing. + // For `.html`, this field must be "text/html" or empty. + // For `.txt`, this field must be "text/plain" or empty. + string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location for the source input. + // This can be a single file (for example, + // `gs://translation-test/input.tsv`) or a wildcard (for example, + // `gs://translation-test/*`). If a file extension is `.tsv`, it can + // contain either one or two columns. The first column (optional) is the id + // of the text request. If the first column is missing, we use the row + // number (0-based) from the input file as the ID in the output file. The + // second column is the actual text to be + // translated. We recommend each row be <= 10K Unicode codepoints, + // otherwise an error might be returned. + // Note that the input tsv must be RFC 4180 compliant. + // + // You could use https://github.com/Clever/csvlint to check potential + // formatting errors in your tsv file. + // csvlint --delimiter='\t' your_input_file.tsv + // + // The other supported file extensions are `.txt` or `.html`, which is + // treated as a single large chunk of text. + GcsSource gcs_source = 2; + } +} + +// The Google Cloud Storage location for the output content. +message GcsDestination { + // Required. The bucket used in 'output_uri_prefix' must exist and there must + // be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + // "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + // batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + // is returned. + string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Output configuration for BatchTranslateText request. +message OutputConfig { + // Required. The destination of output. + oneof destination { + // Google Cloud Storage destination for output content. + // For every single input file (for example, gs://a/b/c.[extension]), we + // generate at most 2 * n output files. (n is the # of target_language_codes + // in the BatchTranslateTextRequest). + // + // Output files (tsv) generated are compliant with RFC 4180 except that + // record delimiters are '\n' instead of '\r\n'. We don't provide any way to + // change record delimiters. + // + // While the input files are being processed, we write/update an index file + // 'index.csv' under 'output_uri_prefix' (for example, + // gs://translation-test/index.csv) The index file is generated/updated as + // new files are being translated. The format is: + // + // input_file,target_language_code,translations_file,errors_file, + // glossary_translations_file,glossary_errors_file + // + // input_file is one file we matched using gcs_source.input_uri. + // target_language_code is provided in the request. + // translations_file contains the translations. (details provided below) + // errors_file contains the errors during processing of the file. (details + // below). Both translations_file and errors_file could be empty + // strings if we have no content to output. + // glossary_translations_file and glossary_errors_file are always empty + // strings if the input_file is tsv. They could also be empty if we have no + // content to output. + // + // Once a row is present in index.csv, the input/output matching never + // changes. Callers should also expect all the content in input_file are + // processed and ready to be consumed (that is, no partial output file is + // written). + // + // Since index.csv will be keeping updated during the process, please make + // sure there is no custom retention policy applied on the output bucket + // that may avoid file updating. + // (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + // + // The format of translations_file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_translations.[extension] + // + // If the input file extension is tsv, the output has the following + // columns: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: translation without applying a glossary. Empty string if there + // is an error. + // Column 4 (only present if a glossary is provided in the request): + // translation after applying the glossary. Empty string if there is an + // error applying the glossary. Could be same string as column 3 if there is + // no glossary applied. + // + // If input file extension is a txt or html, the translation is directly + // written to the output file. If glossary is requested, a separate + // glossary_translations_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] + // + // The format of errors file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_errors.[extension] + // + // If the input file extension is tsv, errors_file contains the following: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: Error detail for the translation. Could be empty. + // Column 4 (only present if a glossary is provided in the request): + // Error when applying the glossary. + // + // If the input file extension is txt or html, glossary_error_file will be + // generated that contains error details. glossary_error_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] + GcsDestination gcs_destination = 1; + } +} + +// A document translation request input config. +message DocumentInputConfig { + // Specifies the source for the document's content. + // The input file size should be <= 20MB for + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + // The input file size should be <= 20MB and the maximum page limit is 20 for + // - application/pdf + oneof source { + // Document's content represented as a stream of bytes. + bytes content = 1; + + // Google Cloud Storage location. This must be a single file. + // For example: gs://example_bucket/example_file.pdf + GcsSource gcs_source = 2; + } + + // Specifies the input document's mime_type. + // + // If not specified it will be determined using the file extension for + // gcs_source provided files. For a file provided through bytes content the + // mime_type must be provided. + // Currently supported mime types are: + // - application/pdf + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + string mime_type = 4; +} + +// A document translation request output config. +message DocumentOutputConfig { + // A URI destination for the translated document. + // It is optional to provide a destination. If provided the results from + // TranslateDocument will be stored in the destination. + // Whether a destination is provided or not, the translated documents will be + // returned within TranslateDocumentResponse.document_translation and + // TranslateDocumentResponse.glossary_document_translation. + oneof destination { + // Optional. Google Cloud Storage destination for the translation output, + // e.g., `gs://my_bucket/my_directory/`. + // + // The destination directory provided does not have to be empty, but the + // bucket must exist. If a file with the same name as the output file + // already exists in the destination an error will be returned. + // + // For a DocumentInputConfig.contents provided document, the output file + // will have the name "output_[trg]_translations.[ext]", where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // + // For a DocumentInputConfig.gcs_uri provided document, the output file will + // have a name according to its URI. For example: an input file with URI: + // "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name + // "my_bucket" will have an output URI: + // "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // + // If the document was directly provided through the request, then the + // output document will have the format: + // "gs://my_bucket/translated_document_[trg]_translations.[ext], where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // If a glossary was provided, then the output URI for the glossary + // translation will be equal to the default output URI but have + // `glossary_translations` instead of `translations`. For the previous + // example, its glossary URI would be: + // "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". + // + // Thus the max number of output files will be 2 (Translated document, + // Glossary translated document). + // + // Callers should expect no partial outputs. If there is any error during + // document translation, no output will be stored in the Cloud Storage + // bucket. + GcsDestination gcs_destination = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Specifies the translated document's mime_type. + // If not specified, the translated file's mime type will be the same as the + // input file's mime type. + // Currently only support the output mime type to be the same as input mime + // type. + // - application/pdf + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A document translation request. +message TranslateDocumentRequest { + // Required. Location to make a regional call. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for requests using AutoML models or custom + // glossaries. + // + // Models and glossaries must be within the same region (have the same + // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The BCP-47 language code of the input document if known, for + // example, "en-US" or "sr-Latn". Supported language codes are listed in + // Language Support. If the source language isn't specified, the API attempts + // to identify the source language automatically and returns the source + // language within the response. Source language must be specified if the + // request contains a glossary or a custom model. + string source_language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The BCP-47 language code to use for translation of the input + // document, set to one of the language codes listed in Language Support. + string target_language_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input configurations. + DocumentInputConfig document_input_config = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Output configurations. + // Defines if the output file should be stored within Cloud Storage as well + // as the desired output format. If not provided the translated file will + // only be returned through a byte-stream and its output mime type will be + // the same as the input file's mime type. + DocumentOutputConfig document_output_config = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The `model` type requested for this translation. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // If not provided, the default Google model (NMT) will be used for + // translation. + string model = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossary to be applied. The glossary must be within the same + // region (have the same location-id) as the model, otherwise an + // INVALID_ARGUMENT (400) error is returned. + TranslateTextGlossaryConfig glossary_config = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters (Unicode + // codepoints), can only contain lowercase letters, numeric characters, + // underscores and dashes. International characters are allowed. Label values + // are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. + map labels = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// A translated document message. +message DocumentTranslation { + // The array of translated documents. It is expected to be size 1 for now. We + // may produce multiple translated documents in the future for other type of + // file formats. + repeated bytes byte_stream_outputs = 1; + + // The translated document's mime type. + string mime_type = 2; + + // The detected language for the input document. + // If the user did not provide the source language for the input document, + // this field will have the language code automatically detected. If the + // source language was passed, auto-detection of the language does not occur + // and this field is empty. + string detected_language_code = 3; +} + +// A translated document response message. +message TranslateDocumentResponse { + // Translated document. + DocumentTranslation document_translation = 1; + + // The document's translation output if a glossary is provided in the request. + // This can be the same as [TranslateDocumentResponse.document_translation] + // if no glossary terms apply. + DocumentTranslation glossary_document_translation = 2; + + // Only present when 'model' is present in the request. + // 'model' is normalized to have a project number. + // + // For example: + // If the 'model' field in TranslateDocumentRequest is: + // `projects/{project-id}/locations/{location-id}/models/general/nmt` then + // `model` here would be normalized to + // `projects/{project-number}/locations/{location-id}/models/general/nmt`. + string model = 3; + + // The `glossary_config` used for this translation. + TranslateTextGlossaryConfig glossary_config = 4; +} + +// The batch translation request. +message BatchTranslateTextRequest { + // Required. Location to make a call. Must refer to a caller's project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // The `global` location is not supported for batch translation. + // + // Only AutoML Translation models or glossaries within the same region (have + // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + // error is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Source language code. + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specify up to 10 language codes here. + repeated string target_language_codes = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The models to use for translation. Map's key is target language + // code. Map's value is model name. Value can be a built-in general model, + // or an AutoML Translation model. + // + // The value format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // If the map is empty or a specific model is + // not requested for a language pair, then default google model (nmt) is used. + map models = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Input configurations. + // The total number of files matched should be <= 100. + // The total content size should be <= 100M Unicode codepoints. + // The files must use UTF-8 encoding. + repeated InputConfig input_configs = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Output configuration. + // If 2 input configs match to the same file (that is, same input path), + // we don't generate output for duplicate inputs. + OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Glossaries to be applied for translation. + // It's keyed by target language code. + map glossaries = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// State metadata for the batch translation operation. +message BatchTranslateMetadata { + // State of the job. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The batch is processed, and at least one item was successfully + // processed. + SUCCEEDED = 2; + + // The batch is done and no item was successfully processed. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The batch is done after the user has called the + // longrunning.Operations.CancelOperation. Any records processed before the + // cancel command are output as specified in the request. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // Number of successfully translated characters so far (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process so far (Unicode + // codepoints). + int64 failed_characters = 3; + + // Total number of characters (Unicode codepoints). + // This is the total number of codepoints from input files times the number of + // target languages and appears here shortly after the call is submitted. + int64 total_characters = 4; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 5; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by BatchTranslateText if at least one sentence is translated +// successfully. +message BatchTranslateResponse { + // Total number of characters (Unicode codepoints). + int64 total_characters = 1; + + // Number of successfully translated characters (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process (Unicode codepoints). + int64 failed_characters = 3; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 4; + + // The time when the operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 5; +} + +// Input configuration for glossaries. +message GlossaryInputConfig { + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location of glossary data. + // File format is determined based on the filename extension. API returns + // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + // formats. Wildcards are not allowed. This must be a single file in one of + // the following formats: + // + // For unidirectional glossaries: + // + // - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. + // The first column is source text. The second column is target text. + // The file must not contain headers. That is, the first row is data, not + // column names. + // + // - TMX (`.tmx`): TMX file with parallel data defining source/target term + // pairs. + // + // For equivalent term sets glossaries: + // + // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + // in multiple languages. See documentation for more information - + // [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + GcsSource gcs_source = 1; + } +} + +// Represents a glossary built from user provided data. +message Glossary { + option (google.api.resource) = { + type: "translate.googleapis.com/Glossary" + pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" + }; + + // Used with unidirectional glossaries. + message LanguageCodePair { + // Required. The BCP-47 language code of the input text, for example, + // "en-US". Expected to be an exact match for GlossaryTerm.language_code. + string source_language_code = 1; + + // Required. The BCP-47 language code for translation output, for example, + // "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + string target_language_code = 2; + } + + // Used with equivalent term set glossaries. + message LanguageCodesSet { + // The BCP-47 language code(s) for terms defined in the glossary. + // All entries are unique. The list contains at least two entries. + // Expected to be an exact match for GlossaryTerm.language_code. + repeated string language_codes = 1; + } + + // Required. The resource name of the glossary. Glossary names have the form + // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Languages supported by the glossary. + oneof languages { + // Used with unidirectional glossaries. + LanguageCodePair language_pair = 3; + + // Used with equivalent term set glossaries. + LanguageCodesSet language_codes_set = 4; + } + + // Required. Provides examples to build the glossary from. + // Total glossary must not exceed 10M Unicode codepoints. + GlossaryInputConfig input_config = 5; + + // Output only. The number of entries defined in the glossary. + int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When CreateGlossary was called. + google.protobuf.Timestamp submit_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the glossary creation was finished. + google.protobuf.Timestamp end_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for CreateGlossary. +message CreateGlossaryRequest { + // Required. The project name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The glossary to create. + Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for GetGlossary. +message GetGlossaryRequest { + // Required. The name of the glossary to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for DeleteGlossary. +message DeleteGlossaryRequest { + // Required. The name of the glossary to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for ListGlossaries. +message ListGlossariesRequest { + // Required. The name of the project from which to list all of the glossaries. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Requested page size. The server may return fewer glossaries than + // requested. If unspecified, the server picks an appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + // Typically, this is the value of [ListGlossariesResponse.next_page_token] + // returned from the previous call to `ListGlossaries` method. + // The first page is returned if `page_token`is empty or missing. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter specifying constraints of a list operation. + // Specify the constraint by the format of "key=value", where key must be + // "src" or "tgt", and the value must be a valid language code. + // For multiple restrictions, concatenate them by "AND" (uppercase only), + // such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + // here, which means using 'en-US' and 'en' can lead to different results, + // which depends on the language code you used when you create the glossary. + // For the unidirectional glossaries, the "src" and "tgt" add restrictions + // on the source and target language code separately. + // For the equivalent term set glossaries, the "src" and/or "tgt" add + // restrictions on the term set. + // For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + // glossaries which exactly match the source language code as "en-US" and the + // target language code "zh-CN", but all equivalent term set glossaries which + // contain "en-US" and "zh-CN" in their language set will be picked. + // If missing, no filtering is performed. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListGlossaries. +message ListGlossariesResponse { + // The list of glossaries for a project. + repeated Glossary glossaries = 1; + + // A token to retrieve a page of results. Pass this value in the + // [ListGlossariesRequest.page_token] field in the subsequent call to + // `ListGlossaries` method to retrieve the next page of results. + string next_page_token = 2; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by CreateGlossary. +message CreateGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully created. + SUCCEEDED = 2; + + // Failed to create the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary creation request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being created. + string name = 1; + + // The current state of the glossary creation operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by DeleteGlossary. +message DeleteGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully deleted. + SUCCEEDED = 2; + + // Failed to delete the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary deletion request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being deleted. + string name = 1; + + // The current state of the glossary deletion operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by DeleteGlossary. +message DeleteGlossaryResponse { + // The name of the deleted glossary. + string name = 1; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 2; + + // The time when the glossary deletion is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 3; +} + +// The BatchTranslateDocument request. +message BatchTranslateDocumentRequest { + // Required. Location to make a regional call. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // The `global` location is not supported for batch translation. + // + // Only AutoML Translation models or glossaries within the same region (have + // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + // error is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The BCP-47 language code of the input document if known, for + // example, "en-US" or "sr-Latn". Supported language codes are listed in + // Language Support (https://cloud.google.com/translate/docs/languages). + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The BCP-47 language code to use for translation of the input + // document. Specify up to 10 language codes here. + repeated string target_language_codes = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Input configurations. + // The total number of files matched should be <= 100. + // The total content size to translate should be <= 100M Unicode codepoints. + // The files must use UTF-8 encoding. + repeated BatchDocumentInputConfig input_configs = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Output configuration. + // If 2 input configs match to the same file (that is, same input path), + // we don't generate output for duplicate inputs. + BatchDocumentOutputConfig output_config = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The models to use for translation. Map's key is target language + // code. Map's value is the model name. Value can be a built-in general model, + // or an AutoML Translation model. + // + // The value format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // If the map is empty or a specific model is + // not requested for a language pair, then default google model (nmt) is used. + map models = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossaries to be applied. It's keyed by target language code. + map glossaries = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. File format conversion map to be applied to all input files. + // Map's key is the original mime_type. Map's value is the target mime_type of + // translated documents. + // + // Supported file format conversion includes: + // - `application/pdf` to + // `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + // + // If nothing specified, output files will be in the same format as the + // original file. + map format_conversions = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Input configuration for BatchTranslateDocument request. +message BatchDocumentInputConfig { + // Specify the input. + oneof source { + // Google Cloud Storage location for the source input. + // This can be a single file (for example, + // `gs://translation-test/input.docx`) or a wildcard (for example, + // `gs://translation-test/*`). + // + // File mime type is determined based on extension. Supported mime type + // includes: + // - `pdf`, application/pdf + // - `docx`, + // application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - `pptx`, + // application/vnd.openxmlformats-officedocument.presentationml.presentation + // - `xlsx`, + // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + // + // The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + // The max file size to support for `.pdf` is 1GB and the max page limit is + // 1000 pages. + // The max file size to support for all input documents is 1GB. + GcsSource gcs_source = 1; + } +} + +// Output configuration for BatchTranslateDocument request. +message BatchDocumentOutputConfig { + // The destination of output. The destination directory provided must exist + // and be empty. + oneof destination { + // Google Cloud Storage destination for output content. + // For every single input document (for example, gs://a/b/c.[extension]), we + // generate at most 2 * n output files. (n is the # of target_language_codes + // in the BatchTranslateDocumentRequest). + // + // While the input documents are being processed, we write/update an index + // file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + // gs://translation_output/index.csv) The index file is generated/updated as + // new files are being translated. The format is: + // + // input_document,target_language_code,translation_output,error_output, + // glossary_translation_output,glossary_error_output + // + // `input_document` is one file we matched using gcs_source.input_uri. + // `target_language_code` is provided in the request. + // `translation_output` contains the translations. (details provided below) + // `error_output` contains the error message during processing of the file. + // Both translations_file and errors_file could be empty strings if we have + // no content to output. + // `glossary_translation_output` and `glossary_error_output` are the + // translated output/error when we apply glossaries. They could also be + // empty if we have no content to output. + // + // Once a row is present in index.csv, the input/output matching never + // changes. Callers should also expect all the content in input_file are + // processed and ready to be consumed (that is, no partial output file is + // written). + // + // Since index.csv will be keeping updated during the process, please make + // sure there is no custom retention policy applied on the output bucket + // that may avoid file updating. + // (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + // + // The naming format of translation output files follows (for target + // language code [trg]): `translation_output`: + // gs://translation_output/a_b_c_[trg]_translation.[extension] + // `glossary_translation_output`: + // gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The + // output document will maintain the same file format as the input document. + // + // The naming format of error output files follows (for target language code + // [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt + // `glossary_error_output`: + // gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error + // output is a txt file containing error details. + GcsDestination gcs_destination = 1; + } +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by BatchTranslateDocument if at least one document is +// translated successfully. +message BatchTranslateDocumentResponse { + // Total number of pages to translate in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 total_pages = 1; + + // Number of successfully translated pages in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 translated_pages = 2; + + // Number of pages that failed to process in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 failed_pages = 3; + + // Number of billable pages in documents with clear page definition (such as + // PDF, DOCX, PPTX) + int64 total_billable_pages = 4; + + // Total number of characters (Unicode codepoints) in all documents. + int64 total_characters = 5; + + // Number of successfully translated characters (Unicode codepoints) in all + // documents. + int64 translated_characters = 6; + + // Number of characters that have failed to process (Unicode codepoints) in + // all documents. + int64 failed_characters = 7; + + // Number of billable characters (Unicode codepoints) in documents without + // clear page definition, such as XLSX. + int64 total_billable_characters = 8; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 9; + + // The time when the operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 10; +} + +// State metadata for the batch translation operation. +message BatchTranslateDocumentMetadata { + // State of the job. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The batch is processed, and at least one item was successfully processed. + SUCCEEDED = 2; + + // The batch is done and no item was successfully processed. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The batch is done after the user has called the + // longrunning.Operations.CancelOperation. Any records processed before the + // cancel command are output as specified in the request. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // Total number of pages to translate in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 total_pages = 2; + + // Number of successfully translated pages in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 translated_pages = 3; + + // Number of pages that failed to process in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 failed_pages = 4; + + // Number of billable pages in documents with clear page definition (such as + // PDF, DOCX, PPTX) so far. + int64 total_billable_pages = 5; + + // Total number of characters (Unicode codepoints) in all documents so far. + int64 total_characters = 6; + + // Number of successfully translated characters (Unicode codepoints) in all + // documents so far. + int64 translated_characters = 7; + + // Number of characters that have failed to process (Unicode codepoints) in + // all documents so far. + int64 failed_characters = 8; + + // Number of billable characters (Unicode codepoints) in documents without + // clear page definition (such as XLSX) so far. + int64 total_billable_characters = 9; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 10; +} diff --git a/packages/google-cloud-translate/protos/google/cloud/translate/v3beta1/translation_service.proto b/packages/google-cloud-translate/protos/google/cloud/translate/v3beta1/translation_service.proto new file mode 100644 index 00000000000..05ad079fda9 --- /dev/null +++ b/packages/google-cloud-translate/protos/google/cloud/translate/v3beta1/translation_service.proto @@ -0,0 +1,1449 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.translation.v3beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Translate.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/translate/v3beta1;translate"; +option java_multiple_files = true; +option java_outer_classname = "TranslationServiceProto"; +option java_package = "com.google.cloud.translate.v3beta1"; +option php_namespace = "Google\\Cloud\\Translate\\V3beta1"; +option ruby_package = "Google::Cloud::Translate::V3beta1"; + +// Proto file for the Cloud Translation API (v3beta1). + +// Provides natural language translation operations. +service TranslationService { + option (google.api.default_host) = "translate.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-translation"; + + // Translates input text and returns translated text. + rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*}:translateText" + body: "*" + additional_bindings { + post: "/v3beta1/{parent=projects/*}:translateText" + body: "*" + } + }; + } + + // Detects the language of text within a request. + rpc DetectLanguage(DetectLanguageRequest) returns (DetectLanguageResponse) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*}:detectLanguage" + body: "*" + additional_bindings { + post: "/v3beta1/{parent=projects/*}:detectLanguage" + body: "*" + } + }; + option (google.api.method_signature) = "parent,model,mime_type"; + } + + // Returns a list of supported languages for translation. + rpc GetSupportedLanguages(GetSupportedLanguagesRequest) + returns (SupportedLanguages) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*}/supportedLanguages" + additional_bindings { + get: "/v3beta1/{parent=projects/*}/supportedLanguages" + } + }; + option (google.api.method_signature) = "parent,display_language_code,model"; + } + + // Translates documents in synchronous mode. + rpc TranslateDocument(TranslateDocumentRequest) + returns (TranslateDocumentResponse) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*}:translateDocument" + body: "*" + }; + } + + // Translates a large volume of text in asynchronous batch mode. + // This function provides real-time output as the inputs are being processed. + // If caller cancels a request, the partial results (for an input file, it's + // all or nothing) may still be available on the specified output location. + // + // This call returns immediately and you can + // use google.longrunning.Operation.name to poll the status of the call. + rpc BatchTranslateText(BatchTranslateTextRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*}:batchTranslateText" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateResponse" + metadata_type: "BatchTranslateMetadata" + }; + } + + // Translates a large volume of documents in asynchronous batch mode. + // This function provides real-time output as the inputs are being processed. + // If caller cancels a request, the partial results (for an input file, it's + // all or nothing) may still be available on the specified output location. + // + // This call returns immediately and you can use + // google.longrunning.Operation.name to poll the status of the call. + rpc BatchTranslateDocument(BatchTranslateDocumentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*}:batchTranslateDocument" + body: "*" + }; + option (google.api.method_signature) = + "parent,source_language_code,target_language_codes,input_configs,output_config"; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateDocumentResponse" + metadata_type: "BatchTranslateDocumentMetadata" + }; + } + + // Creates a glossary and returns the long-running operation. Returns + // NOT_FOUND, if the project doesn't exist. + rpc CreateGlossary(CreateGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*}/glossaries" + body: "glossary" + }; + option (google.api.method_signature) = "parent,glossary"; + option (google.longrunning.operation_info) = { + response_type: "Glossary" + metadata_type: "CreateGlossaryMetadata" + }; + } + + // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + // exist. + rpc ListGlossaries(ListGlossariesRequest) returns (ListGlossariesResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*}/glossaries" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + // exist. + rpc GetGlossary(GetGlossaryRequest) returns (Glossary) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a glossary, or cancels glossary construction + // if the glossary isn't created yet. + // Returns NOT_FOUND, if the glossary doesn't exist. + rpc DeleteGlossary(DeleteGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeleteGlossaryResponse" + metadata_type: "DeleteGlossaryMetadata" + }; + } +} + +// Configures which glossary should be used for a specific target language, +// and defines options for applying that glossary. +message TranslateTextGlossaryConfig { + // Required. Specifies the glossary used for this translation. Use + // this format: projects/*/locations/*/glossaries/* + string glossary = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates match is case-insensitive. + // Default value is false if missing. + bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for synchronous translation. +message TranslateTextRequest { + // Required. The content of the input in string format. + // We recommend the total content be less than 30k codepoints. The max length + // of this field is 1024. + // Use BatchTranslateText for larger text. + repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The BCP-47 language code of the input text if + // known, for example, "en-US" or "sr-Latn". Supported language codes are + // listed in Language Support. If the source language isn't specified, the API + // attempts to identify the source language automatically and returns the + // source language within the response. + string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The BCP-47 language code to use for translation of the input + // text, set to one of the language codes listed in Language Support. + string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for requests using AutoML models or + // custom glossaries. + // + // Models and glossaries must be within the same region (have same + // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The `model` type requested for this translation. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // For global (non-regionalized) requests, use `location-id` `global`. + // For example, + // `projects/{project-number-or-id}/locations/global/models/general/nmt`. + // + // If not provided, the default Google model (NMT) will be used + string model = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossary to be applied. The glossary must be + // within the same region (have the same location-id) as the model, otherwise + // an INVALID_ARGUMENT (400) error is returned. + TranslateTextGlossaryConfig glossary_config = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +message TranslateTextResponse { + // Text translation responses with no glossary applied. + // This field has the same length as + // [`contents`][google.cloud.translation.v3beta1.TranslateTextRequest.contents]. + repeated Translation translations = 1; + + // Text translation responses if a glossary is provided in the request. + // This can be the same as + // [`translations`][google.cloud.translation.v3beta1.TranslateTextResponse.translations] + // if no terms apply. This field has the same length as + // [`contents`][google.cloud.translation.v3beta1.TranslateTextRequest.contents]. + repeated Translation glossary_translations = 3; +} + +// A single translation response. +message Translation { + // Text translated into the target language. + // If an error occurs during translation, this field might be excluded from + // the response. + string translated_text = 1; + + // Only present when `model` is present in the request. + // `model` here is normalized to have project number. + // + // For example: + // If the `model` requested in TranslationTextRequest is + // `projects/{project-id}/locations/{location-id}/models/general/nmt` then + // `model` here would be normalized to + // `projects/{project-number}/locations/{location-id}/models/general/nmt`. + string model = 2; + + // The BCP-47 language code of source text in the initial request, detected + // automatically, if no source language was passed within the initial + // request. If the source language was passed, auto-detection of the language + // does not occur and this field is empty. + string detected_language_code = 4; + + // The `glossary_config` used for this translation. + TranslateTextGlossaryConfig glossary_config = 3; +} + +// The request message for language detection. +message DetectLanguageRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}` or + // `projects/{project-number-or-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Only models within the same region (has same location-id) can be used. + // Otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language detection model to be used. + // + // Format: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + // + // Only one language detection model is currently supported: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + // + // If not specified, the default model is used. + string model = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The source of the document from which to detect the language. + oneof source { + // The content of the input stored as a string. + string content = 1; + } + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for language detection. +message DetectedLanguage { + // The BCP-47 language code of source content in the request, detected + // automatically. + string language_code = 1; + + // The confidence of the detection result for this language. + float confidence = 2; +} + +// The response message for language detection. +message DetectLanguageResponse { + // A list of detected languages sorted by detection confidence in descending + // order. The most probable language first. + repeated DetectedLanguage languages = 1; +} + +// The request message for discovering supported languages. +message GetSupportedLanguagesRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for AutoML models. + // + // Only models within the same region (have same location-id) can be used, + // otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language to use to return localized, human readable names + // of supported languages. If missing, then display names are not returned + // in a response. + string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Get supported languages of this model. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // Returns languages supported by the specified model. + // If missing, we get supported languages of Google general NMT model. + string model = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for discovering supported languages. +message SupportedLanguages { + // A list of supported language responses. This list contains an entry + // for each language the Translation API supports. + repeated SupportedLanguage languages = 1; +} + +// A single supported language response corresponds to information related +// to one supported language. +message SupportedLanguage { + // Supported language code, generally consisting of its ISO 639-1 + // identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + // including language and region identifiers are returned (for example, + // 'zh-TW' and 'zh-CN') + string language_code = 1; + + // Human readable name of the language localized in the display language + // specified in the request. + string display_name = 2; + + // Can be used as source language. + bool support_source = 3; + + // Can be used as target language. + bool support_target = 4; +} + +// The Google Cloud Storage location for the input content. +message GcsSource { + // Required. Source data URI. For example, `gs://my_bucket/my_object`. + string input_uri = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Input configuration for BatchTranslateText request. +message InputConfig { + // Optional. Can be "text/plain" or "text/html". + // For `.tsv`, "text/html" is used if mime_type is missing. + // For `.html`, this field must be "text/html" or empty. + // For `.txt`, this field must be "text/plain" or empty. + string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location for the source input. + // This can be a single file (for example, + // `gs://translation-test/input.tsv`) or a wildcard (for example, + // `gs://translation-test/*`). If a file extension is `.tsv`, it can + // contain either one or two columns. The first column (optional) is the id + // of the text request. If the first column is missing, we use the row + // number (0-based) from the input file as the ID in the output file. The + // second column is the actual text to be + // translated. We recommend each row be <= 10K Unicode codepoints, + // otherwise an error might be returned. + // Note that the input tsv must be RFC 4180 compliant. + // + // You could use https://github.com/Clever/csvlint to check potential + // formatting errors in your tsv file. + // csvlint --delimiter='\t' your_input_file.tsv + // + // The other supported file extensions are `.txt` or `.html`, which is + // treated as a single large chunk of text. + GcsSource gcs_source = 2; + } +} + +// The Google Cloud Storage location for the output content. +message GcsDestination { + // Required. There must be no files under 'output_uri_prefix'. + // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an + // INVALID_ARGUMENT (400) error is returned. + string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Output configuration for BatchTranslateText request. +message OutputConfig { + // Required. The destination of output. + oneof destination { + // Google Cloud Storage destination for output content. + // For every single input file (for example, gs://a/b/c.[extension]), we + // generate at most 2 * n output files. (n is the # of target_language_codes + // in the BatchTranslateTextRequest). + // + // Output files (tsv) generated are compliant with RFC 4180 except that + // record delimiters are '\n' instead of '\r\n'. We don't provide any way to + // change record delimiters. + // + // While the input files are being processed, we write/update an index file + // 'index.csv' under 'output_uri_prefix' (for example, + // gs://translation-test/index.csv) The index file is generated/updated as + // new files are being translated. The format is: + // + // input_file,target_language_code,translations_file,errors_file, + // glossary_translations_file,glossary_errors_file + // + // input_file is one file we matched using gcs_source.input_uri. + // target_language_code is provided in the request. + // translations_file contains the translations. (details provided below) + // errors_file contains the errors during processing of the file. (details + // below). Both translations_file and errors_file could be empty + // strings if we have no content to output. + // glossary_translations_file and glossary_errors_file are always empty + // strings if the input_file is tsv. They could also be empty if we have no + // content to output. + // + // Once a row is present in index.csv, the input/output matching never + // changes. Callers should also expect all the content in input_file are + // processed and ready to be consumed (that is, no partial output file is + // written). + // + // Since index.csv will be keeping updated during the process, please make + // sure there is no custom retention policy applied on the output bucket + // that may avoid file updating. + // (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + // + // The format of translations_file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_translations.[extension] + // + // If the input file extension is tsv, the output has the following + // columns: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: translation without applying a glossary. Empty string if there + // is an error. + // Column 4 (only present if a glossary is provided in the request): + // translation after applying the glossary. Empty string if there is an + // error applying the glossary. Could be same string as column 3 if there is + // no glossary applied. + // + // If input file extension is a txt or html, the translation is directly + // written to the output file. If glossary is requested, a separate + // glossary_translations_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] + // + // The format of errors file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_errors.[extension] + // + // If the input file extension is tsv, errors_file contains the following: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: Error detail for the translation. Could be empty. + // Column 4 (only present if a glossary is provided in the request): + // Error when applying the glossary. + // + // If the input file extension is txt or html, glossary_error_file will be + // generated that contains error details. glossary_error_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] + GcsDestination gcs_destination = 1; + } +} + +// A document translation request input config. +message DocumentInputConfig { + // Specifies the source for the document's content. + // The input file size should be <= 20MB for + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + // The input file size should be <= 20MB and the maximum page limit is 20 for + // - application/pdf + oneof source { + // Document's content represented as a stream of bytes. + bytes content = 1; + + // Google Cloud Storage location. This must be a single file. + // For example: gs://example_bucket/example_file.pdf + GcsSource gcs_source = 2; + } + + // Specifies the input document's mime_type. + // + // If not specified it will be determined using the file extension for + // gcs_source provided files. For a file provided through bytes content the + // mime_type must be provided. + // Currently supported mime types are: + // - application/pdf + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + string mime_type = 4; +} + +// A document translation request output config. +message DocumentOutputConfig { + // A URI destination for the translated document. + // It is optional to provide a destination. If provided the results from + // TranslateDocument will be stored in the destination. + // Whether a destination is provided or not, the translated documents will be + // returned within TranslateDocumentResponse.document_translation and + // TranslateDocumentResponse.glossary_document_translation. + oneof destination { + // Optional. Google Cloud Storage destination for the translation output, + // e.g., `gs://my_bucket/my_directory/`. + // + // The destination directory provided does not have to be empty, but the + // bucket must exist. If a file with the same name as the output file + // already exists in the destination an error will be returned. + // + // For a DocumentInputConfig.contents provided document, the output file + // will have the name "output_[trg]_translations.[ext]", where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // + // For a DocumentInputConfig.gcs_uri provided document, the output file will + // have a name according to its URI. For example: an input file with URI: + // "gs://a/b/c.[extension]" stored in a gcs_destination bucket with name + // "my_bucket" will have an output URI: + // "gs://my_bucket/a_b_c_[trg]_translations.[ext]", where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // + // If the document was directly provided through the request, then the + // output document will have the format: + // "gs://my_bucket/translated_document_[trg]_translations.[ext], where + // - [trg] corresponds to the translated file's language code, + // - [ext] corresponds to the translated file's extension according to its + // mime type. + // + // If a glossary was provided, then the output URI for the glossary + // translation will be equal to the default output URI but have + // `glossary_translations` instead of `translations`. For the previous + // example, its glossary URI would be: + // "gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]". + // + // Thus the max number of output files will be 2 (Translated document, + // Glossary translated document). + // + // Callers should expect no partial outputs. If there is any error during + // document translation, no output will be stored in the Cloud Storage + // bucket. + GcsDestination gcs_destination = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Specifies the translated document's mime_type. + // If not specified, the translated file's mime type will be the same as the + // input file's mime type. + // Currently only support the output mime type to be the same as input mime + // type. + // - application/pdf + // - application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - application/vnd.openxmlformats-officedocument.presentationml.presentation + // - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A document translation request. +message TranslateDocumentRequest { + // Required. Location to make a regional call. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global`. + // + // Non-global location is required for requests using AutoML models or custom + // glossaries. + // + // Models and glossaries must be within the same region (have the same + // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The BCP-47 language code of the input document if known, for + // example, "en-US" or "sr-Latn". Supported language codes are listed in + // Language Support. If the source language isn't specified, the API attempts + // to identify the source language automatically and returns the source + // language within the response. Source language must be specified if the + // request contains a glossary or a custom model. + string source_language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The BCP-47 language code to use for translation of the input + // document, set to one of the language codes listed in Language Support. + string target_language_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input configurations. + DocumentInputConfig document_input_config = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Output configurations. + // Defines if the output file should be stored within Cloud Storage as well + // as the desired output format. If not provided the translated file will + // only be returned through a byte-stream and its output mime type will be + // the same as the input file's mime type. + DocumentOutputConfig document_output_config = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The `model` type requested for this translation. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // If not provided, the default Google model (NMT) will be used for + // translation. + string model = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossary to be applied. The glossary must be within the same + // region (have the same location-id) as the model, otherwise an + // INVALID_ARGUMENT (400) error is returned. + TranslateTextGlossaryConfig glossary_config = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters (Unicode + // codepoints), can only contain lowercase letters, numeric characters, + // underscores and dashes. International characters are allowed. Label values + // are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/advanced/labels for more + // information. + map labels = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// A translated document message. +message DocumentTranslation { + // The array of translated documents. It is expected to be size 1 for now. We + // may produce multiple translated documents in the future for other type of + // file formats. + repeated bytes byte_stream_outputs = 1; + + // The translated document's mime type. + string mime_type = 2; + + // The detected language for the input document. + // If the user did not provide the source language for the input document, + // this field will have the language code automatically detected. If the + // source language was passed, auto-detection of the language does not occur + // and this field is empty. + string detected_language_code = 3; +} + +// A translated document response message. +message TranslateDocumentResponse { + // Translated document. + DocumentTranslation document_translation = 1; + + // The document's translation output if a glossary is provided in the request. + // This can be the same as [TranslateDocumentResponse.document_translation] + // if no glossary terms apply. + DocumentTranslation glossary_document_translation = 2; + + // Only present when 'model' is present in the request. + // 'model' is normalized to have a project number. + // + // For example: + // If the 'model' field in TranslateDocumentRequest is: + // `projects/{project-id}/locations/{location-id}/models/general/nmt` then + // `model` here would be normalized to + // `projects/{project-number}/locations/{location-id}/models/general/nmt`. + string model = 3; + + // The `glossary_config` used for this translation. + TranslateTextGlossaryConfig glossary_config = 4; +} + +// The batch translation request. +message BatchTranslateTextRequest { + // Required. Location to make a call. Must refer to a caller's project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // The `global` location is not supported for batch translation. + // + // Only AutoML Translation models or glossaries within the same region (have + // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + // error is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Source language code. + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specify up to 10 language codes here. + repeated string target_language_codes = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The models to use for translation. Map's key is target language + // code. Map's value is model name. Value can be a built-in general model, + // or an AutoML Translation model. + // + // The value format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // If the map is empty or a specific model is + // not requested for a language pair, then default google model (nmt) is used. + map models = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Input configurations. + // The total number of files matched should be <= 100. + // The total content size should be <= 100M Unicode codepoints. + // The files must use UTF-8 encoding. + repeated InputConfig input_configs = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Output configuration. + // If 2 input configs match to the same file (that is, same input path), + // we don't generate output for duplicate inputs. + OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Glossaries to be applied for translation. + // It's keyed by target language code. + map glossaries = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// State metadata for the batch translation operation. +message BatchTranslateMetadata { + // State of the job. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The batch is processed, and at least one item was successfully + // processed. + SUCCEEDED = 2; + + // The batch is done and no item was successfully processed. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The batch is done after the user has called the + // longrunning.Operations.CancelOperation. Any records processed before the + // cancel command are output as specified in the request. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // Number of successfully translated characters so far (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process so far (Unicode + // codepoints). + int64 failed_characters = 3; + + // Total number of characters (Unicode codepoints). + // This is the total number of codepoints from input files times the number of + // target languages and appears here shortly after the call is submitted. + int64 total_characters = 4; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 5; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by BatchTranslateText if at least one sentence is translated +// successfully. +message BatchTranslateResponse { + // Total number of characters (Unicode codepoints). + int64 total_characters = 1; + + // Number of successfully translated characters (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process (Unicode codepoints). + int64 failed_characters = 3; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 4; + + // The time when the operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 5; +} + +// Input configuration for glossaries. +message GlossaryInputConfig { + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location of glossary data. + // File format is determined based on the filename extension. API returns + // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + // formats. Wildcards are not allowed. This must be a single file in one of + // the following formats: + // + // For unidirectional glossaries: + // + // - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. + // The first column is source text. The second column is target text. + // The file must not contain headers. That is, the first row is data, not + // column names. + // + // - TMX (`.tmx`): TMX file with parallel data defining source/target term + // pairs. + // + // For equivalent term sets glossaries: + // + // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + // in multiple languages. The format is defined for Google Translation + // Toolkit and documented in [Use a + // glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en). + GcsSource gcs_source = 1; + } +} + +// Represents a glossary built from user provided data. +message Glossary { + option (google.api.resource) = { + type: "translate.googleapis.com/Glossary" + pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" + }; + + // Used with unidirectional glossaries. + message LanguageCodePair { + // Required. The BCP-47 language code of the input text, for example, + // "en-US". Expected to be an exact match for GlossaryTerm.language_code. + string source_language_code = 1; + + // Required. The BCP-47 language code for translation output, for example, + // "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + string target_language_code = 2; + } + + // Used with equivalent term set glossaries. + message LanguageCodesSet { + // The BCP-47 language code(s) for terms defined in the glossary. + // All entries are unique. The list contains at least two entries. + // Expected to be an exact match for GlossaryTerm.language_code. + repeated string language_codes = 1; + } + + // Required. The resource name of the glossary. Glossary names have the form + // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Languages supported by the glossary. + oneof languages { + // Used with unidirectional glossaries. + LanguageCodePair language_pair = 3; + + // Used with equivalent term set glossaries. + LanguageCodesSet language_codes_set = 4; + } + + // Required. Provides examples to build the glossary from. + // Total glossary must not exceed 10M Unicode codepoints. + GlossaryInputConfig input_config = 5; + + // Output only. The number of entries defined in the glossary. + int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When CreateGlossary was called. + google.protobuf.Timestamp submit_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the glossary creation was finished. + google.protobuf.Timestamp end_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for CreateGlossary. +message CreateGlossaryRequest { + // Required. The project name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The glossary to create. + Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for GetGlossary. +message GetGlossaryRequest { + // Required. The name of the glossary to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for DeleteGlossary. +message DeleteGlossaryRequest { + // Required. The name of the glossary to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for ListGlossaries. +message ListGlossariesRequest { + // Required. The name of the project from which to list all of the glossaries. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Requested page size. The server may return fewer glossaries than + // requested. If unspecified, the server picks an appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + // Typically, this is the value of [ListGlossariesResponse.next_page_token] + // returned from the previous call to `ListGlossaries` method. + // The first page is returned if `page_token`is empty or missing. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter specifying constraints of a list operation. + // Specify the constraint by the format of "key=value", where key must be + // "src" or "tgt", and the value must be a valid language code. + // For multiple restrictions, concatenate them by "AND" (uppercase only), + // such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + // here, which means using 'en-US' and 'en' can lead to different results, + // which depends on the language code you used when you create the glossary. + // For the unidirectional glossaries, the "src" and "tgt" add restrictions + // on the source and target language code separately. + // For the equivalent term set glossaries, the "src" and/or "tgt" add + // restrictions on the term set. + // For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + // glossaries which exactly match the source language code as "en-US" and the + // target language code "zh-CN", but all equivalent term set glossaries which + // contain "en-US" and "zh-CN" in their language set will be picked. + // If missing, no filtering is performed. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListGlossaries. +message ListGlossariesResponse { + // The list of glossaries for a project. + repeated Glossary glossaries = 1; + + // A token to retrieve a page of results. Pass this value in the + // [ListGlossariesRequest.page_token] field in the subsequent call to + // `ListGlossaries` method to retrieve the next page of results. + string next_page_token = 2; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by CreateGlossary. +message CreateGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully created. + SUCCEEDED = 2; + + // Failed to create the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary creation request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being created. + string name = 1; + + // The current state of the glossary creation operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by DeleteGlossary. +message DeleteGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully deleted. + SUCCEEDED = 2; + + // Failed to delete the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary deletion request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being deleted. + string name = 1; + + // The current state of the glossary deletion operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by DeleteGlossary. +message DeleteGlossaryResponse { + // The name of the deleted glossary. + string name = 1; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 2; + + // The time when the glossary deletion is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 3; +} + +// The BatchTranslateDocument request. +message BatchTranslateDocumentRequest { + // Required. Location to make a regional call. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // The `global` location is not supported for batch translation. + // + // Only AutoML Translation models or glossaries within the same region (have + // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + // error is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The BCP-47 language code of the input document if known, for + // example, "en-US" or "sr-Latn". Supported language codes are listed in + // Language Support (https://cloud.google.com/translate/docs/languages). + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The BCP-47 language code to use for translation of the input + // document. Specify up to 10 language codes here. + repeated string target_language_codes = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Input configurations. + // The total number of files matched should be <= 100. + // The total content size to translate should be <= 100M Unicode codepoints. + // The files must use UTF-8 encoding. + repeated BatchDocumentInputConfig input_configs = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Output configuration. + // If 2 input configs match to the same file (that is, same input path), + // we don't generate output for duplicate inputs. + BatchDocumentOutputConfig output_config = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The models to use for translation. Map's key is target language + // code. Map's value is the model name. Value can be a built-in general model, + // or an AutoML Translation model. + // + // The value format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // + // + // If the map is empty or a specific model is not requested for a language + // pair, then default google model (nmt) is used. + map models = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossaries to be applied. It's keyed by target language code. + map glossaries = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. File format conversion map to be applied to all input files. + // Map's key is the original mime_type. Map's value is the target mime_type of + // translated documents. + // + // Supported file format conversion includes: + // - `application/pdf` to + // `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + // + // If nothing specified, output files will be in the same format as the + // original file. + map format_conversions = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Input configuration for BatchTranslateDocument request. +message BatchDocumentInputConfig { + // Specify the input. + oneof source { + // Google Cloud Storage location for the source input. + // This can be a single file (for example, + // `gs://translation-test/input.docx`) or a wildcard (for example, + // `gs://translation-test/*`). + // + // File mime type is determined based on extension. Supported mime type + // includes: + // - `pdf`, application/pdf + // - `docx`, + // application/vnd.openxmlformats-officedocument.wordprocessingml.document + // - `pptx`, + // application/vnd.openxmlformats-officedocument.presentationml.presentation + // - `xlsx`, + // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + // + // The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + // The max file size to support for `.pdf` is 1GB and the max page limit is + // 1000 pages. + // The max file size to support for all input documents is 1GB. + GcsSource gcs_source = 1; + } +} + +// Output configuration for BatchTranslateDocument request. +message BatchDocumentOutputConfig { + // The destination of output. The destination directory provided must exist + // and be empty. + oneof destination { + // Google Cloud Storage destination for output content. + // For every single input document (for example, gs://a/b/c.[extension]), we + // generate at most 2 * n output files. (n is the # of target_language_codes + // in the BatchTranslateDocumentRequest). + // + // While the input documents are being processed, we write/update an index + // file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + // gs://translation_output/index.csv) The index file is generated/updated as + // new files are being translated. The format is: + // + // input_document,target_language_code,translation_output,error_output, + // glossary_translation_output,glossary_error_output + // + // `input_document` is one file we matched using gcs_source.input_uri. + // `target_language_code` is provided in the request. + // `translation_output` contains the translations. (details provided below) + // `error_output` contains the error message during processing of the file. + // Both translations_file and errors_file could be empty strings if we have + // no content to output. + // `glossary_translation_output` and `glossary_error_output` are the + // translated output/error when we apply glossaries. They could also be + // empty if we have no content to output. + // + // Once a row is present in index.csv, the input/output matching never + // changes. Callers should also expect all the content in input_file are + // processed and ready to be consumed (that is, no partial output file is + // written). + // + // Since index.csv will be keeping updated during the process, please make + // sure there is no custom retention policy applied on the output bucket + // that may avoid file updating. + // (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy) + // + // The naming format of translation output files follows (for target + // language code [trg]): `translation_output`: + // gs://translation_output/a_b_c_[trg]_translation.[extension] + // `glossary_translation_output`: + // gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The + // output document will maintain the same file format as the input document. + // + // The naming format of error output files follows (for target language code + // [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt + // `glossary_error_output`: + // gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error + // output is a txt file containing error details. + GcsDestination gcs_destination = 1; + } +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by BatchTranslateDocument if at least one document is +// translated successfully. +message BatchTranslateDocumentResponse { + // Total number of pages to translate in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 total_pages = 1; + + // Number of successfully translated pages in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 translated_pages = 2; + + // Number of pages that failed to process in all documents. Documents without + // clear page definition (such as XLSX) are not counted. + int64 failed_pages = 3; + + // Number of billable pages in documents with clear page definition (such as + // PDF, DOCX, PPTX) + int64 total_billable_pages = 4; + + // Total number of characters (Unicode codepoints) in all documents. + int64 total_characters = 5; + + // Number of successfully translated characters (Unicode codepoints) in all + // documents. + int64 translated_characters = 6; + + // Number of characters that have failed to process (Unicode codepoints) in + // all documents. + int64 failed_characters = 7; + + // Number of billable characters (Unicode codepoints) in documents without + // clear page definition, such as XLSX. + int64 total_billable_characters = 8; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 9; + + // The time when the operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 10; +} + +// State metadata for the batch translation operation. +message BatchTranslateDocumentMetadata { + // State of the job. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The batch is processed, and at least one item was successfully processed. + SUCCEEDED = 2; + + // The batch is done and no item was successfully processed. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The batch is done after the user has called the + // longrunning.Operations.CancelOperation. Any records processed before the + // cancel command are output as specified in the request. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // Total number of pages to translate in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 total_pages = 2; + + // Number of successfully translated pages in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 translated_pages = 3; + + // Number of pages that failed to process in all documents so far. Documents + // without clear page definition (such as XLSX) are not counted. + int64 failed_pages = 4; + + // Number of billable pages in documents with clear page definition (such as + // PDF, DOCX, PPTX) so far. + int64 total_billable_pages = 5; + + // Total number of characters (Unicode codepoints) in all documents so far. + int64 total_characters = 6; + + // Number of successfully translated characters (Unicode codepoints) in all + // documents so far. + int64 translated_characters = 7; + + // Number of characters that have failed to process (Unicode codepoints) in + // all documents so far. + int64 failed_characters = 8; + + // Number of billable characters (Unicode codepoints) in documents without + // clear page definition (such as XLSX) so far. + int64 total_billable_characters = 9; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 10; +} diff --git a/packages/google-cloud-translate/protos/protos.d.ts b/packages/google-cloud-translate/protos/protos.d.ts new file mode 100644 index 00000000000..053bd161ebe --- /dev/null +++ b/packages/google-cloud-translate/protos/protos.d.ts @@ -0,0 +1,14848 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 translation. */ + namespace translation { + + /** Namespace v3. */ + namespace v3 { + + /** Represents a TranslationService */ + class TranslationService extends $protobuf.rpc.Service { + + /** + * Constructs a new TranslationService 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 TranslationService 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): TranslationService; + + /** + * Calls TranslateText. + * @param request TranslateTextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TranslateTextResponse + */ + public translateText(request: google.cloud.translation.v3.ITranslateTextRequest, callback: google.cloud.translation.v3.TranslationService.TranslateTextCallback): void; + + /** + * Calls TranslateText. + * @param request TranslateTextRequest message or plain object + * @returns Promise + */ + public translateText(request: google.cloud.translation.v3.ITranslateTextRequest): Promise; + + /** + * Calls DetectLanguage. + * @param request DetectLanguageRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DetectLanguageResponse + */ + public detectLanguage(request: google.cloud.translation.v3.IDetectLanguageRequest, callback: google.cloud.translation.v3.TranslationService.DetectLanguageCallback): void; + + /** + * Calls DetectLanguage. + * @param request DetectLanguageRequest message or plain object + * @returns Promise + */ + public detectLanguage(request: google.cloud.translation.v3.IDetectLanguageRequest): Promise; + + /** + * Calls GetSupportedLanguages. + * @param request GetSupportedLanguagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SupportedLanguages + */ + public getSupportedLanguages(request: google.cloud.translation.v3.IGetSupportedLanguagesRequest, callback: google.cloud.translation.v3.TranslationService.GetSupportedLanguagesCallback): void; + + /** + * Calls GetSupportedLanguages. + * @param request GetSupportedLanguagesRequest message or plain object + * @returns Promise + */ + public getSupportedLanguages(request: google.cloud.translation.v3.IGetSupportedLanguagesRequest): Promise; + + /** + * Calls TranslateDocument. + * @param request TranslateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TranslateDocumentResponse + */ + public translateDocument(request: google.cloud.translation.v3.ITranslateDocumentRequest, callback: google.cloud.translation.v3.TranslationService.TranslateDocumentCallback): void; + + /** + * Calls TranslateDocument. + * @param request TranslateDocumentRequest message or plain object + * @returns Promise + */ + public translateDocument(request: google.cloud.translation.v3.ITranslateDocumentRequest): Promise; + + /** + * Calls BatchTranslateText. + * @param request BatchTranslateTextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchTranslateText(request: google.cloud.translation.v3.IBatchTranslateTextRequest, callback: google.cloud.translation.v3.TranslationService.BatchTranslateTextCallback): void; + + /** + * Calls BatchTranslateText. + * @param request BatchTranslateTextRequest message or plain object + * @returns Promise + */ + public batchTranslateText(request: google.cloud.translation.v3.IBatchTranslateTextRequest): Promise; + + /** + * Calls BatchTranslateDocument. + * @param request BatchTranslateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchTranslateDocument(request: google.cloud.translation.v3.IBatchTranslateDocumentRequest, callback: google.cloud.translation.v3.TranslationService.BatchTranslateDocumentCallback): void; + + /** + * Calls BatchTranslateDocument. + * @param request BatchTranslateDocumentRequest message or plain object + * @returns Promise + */ + public batchTranslateDocument(request: google.cloud.translation.v3.IBatchTranslateDocumentRequest): Promise; + + /** + * Calls CreateGlossary. + * @param request CreateGlossaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createGlossary(request: google.cloud.translation.v3.ICreateGlossaryRequest, callback: google.cloud.translation.v3.TranslationService.CreateGlossaryCallback): void; + + /** + * Calls CreateGlossary. + * @param request CreateGlossaryRequest message or plain object + * @returns Promise + */ + public createGlossary(request: google.cloud.translation.v3.ICreateGlossaryRequest): Promise; + + /** + * Calls ListGlossaries. + * @param request ListGlossariesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListGlossariesResponse + */ + public listGlossaries(request: google.cloud.translation.v3.IListGlossariesRequest, callback: google.cloud.translation.v3.TranslationService.ListGlossariesCallback): void; + + /** + * Calls ListGlossaries. + * @param request ListGlossariesRequest message or plain object + * @returns Promise + */ + public listGlossaries(request: google.cloud.translation.v3.IListGlossariesRequest): Promise; + + /** + * Calls GetGlossary. + * @param request GetGlossaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Glossary + */ + public getGlossary(request: google.cloud.translation.v3.IGetGlossaryRequest, callback: google.cloud.translation.v3.TranslationService.GetGlossaryCallback): void; + + /** + * Calls GetGlossary. + * @param request GetGlossaryRequest message or plain object + * @returns Promise + */ + public getGlossary(request: google.cloud.translation.v3.IGetGlossaryRequest): Promise; + + /** + * Calls DeleteGlossary. + * @param request DeleteGlossaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteGlossary(request: google.cloud.translation.v3.IDeleteGlossaryRequest, callback: google.cloud.translation.v3.TranslationService.DeleteGlossaryCallback): void; + + /** + * Calls DeleteGlossary. + * @param request DeleteGlossaryRequest message or plain object + * @returns Promise + */ + public deleteGlossary(request: google.cloud.translation.v3.IDeleteGlossaryRequest): Promise; + } + + namespace TranslationService { + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|translateText}. + * @param error Error, if any + * @param [response] TranslateTextResponse + */ + type TranslateTextCallback = (error: (Error|null), response?: google.cloud.translation.v3.TranslateTextResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|detectLanguage}. + * @param error Error, if any + * @param [response] DetectLanguageResponse + */ + type DetectLanguageCallback = (error: (Error|null), response?: google.cloud.translation.v3.DetectLanguageResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|getSupportedLanguages}. + * @param error Error, if any + * @param [response] SupportedLanguages + */ + type GetSupportedLanguagesCallback = (error: (Error|null), response?: google.cloud.translation.v3.SupportedLanguages) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|translateDocument}. + * @param error Error, if any + * @param [response] TranslateDocumentResponse + */ + type TranslateDocumentCallback = (error: (Error|null), response?: google.cloud.translation.v3.TranslateDocumentResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|batchTranslateText}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchTranslateTextCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|batchTranslateDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchTranslateDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|createGlossary}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateGlossaryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|listGlossaries}. + * @param error Error, if any + * @param [response] ListGlossariesResponse + */ + type ListGlossariesCallback = (error: (Error|null), response?: google.cloud.translation.v3.ListGlossariesResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|getGlossary}. + * @param error Error, if any + * @param [response] Glossary + */ + type GetGlossaryCallback = (error: (Error|null), response?: google.cloud.translation.v3.Glossary) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|deleteGlossary}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteGlossaryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a TranslateTextGlossaryConfig. */ + interface ITranslateTextGlossaryConfig { + + /** TranslateTextGlossaryConfig glossary */ + glossary?: (string|null); + + /** TranslateTextGlossaryConfig ignoreCase */ + ignoreCase?: (boolean|null); + } + + /** Represents a TranslateTextGlossaryConfig. */ + class TranslateTextGlossaryConfig implements ITranslateTextGlossaryConfig { + + /** + * Constructs a new TranslateTextGlossaryConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ITranslateTextGlossaryConfig); + + /** TranslateTextGlossaryConfig glossary. */ + public glossary: string; + + /** TranslateTextGlossaryConfig ignoreCase. */ + public ignoreCase: boolean; + + /** + * Creates a new TranslateTextGlossaryConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateTextGlossaryConfig instance + */ + public static create(properties?: google.cloud.translation.v3.ITranslateTextGlossaryConfig): google.cloud.translation.v3.TranslateTextGlossaryConfig; + + /** + * Encodes the specified TranslateTextGlossaryConfig message. Does not implicitly {@link google.cloud.translation.v3.TranslateTextGlossaryConfig.verify|verify} messages. + * @param message TranslateTextGlossaryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ITranslateTextGlossaryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateTextGlossaryConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateTextGlossaryConfig.verify|verify} messages. + * @param message TranslateTextGlossaryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ITranslateTextGlossaryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.TranslateTextGlossaryConfig; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.TranslateTextGlossaryConfig; + + /** + * Verifies a TranslateTextGlossaryConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateTextGlossaryConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateTextGlossaryConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.TranslateTextGlossaryConfig; + + /** + * Creates a plain object from a TranslateTextGlossaryConfig message. Also converts values to other types if specified. + * @param message TranslateTextGlossaryConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.TranslateTextGlossaryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateTextGlossaryConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateTextGlossaryConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TranslateTextRequest. */ + interface ITranslateTextRequest { + + /** TranslateTextRequest contents */ + contents?: (string[]|null); + + /** TranslateTextRequest mimeType */ + mimeType?: (string|null); + + /** TranslateTextRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** TranslateTextRequest targetLanguageCode */ + targetLanguageCode?: (string|null); + + /** TranslateTextRequest parent */ + parent?: (string|null); + + /** TranslateTextRequest model */ + model?: (string|null); + + /** TranslateTextRequest glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** TranslateTextRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a TranslateTextRequest. */ + class TranslateTextRequest implements ITranslateTextRequest { + + /** + * Constructs a new TranslateTextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ITranslateTextRequest); + + /** TranslateTextRequest contents. */ + public contents: string[]; + + /** TranslateTextRequest mimeType. */ + public mimeType: string; + + /** TranslateTextRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** TranslateTextRequest targetLanguageCode. */ + public targetLanguageCode: string; + + /** TranslateTextRequest parent. */ + public parent: string; + + /** TranslateTextRequest model. */ + public model: string; + + /** TranslateTextRequest glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** TranslateTextRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new TranslateTextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateTextRequest instance + */ + public static create(properties?: google.cloud.translation.v3.ITranslateTextRequest): google.cloud.translation.v3.TranslateTextRequest; + + /** + * Encodes the specified TranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.TranslateTextRequest.verify|verify} messages. + * @param message TranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ITranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateTextRequest.verify|verify} messages. + * @param message TranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ITranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.TranslateTextRequest; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.TranslateTextRequest; + + /** + * Verifies a TranslateTextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateTextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.TranslateTextRequest; + + /** + * Creates a plain object from a TranslateTextRequest message. Also converts values to other types if specified. + * @param message TranslateTextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.TranslateTextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateTextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateTextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TranslateTextResponse. */ + interface ITranslateTextResponse { + + /** TranslateTextResponse translations */ + translations?: (google.cloud.translation.v3.ITranslation[]|null); + + /** TranslateTextResponse glossaryTranslations */ + glossaryTranslations?: (google.cloud.translation.v3.ITranslation[]|null); + } + + /** Represents a TranslateTextResponse. */ + class TranslateTextResponse implements ITranslateTextResponse { + + /** + * Constructs a new TranslateTextResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ITranslateTextResponse); + + /** TranslateTextResponse translations. */ + public translations: google.cloud.translation.v3.ITranslation[]; + + /** TranslateTextResponse glossaryTranslations. */ + public glossaryTranslations: google.cloud.translation.v3.ITranslation[]; + + /** + * Creates a new TranslateTextResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateTextResponse instance + */ + public static create(properties?: google.cloud.translation.v3.ITranslateTextResponse): google.cloud.translation.v3.TranslateTextResponse; + + /** + * Encodes the specified TranslateTextResponse message. Does not implicitly {@link google.cloud.translation.v3.TranslateTextResponse.verify|verify} messages. + * @param message TranslateTextResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ITranslateTextResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateTextResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateTextResponse.verify|verify} messages. + * @param message TranslateTextResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ITranslateTextResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.TranslateTextResponse; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.TranslateTextResponse; + + /** + * Verifies a TranslateTextResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateTextResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateTextResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.TranslateTextResponse; + + /** + * Creates a plain object from a TranslateTextResponse message. Also converts values to other types if specified. + * @param message TranslateTextResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.TranslateTextResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateTextResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateTextResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Translation. */ + interface ITranslation { + + /** Translation translatedText */ + translatedText?: (string|null); + + /** Translation model */ + model?: (string|null); + + /** Translation detectedLanguageCode */ + detectedLanguageCode?: (string|null); + + /** Translation glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + } + + /** Represents a Translation. */ + class Translation implements ITranslation { + + /** + * Constructs a new Translation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ITranslation); + + /** Translation translatedText. */ + public translatedText: string; + + /** Translation model. */ + public model: string; + + /** Translation detectedLanguageCode. */ + public detectedLanguageCode: string; + + /** Translation glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** + * Creates a new Translation instance using the specified properties. + * @param [properties] Properties to set + * @returns Translation instance + */ + public static create(properties?: google.cloud.translation.v3.ITranslation): google.cloud.translation.v3.Translation; + + /** + * Encodes the specified Translation message. Does not implicitly {@link google.cloud.translation.v3.Translation.verify|verify} messages. + * @param message Translation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Translation.verify|verify} messages. + * @param message Translation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Translation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Translation; + + /** + * Decodes a Translation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Translation; + + /** + * Verifies a Translation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Translation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Translation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Translation; + + /** + * Creates a plain object from a Translation message. Also converts values to other types if specified. + * @param message Translation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.Translation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Translation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Translation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DetectLanguageRequest. */ + interface IDetectLanguageRequest { + + /** DetectLanguageRequest parent */ + parent?: (string|null); + + /** DetectLanguageRequest model */ + model?: (string|null); + + /** DetectLanguageRequest content */ + content?: (string|null); + + /** DetectLanguageRequest mimeType */ + mimeType?: (string|null); + + /** DetectLanguageRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a DetectLanguageRequest. */ + class DetectLanguageRequest implements IDetectLanguageRequest { + + /** + * Constructs a new DetectLanguageRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDetectLanguageRequest); + + /** DetectLanguageRequest parent. */ + public parent: string; + + /** DetectLanguageRequest model. */ + public model: string; + + /** DetectLanguageRequest content. */ + public content?: (string|null); + + /** DetectLanguageRequest mimeType. */ + public mimeType: string; + + /** DetectLanguageRequest labels. */ + public labels: { [k: string]: string }; + + /** DetectLanguageRequest source. */ + public source?: "content"; + + /** + * Creates a new DetectLanguageRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectLanguageRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IDetectLanguageRequest): google.cloud.translation.v3.DetectLanguageRequest; + + /** + * Encodes the specified DetectLanguageRequest message. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageRequest.verify|verify} messages. + * @param message DetectLanguageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDetectLanguageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectLanguageRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageRequest.verify|verify} messages. + * @param message DetectLanguageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDetectLanguageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DetectLanguageRequest; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DetectLanguageRequest; + + /** + * Verifies a DetectLanguageRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectLanguageRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectLanguageRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DetectLanguageRequest; + + /** + * Creates a plain object from a DetectLanguageRequest message. Also converts values to other types if specified. + * @param message DetectLanguageRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DetectLanguageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectLanguageRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectLanguageRequest + * @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.translation.v3.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.translation.v3.IDetectedLanguage): google.cloud.translation.v3.DetectedLanguage; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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 a DetectLanguageResponse. */ + interface IDetectLanguageResponse { + + /** DetectLanguageResponse languages */ + languages?: (google.cloud.translation.v3.IDetectedLanguage[]|null); + } + + /** Represents a DetectLanguageResponse. */ + class DetectLanguageResponse implements IDetectLanguageResponse { + + /** + * Constructs a new DetectLanguageResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDetectLanguageResponse); + + /** DetectLanguageResponse languages. */ + public languages: google.cloud.translation.v3.IDetectedLanguage[]; + + /** + * Creates a new DetectLanguageResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectLanguageResponse instance + */ + public static create(properties?: google.cloud.translation.v3.IDetectLanguageResponse): google.cloud.translation.v3.DetectLanguageResponse; + + /** + * Encodes the specified DetectLanguageResponse message. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageResponse.verify|verify} messages. + * @param message DetectLanguageResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDetectLanguageResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectLanguageResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageResponse.verify|verify} messages. + * @param message DetectLanguageResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDetectLanguageResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DetectLanguageResponse; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DetectLanguageResponse; + + /** + * Verifies a DetectLanguageResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectLanguageResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectLanguageResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DetectLanguageResponse; + + /** + * Creates a plain object from a DetectLanguageResponse message. Also converts values to other types if specified. + * @param message DetectLanguageResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DetectLanguageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectLanguageResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectLanguageResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetSupportedLanguagesRequest. */ + interface IGetSupportedLanguagesRequest { + + /** GetSupportedLanguagesRequest parent */ + parent?: (string|null); + + /** GetSupportedLanguagesRequest displayLanguageCode */ + displayLanguageCode?: (string|null); + + /** GetSupportedLanguagesRequest model */ + model?: (string|null); + } + + /** Represents a GetSupportedLanguagesRequest. */ + class GetSupportedLanguagesRequest implements IGetSupportedLanguagesRequest { + + /** + * Constructs a new GetSupportedLanguagesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGetSupportedLanguagesRequest); + + /** GetSupportedLanguagesRequest parent. */ + public parent: string; + + /** GetSupportedLanguagesRequest displayLanguageCode. */ + public displayLanguageCode: string; + + /** GetSupportedLanguagesRequest model. */ + public model: string; + + /** + * Creates a new GetSupportedLanguagesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSupportedLanguagesRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IGetSupportedLanguagesRequest): google.cloud.translation.v3.GetSupportedLanguagesRequest; + + /** + * Encodes the specified GetSupportedLanguagesRequest message. Does not implicitly {@link google.cloud.translation.v3.GetSupportedLanguagesRequest.verify|verify} messages. + * @param message GetSupportedLanguagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IGetSupportedLanguagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSupportedLanguagesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetSupportedLanguagesRequest.verify|verify} messages. + * @param message GetSupportedLanguagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IGetSupportedLanguagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.GetSupportedLanguagesRequest; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.GetSupportedLanguagesRequest; + + /** + * Verifies a GetSupportedLanguagesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetSupportedLanguagesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSupportedLanguagesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.GetSupportedLanguagesRequest; + + /** + * Creates a plain object from a GetSupportedLanguagesRequest message. Also converts values to other types if specified. + * @param message GetSupportedLanguagesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.GetSupportedLanguagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSupportedLanguagesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetSupportedLanguagesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SupportedLanguages. */ + interface ISupportedLanguages { + + /** SupportedLanguages languages */ + languages?: (google.cloud.translation.v3.ISupportedLanguage[]|null); + } + + /** Represents a SupportedLanguages. */ + class SupportedLanguages implements ISupportedLanguages { + + /** + * Constructs a new SupportedLanguages. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ISupportedLanguages); + + /** SupportedLanguages languages. */ + public languages: google.cloud.translation.v3.ISupportedLanguage[]; + + /** + * Creates a new SupportedLanguages instance using the specified properties. + * @param [properties] Properties to set + * @returns SupportedLanguages instance + */ + public static create(properties?: google.cloud.translation.v3.ISupportedLanguages): google.cloud.translation.v3.SupportedLanguages; + + /** + * Encodes the specified SupportedLanguages message. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguages.verify|verify} messages. + * @param message SupportedLanguages message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ISupportedLanguages, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SupportedLanguages message, length delimited. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguages.verify|verify} messages. + * @param message SupportedLanguages message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ISupportedLanguages, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.SupportedLanguages; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.SupportedLanguages; + + /** + * Verifies a SupportedLanguages message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SupportedLanguages message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SupportedLanguages + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.SupportedLanguages; + + /** + * Creates a plain object from a SupportedLanguages message. Also converts values to other types if specified. + * @param message SupportedLanguages + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.SupportedLanguages, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SupportedLanguages to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SupportedLanguages + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SupportedLanguage. */ + interface ISupportedLanguage { + + /** SupportedLanguage languageCode */ + languageCode?: (string|null); + + /** SupportedLanguage displayName */ + displayName?: (string|null); + + /** SupportedLanguage supportSource */ + supportSource?: (boolean|null); + + /** SupportedLanguage supportTarget */ + supportTarget?: (boolean|null); + } + + /** Represents a SupportedLanguage. */ + class SupportedLanguage implements ISupportedLanguage { + + /** + * Constructs a new SupportedLanguage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ISupportedLanguage); + + /** SupportedLanguage languageCode. */ + public languageCode: string; + + /** SupportedLanguage displayName. */ + public displayName: string; + + /** SupportedLanguage supportSource. */ + public supportSource: boolean; + + /** SupportedLanguage supportTarget. */ + public supportTarget: boolean; + + /** + * Creates a new SupportedLanguage instance using the specified properties. + * @param [properties] Properties to set + * @returns SupportedLanguage instance + */ + public static create(properties?: google.cloud.translation.v3.ISupportedLanguage): google.cloud.translation.v3.SupportedLanguage; + + /** + * Encodes the specified SupportedLanguage message. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguage.verify|verify} messages. + * @param message SupportedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ISupportedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SupportedLanguage message, length delimited. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguage.verify|verify} messages. + * @param message SupportedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ISupportedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.SupportedLanguage; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.SupportedLanguage; + + /** + * Verifies a SupportedLanguage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SupportedLanguage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SupportedLanguage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.SupportedLanguage; + + /** + * Creates a plain object from a SupportedLanguage message. Also converts values to other types if specified. + * @param message SupportedLanguage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.SupportedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SupportedLanguage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SupportedLanguage + * @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 inputUri */ + inputUri?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGcsSource); + + /** GcsSource inputUri. */ + public inputUri: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.translation.v3.IGcsSource): google.cloud.translation.v3.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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 an InputConfig. */ + interface IInputConfig { + + /** InputConfig mimeType */ + mimeType?: (string|null); + + /** InputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + } + + /** Represents an InputConfig. */ + class InputConfig implements IInputConfig { + + /** + * Constructs a new InputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IInputConfig); + + /** InputConfig mimeType. */ + public mimeType: string; + + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + + /** 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.translation.v3.IInputConfig): google.cloud.translation.v3.InputConfig; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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 a GcsDestination. */ + interface IGcsDestination { + + /** GcsDestination outputUriPrefix */ + outputUriPrefix?: (string|null); + } + + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { + + /** + * Constructs a new GcsDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGcsDestination); + + /** GcsDestination outputUriPrefix. */ + public outputUriPrefix: string; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDestination instance + */ + public static create(properties?: google.cloud.translation.v3.IGcsDestination): google.cloud.translation.v3.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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 OutputConfig. */ + interface IOutputConfig { + + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); + } + + /** Represents an OutputConfig. */ + class OutputConfig implements IOutputConfig { + + /** + * Constructs a new OutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IOutputConfig); + + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); + + /** 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.translation.v3.IOutputConfig): google.cloud.translation.v3.OutputConfig; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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 DocumentInputConfig. */ + interface IDocumentInputConfig { + + /** DocumentInputConfig content */ + content?: (Uint8Array|string|null); + + /** DocumentInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + + /** DocumentInputConfig mimeType */ + mimeType?: (string|null); + } + + /** Represents a DocumentInputConfig. */ + class DocumentInputConfig implements IDocumentInputConfig { + + /** + * Constructs a new DocumentInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDocumentInputConfig); + + /** DocumentInputConfig content. */ + public content?: (Uint8Array|string|null); + + /** DocumentInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + + /** DocumentInputConfig mimeType. */ + public mimeType: string; + + /** DocumentInputConfig source. */ + public source?: ("content"|"gcsSource"); + + /** + * Creates a new DocumentInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentInputConfig instance + */ + public static create(properties?: google.cloud.translation.v3.IDocumentInputConfig): google.cloud.translation.v3.DocumentInputConfig; + + /** + * Encodes the specified DocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. + * @param message DocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. + * @param message DocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DocumentInputConfig; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DocumentInputConfig; + + /** + * Verifies a DocumentInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DocumentInputConfig; + + /** + * Creates a plain object from a DocumentInputConfig message. Also converts values to other types if specified. + * @param message DocumentInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DocumentInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentInputConfig + * @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 gcsDestination */ + gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); + + /** DocumentOutputConfig mimeType */ + mimeType?: (string|null); + } + + /** Represents a DocumentOutputConfig. */ + class DocumentOutputConfig implements IDocumentOutputConfig { + + /** + * Constructs a new DocumentOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDocumentOutputConfig); + + /** DocumentOutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); + + /** DocumentOutputConfig mimeType. */ + public mimeType: string; + + /** DocumentOutputConfig destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentOutputConfig instance + */ + public static create(properties?: google.cloud.translation.v3.IDocumentOutputConfig): google.cloud.translation.v3.DocumentOutputConfig; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.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; + } + + /** Properties of a TranslateDocumentRequest. */ + interface ITranslateDocumentRequest { + + /** TranslateDocumentRequest parent */ + parent?: (string|null); + + /** TranslateDocumentRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** TranslateDocumentRequest targetLanguageCode */ + targetLanguageCode?: (string|null); + + /** TranslateDocumentRequest documentInputConfig */ + documentInputConfig?: (google.cloud.translation.v3.IDocumentInputConfig|null); + + /** TranslateDocumentRequest documentOutputConfig */ + documentOutputConfig?: (google.cloud.translation.v3.IDocumentOutputConfig|null); + + /** TranslateDocumentRequest model */ + model?: (string|null); + + /** TranslateDocumentRequest glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** TranslateDocumentRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a TranslateDocumentRequest. */ + class TranslateDocumentRequest implements ITranslateDocumentRequest { + + /** + * Constructs a new TranslateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ITranslateDocumentRequest); + + /** TranslateDocumentRequest parent. */ + public parent: string; + + /** TranslateDocumentRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** TranslateDocumentRequest targetLanguageCode. */ + public targetLanguageCode: string; + + /** TranslateDocumentRequest documentInputConfig. */ + public documentInputConfig?: (google.cloud.translation.v3.IDocumentInputConfig|null); + + /** TranslateDocumentRequest documentOutputConfig. */ + public documentOutputConfig?: (google.cloud.translation.v3.IDocumentOutputConfig|null); + + /** TranslateDocumentRequest model. */ + public model: string; + + /** TranslateDocumentRequest glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** TranslateDocumentRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new TranslateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateDocumentRequest instance + */ + public static create(properties?: google.cloud.translation.v3.ITranslateDocumentRequest): google.cloud.translation.v3.TranslateDocumentRequest; + + /** + * Encodes the specified TranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. + * @param message TranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ITranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. + * @param message TranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ITranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.TranslateDocumentRequest; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.TranslateDocumentRequest; + + /** + * Verifies a TranslateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.TranslateDocumentRequest; + + /** + * Creates a plain object from a TranslateDocumentRequest message. Also converts values to other types if specified. + * @param message TranslateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.TranslateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentTranslation. */ + interface IDocumentTranslation { + + /** DocumentTranslation byteStreamOutputs */ + byteStreamOutputs?: (Uint8Array[]|null); + + /** DocumentTranslation mimeType */ + mimeType?: (string|null); + + /** DocumentTranslation detectedLanguageCode */ + detectedLanguageCode?: (string|null); + } + + /** Represents a DocumentTranslation. */ + class DocumentTranslation implements IDocumentTranslation { + + /** + * Constructs a new DocumentTranslation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDocumentTranslation); + + /** DocumentTranslation byteStreamOutputs. */ + public byteStreamOutputs: Uint8Array[]; + + /** DocumentTranslation mimeType. */ + public mimeType: string; + + /** DocumentTranslation detectedLanguageCode. */ + public detectedLanguageCode: string; + + /** + * Creates a new DocumentTranslation instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentTranslation instance + */ + public static create(properties?: google.cloud.translation.v3.IDocumentTranslation): google.cloud.translation.v3.DocumentTranslation; + + /** + * Encodes the specified DocumentTranslation message. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. + * @param message DocumentTranslation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDocumentTranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentTranslation message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. + * @param message DocumentTranslation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDocumentTranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DocumentTranslation; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DocumentTranslation; + + /** + * Verifies a DocumentTranslation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentTranslation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentTranslation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DocumentTranslation; + + /** + * Creates a plain object from a DocumentTranslation message. Also converts values to other types if specified. + * @param message DocumentTranslation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DocumentTranslation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentTranslation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentTranslation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TranslateDocumentResponse. */ + interface ITranslateDocumentResponse { + + /** TranslateDocumentResponse documentTranslation */ + documentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); + + /** TranslateDocumentResponse glossaryDocumentTranslation */ + glossaryDocumentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); + + /** TranslateDocumentResponse model */ + model?: (string|null); + + /** TranslateDocumentResponse glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + } + + /** Represents a TranslateDocumentResponse. */ + class TranslateDocumentResponse implements ITranslateDocumentResponse { + + /** + * Constructs a new TranslateDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ITranslateDocumentResponse); + + /** TranslateDocumentResponse documentTranslation. */ + public documentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); + + /** TranslateDocumentResponse glossaryDocumentTranslation. */ + public glossaryDocumentTranslation?: (google.cloud.translation.v3.IDocumentTranslation|null); + + /** TranslateDocumentResponse model. */ + public model: string; + + /** TranslateDocumentResponse glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3.ITranslateTextGlossaryConfig|null); + + /** + * Creates a new TranslateDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateDocumentResponse instance + */ + public static create(properties?: google.cloud.translation.v3.ITranslateDocumentResponse): google.cloud.translation.v3.TranslateDocumentResponse; + + /** + * Encodes the specified TranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. + * @param message TranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ITranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. + * @param message TranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ITranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.TranslateDocumentResponse; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.TranslateDocumentResponse; + + /** + * Verifies a TranslateDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.TranslateDocumentResponse; + + /** + * Creates a plain object from a TranslateDocumentResponse message. Also converts values to other types if specified. + * @param message TranslateDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.TranslateDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateTextRequest. */ + interface IBatchTranslateTextRequest { + + /** BatchTranslateTextRequest parent */ + parent?: (string|null); + + /** BatchTranslateTextRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** BatchTranslateTextRequest targetLanguageCodes */ + targetLanguageCodes?: (string[]|null); + + /** BatchTranslateTextRequest models */ + models?: ({ [k: string]: string }|null); + + /** BatchTranslateTextRequest inputConfigs */ + inputConfigs?: (google.cloud.translation.v3.IInputConfig[]|null); + + /** BatchTranslateTextRequest outputConfig */ + outputConfig?: (google.cloud.translation.v3.IOutputConfig|null); + + /** BatchTranslateTextRequest glossaries */ + glossaries?: ({ [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }|null); + + /** BatchTranslateTextRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a BatchTranslateTextRequest. */ + class BatchTranslateTextRequest implements IBatchTranslateTextRequest { + + /** + * Constructs a new BatchTranslateTextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateTextRequest); + + /** BatchTranslateTextRequest parent. */ + public parent: string; + + /** BatchTranslateTextRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** BatchTranslateTextRequest targetLanguageCodes. */ + public targetLanguageCodes: string[]; + + /** BatchTranslateTextRequest models. */ + public models: { [k: string]: string }; + + /** BatchTranslateTextRequest inputConfigs. */ + public inputConfigs: google.cloud.translation.v3.IInputConfig[]; + + /** BatchTranslateTextRequest outputConfig. */ + public outputConfig?: (google.cloud.translation.v3.IOutputConfig|null); + + /** BatchTranslateTextRequest glossaries. */ + public glossaries: { [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }; + + /** BatchTranslateTextRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new BatchTranslateTextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateTextRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateTextRequest): google.cloud.translation.v3.BatchTranslateTextRequest; + + /** + * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @param message BatchTranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @param message BatchTranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateTextRequest; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateTextRequest; + + /** + * Verifies a BatchTranslateTextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateTextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateTextRequest; + + /** + * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. + * @param message BatchTranslateTextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateTextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateTextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateTextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateMetadata. */ + interface IBatchTranslateMetadata { + + /** BatchTranslateMetadata state */ + state?: (google.cloud.translation.v3.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateMetadata.State|null); + + /** BatchTranslateMetadata translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateMetadata. */ + class BatchTranslateMetadata implements IBatchTranslateMetadata { + + /** + * Constructs a new BatchTranslateMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateMetadata); + + /** BatchTranslateMetadata state. */ + public state: (google.cloud.translation.v3.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateMetadata.State); + + /** BatchTranslateMetadata translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateMetadata failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateMetadata totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateMetadata instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateMetadata): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @param message BatchTranslateMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @param message BatchTranslateMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Verifies a BatchTranslateMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateMetadata; + + /** + * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. + * @param message BatchTranslateMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BatchTranslateMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a BatchTranslateResponse. */ + interface IBatchTranslateResponse { + + /** BatchTranslateResponse totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateResponse. */ + class BatchTranslateResponse implements IBatchTranslateResponse { + + /** + * Constructs a new BatchTranslateResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateResponse); + + /** BatchTranslateResponse totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateResponse translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateResponse failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateResponse instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateResponse): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @param message BatchTranslateResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @param message BatchTranslateResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Verifies a BatchTranslateResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateResponse; + + /** + * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. + * @param message BatchTranslateResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GlossaryInputConfig. */ + interface IGlossaryInputConfig { + + /** GlossaryInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + } + + /** Represents a GlossaryInputConfig. */ + class GlossaryInputConfig implements IGlossaryInputConfig { + + /** + * Constructs a new GlossaryInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGlossaryInputConfig); + + /** GlossaryInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + + /** GlossaryInputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new GlossaryInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GlossaryInputConfig instance + */ + public static create(properties?: google.cloud.translation.v3.IGlossaryInputConfig): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @param message GlossaryInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @param message GlossaryInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Verifies a GlossaryInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GlossaryInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.GlossaryInputConfig; + + /** + * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. + * @param message GlossaryInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.GlossaryInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GlossaryInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GlossaryInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Glossary. */ + interface IGlossary { + + /** Glossary name */ + name?: (string|null); + + /** Glossary languagePair */ + languagePair?: (google.cloud.translation.v3.Glossary.ILanguageCodePair|null); + + /** Glossary languageCodesSet */ + languageCodesSet?: (google.cloud.translation.v3.Glossary.ILanguageCodesSet|null); + + /** Glossary inputConfig */ + inputConfig?: (google.cloud.translation.v3.IGlossaryInputConfig|null); + + /** Glossary entryCount */ + entryCount?: (number|null); + + /** Glossary submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** Glossary endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Glossary. */ + class Glossary implements IGlossary { + + /** + * Constructs a new Glossary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGlossary); + + /** Glossary name. */ + public name: string; + + /** Glossary languagePair. */ + public languagePair?: (google.cloud.translation.v3.Glossary.ILanguageCodePair|null); + + /** Glossary languageCodesSet. */ + public languageCodesSet?: (google.cloud.translation.v3.Glossary.ILanguageCodesSet|null); + + /** Glossary inputConfig. */ + public inputConfig?: (google.cloud.translation.v3.IGlossaryInputConfig|null); + + /** Glossary entryCount. */ + public entryCount: number; + + /** Glossary submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** Glossary endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** Glossary languages. */ + public languages?: ("languagePair"|"languageCodesSet"); + + /** + * Creates a new Glossary instance using the specified properties. + * @param [properties] Properties to set + * @returns Glossary instance + */ + public static create(properties?: google.cloud.translation.v3.IGlossary): google.cloud.translation.v3.Glossary; + + /** + * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @param message Glossary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @param message Glossary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Glossary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary; + + /** + * Decodes a Glossary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary; + + /** + * Verifies a Glossary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Glossary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary; + + /** + * Creates a plain object from a Glossary message. Also converts values to other types if specified. + * @param message Glossary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.Glossary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Glossary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Glossary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Glossary { + + /** Properties of a LanguageCodePair. */ + interface ILanguageCodePair { + + /** LanguageCodePair sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** LanguageCodePair targetLanguageCode */ + targetLanguageCode?: (string|null); + } + + /** Represents a LanguageCodePair. */ + class LanguageCodePair implements ILanguageCodePair { + + /** + * Constructs a new LanguageCodePair. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.Glossary.ILanguageCodePair); + + /** LanguageCodePair sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** LanguageCodePair targetLanguageCode. */ + public targetLanguageCode: string; + + /** + * Creates a new LanguageCodePair instance using the specified properties. + * @param [properties] Properties to set + * @returns LanguageCodePair instance + */ + public static create(properties?: google.cloud.translation.v3.Glossary.ILanguageCodePair): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @param message LanguageCodePair message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @param message LanguageCodePair message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Verifies a LanguageCodePair message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LanguageCodePair + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary.LanguageCodePair; + + /** + * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. + * @param message LanguageCodePair + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.Glossary.LanguageCodePair, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LanguageCodePair to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LanguageCodePair + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LanguageCodesSet. */ + interface ILanguageCodesSet { + + /** LanguageCodesSet languageCodes */ + languageCodes?: (string[]|null); + } + + /** Represents a LanguageCodesSet. */ + class LanguageCodesSet implements ILanguageCodesSet { + + /** + * Constructs a new LanguageCodesSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.Glossary.ILanguageCodesSet); + + /** LanguageCodesSet languageCodes. */ + public languageCodes: string[]; + + /** + * Creates a new LanguageCodesSet instance using the specified properties. + * @param [properties] Properties to set + * @returns LanguageCodesSet instance + */ + public static create(properties?: google.cloud.translation.v3.Glossary.ILanguageCodesSet): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @param message LanguageCodesSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @param message LanguageCodesSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Verifies a LanguageCodesSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LanguageCodesSet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.Glossary.LanguageCodesSet; + + /** + * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. + * @param message LanguageCodesSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.Glossary.LanguageCodesSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LanguageCodesSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LanguageCodesSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a CreateGlossaryRequest. */ + interface ICreateGlossaryRequest { + + /** CreateGlossaryRequest parent */ + parent?: (string|null); + + /** CreateGlossaryRequest glossary */ + glossary?: (google.cloud.translation.v3.IGlossary|null); + } + + /** Represents a CreateGlossaryRequest. */ + class CreateGlossaryRequest implements ICreateGlossaryRequest { + + /** + * Constructs a new CreateGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ICreateGlossaryRequest); + + /** CreateGlossaryRequest parent. */ + public parent: string; + + /** CreateGlossaryRequest glossary. */ + public glossary?: (google.cloud.translation.v3.IGlossary|null); + + /** + * Creates a new CreateGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3.ICreateGlossaryRequest): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @param message CreateGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @param message CreateGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Verifies a CreateGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.CreateGlossaryRequest; + + /** + * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. + * @param message CreateGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.CreateGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateGlossaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetGlossaryRequest. */ + interface IGetGlossaryRequest { + + /** GetGlossaryRequest name */ + name?: (string|null); + } + + /** Represents a GetGlossaryRequest. */ + class GetGlossaryRequest implements IGetGlossaryRequest { + + /** + * Constructs a new GetGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IGetGlossaryRequest); + + /** GetGlossaryRequest name. */ + public name: string; + + /** + * Creates a new GetGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IGetGlossaryRequest): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @param message GetGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @param message GetGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Verifies a GetGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.GetGlossaryRequest; + + /** + * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. + * @param message GetGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.GetGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetGlossaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteGlossaryRequest. */ + interface IDeleteGlossaryRequest { + + /** DeleteGlossaryRequest name */ + name?: (string|null); + } + + /** Represents a DeleteGlossaryRequest. */ + class DeleteGlossaryRequest implements IDeleteGlossaryRequest { + + /** + * Constructs a new DeleteGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryRequest); + + /** DeleteGlossaryRequest name. */ + public name: string; + + /** + * Creates a new DeleteGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryRequest): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @param message DeleteGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @param message DeleteGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Verifies a DeleteGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryRequest; + + /** + * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. + * @param message DeleteGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DeleteGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteGlossaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListGlossariesRequest. */ + interface IListGlossariesRequest { + + /** ListGlossariesRequest parent */ + parent?: (string|null); + + /** ListGlossariesRequest pageSize */ + pageSize?: (number|null); + + /** ListGlossariesRequest pageToken */ + pageToken?: (string|null); + + /** ListGlossariesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListGlossariesRequest. */ + class ListGlossariesRequest implements IListGlossariesRequest { + + /** + * Constructs a new ListGlossariesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IListGlossariesRequest); + + /** ListGlossariesRequest parent. */ + public parent: string; + + /** ListGlossariesRequest pageSize. */ + public pageSize: number; + + /** ListGlossariesRequest pageToken. */ + public pageToken: string; + + /** ListGlossariesRequest filter. */ + public filter: string; + + /** + * Creates a new ListGlossariesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGlossariesRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IListGlossariesRequest): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @param message ListGlossariesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @param message ListGlossariesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Verifies a ListGlossariesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGlossariesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.ListGlossariesRequest; + + /** + * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. + * @param message ListGlossariesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.ListGlossariesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGlossariesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGlossariesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListGlossariesResponse. */ + interface IListGlossariesResponse { + + /** ListGlossariesResponse glossaries */ + glossaries?: (google.cloud.translation.v3.IGlossary[]|null); + + /** ListGlossariesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListGlossariesResponse. */ + class ListGlossariesResponse implements IListGlossariesResponse { + + /** + * Constructs a new ListGlossariesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IListGlossariesResponse); + + /** ListGlossariesResponse glossaries. */ + public glossaries: google.cloud.translation.v3.IGlossary[]; + + /** ListGlossariesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListGlossariesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGlossariesResponse instance + */ + public static create(properties?: google.cloud.translation.v3.IListGlossariesResponse): google.cloud.translation.v3.ListGlossariesResponse; + + /** + * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @param message ListGlossariesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @param message ListGlossariesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.ListGlossariesResponse; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.ListGlossariesResponse; + + /** + * Verifies a ListGlossariesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGlossariesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.ListGlossariesResponse; + + /** + * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. + * @param message ListGlossariesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.ListGlossariesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGlossariesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGlossariesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateGlossaryMetadata. */ + interface ICreateGlossaryMetadata { + + /** CreateGlossaryMetadata name */ + name?: (string|null); + + /** CreateGlossaryMetadata state */ + state?: (google.cloud.translation.v3.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.CreateGlossaryMetadata.State|null); + + /** CreateGlossaryMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CreateGlossaryMetadata. */ + class CreateGlossaryMetadata implements ICreateGlossaryMetadata { + + /** + * Constructs a new CreateGlossaryMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.ICreateGlossaryMetadata); + + /** CreateGlossaryMetadata name. */ + public name: string; + + /** CreateGlossaryMetadata state. */ + public state: (google.cloud.translation.v3.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.CreateGlossaryMetadata.State); + + /** CreateGlossaryMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CreateGlossaryMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateGlossaryMetadata instance + */ + public static create(properties?: google.cloud.translation.v3.ICreateGlossaryMetadata): google.cloud.translation.v3.CreateGlossaryMetadata; + + /** + * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * @param message CreateGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * @param message CreateGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.CreateGlossaryMetadata; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.CreateGlossaryMetadata; + + /** + * Verifies a CreateGlossaryMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateGlossaryMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.CreateGlossaryMetadata; + + /** + * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. + * @param message CreateGlossaryMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.CreateGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateGlossaryMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateGlossaryMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CreateGlossaryMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a DeleteGlossaryMetadata. */ + interface IDeleteGlossaryMetadata { + + /** DeleteGlossaryMetadata name */ + name?: (string|null); + + /** DeleteGlossaryMetadata state */ + state?: (google.cloud.translation.v3.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.DeleteGlossaryMetadata.State|null); + + /** DeleteGlossaryMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DeleteGlossaryMetadata. */ + class DeleteGlossaryMetadata implements IDeleteGlossaryMetadata { + + /** + * Constructs a new DeleteGlossaryMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryMetadata); + + /** DeleteGlossaryMetadata name. */ + public name: string; + + /** DeleteGlossaryMetadata state. */ + public state: (google.cloud.translation.v3.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3.DeleteGlossaryMetadata.State); + + /** DeleteGlossaryMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DeleteGlossaryMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGlossaryMetadata instance + */ + public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryMetadata): google.cloud.translation.v3.DeleteGlossaryMetadata; + + /** + * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * @param message DeleteGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * @param message DeleteGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryMetadata; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryMetadata; + + /** + * Verifies a DeleteGlossaryMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGlossaryMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryMetadata; + + /** + * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. + * @param message DeleteGlossaryMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DeleteGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGlossaryMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteGlossaryMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DeleteGlossaryMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a DeleteGlossaryResponse. */ + interface IDeleteGlossaryResponse { + + /** DeleteGlossaryResponse name */ + name?: (string|null); + + /** DeleteGlossaryResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** DeleteGlossaryResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DeleteGlossaryResponse. */ + class DeleteGlossaryResponse implements IDeleteGlossaryResponse { + + /** + * Constructs a new DeleteGlossaryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IDeleteGlossaryResponse); + + /** DeleteGlossaryResponse name. */ + public name: string; + + /** DeleteGlossaryResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** DeleteGlossaryResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DeleteGlossaryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGlossaryResponse instance + */ + public static create(properties?: google.cloud.translation.v3.IDeleteGlossaryResponse): google.cloud.translation.v3.DeleteGlossaryResponse; + + /** + * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * @param message DeleteGlossaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * @param message DeleteGlossaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.DeleteGlossaryResponse; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.DeleteGlossaryResponse; + + /** + * Verifies a DeleteGlossaryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGlossaryResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.DeleteGlossaryResponse; + + /** + * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. + * @param message DeleteGlossaryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.DeleteGlossaryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGlossaryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteGlossaryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateDocumentRequest. */ + interface IBatchTranslateDocumentRequest { + + /** BatchTranslateDocumentRequest parent */ + parent?: (string|null); + + /** BatchTranslateDocumentRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** BatchTranslateDocumentRequest targetLanguageCodes */ + targetLanguageCodes?: (string[]|null); + + /** BatchTranslateDocumentRequest inputConfigs */ + inputConfigs?: (google.cloud.translation.v3.IBatchDocumentInputConfig[]|null); + + /** BatchTranslateDocumentRequest outputConfig */ + outputConfig?: (google.cloud.translation.v3.IBatchDocumentOutputConfig|null); + + /** BatchTranslateDocumentRequest models */ + models?: ({ [k: string]: string }|null); + + /** BatchTranslateDocumentRequest glossaries */ + glossaries?: ({ [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }|null); + + /** BatchTranslateDocumentRequest formatConversions */ + formatConversions?: ({ [k: string]: string }|null); + } + + /** Represents a BatchTranslateDocumentRequest. */ + class BatchTranslateDocumentRequest implements IBatchTranslateDocumentRequest { + + /** + * Constructs a new BatchTranslateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateDocumentRequest); + + /** BatchTranslateDocumentRequest parent. */ + public parent: string; + + /** BatchTranslateDocumentRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** BatchTranslateDocumentRequest targetLanguageCodes. */ + public targetLanguageCodes: string[]; + + /** BatchTranslateDocumentRequest inputConfigs. */ + public inputConfigs: google.cloud.translation.v3.IBatchDocumentInputConfig[]; + + /** BatchTranslateDocumentRequest outputConfig. */ + public outputConfig?: (google.cloud.translation.v3.IBatchDocumentOutputConfig|null); + + /** BatchTranslateDocumentRequest models. */ + public models: { [k: string]: string }; + + /** BatchTranslateDocumentRequest glossaries. */ + public glossaries: { [k: string]: google.cloud.translation.v3.ITranslateTextGlossaryConfig }; + + /** BatchTranslateDocumentRequest formatConversions. */ + public formatConversions: { [k: string]: string }; + + /** + * Creates a new BatchTranslateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateDocumentRequest instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateDocumentRequest): google.cloud.translation.v3.BatchTranslateDocumentRequest; + + /** + * Encodes the specified BatchTranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. + * @param message BatchTranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. + * @param message BatchTranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateDocumentRequest; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateDocumentRequest; + + /** + * Verifies a BatchTranslateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateDocumentRequest; + + /** + * Creates a plain object from a BatchTranslateDocumentRequest message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDocumentInputConfig. */ + interface IBatchDocumentInputConfig { + + /** BatchDocumentInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + } + + /** Represents a BatchDocumentInputConfig. */ + class BatchDocumentInputConfig implements IBatchDocumentInputConfig { + + /** + * Constructs a new BatchDocumentInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchDocumentInputConfig); + + /** BatchDocumentInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3.IGcsSource|null); + + /** BatchDocumentInputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new BatchDocumentInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDocumentInputConfig instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchDocumentInputConfig): google.cloud.translation.v3.BatchDocumentInputConfig; + + /** + * Encodes the specified BatchDocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. + * @param message BatchDocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. + * @param message BatchDocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchDocumentInputConfig; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchDocumentInputConfig; + + /** + * Verifies a BatchDocumentInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDocumentInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchDocumentInputConfig; + + /** + * Creates a plain object from a BatchDocumentInputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchDocumentInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDocumentInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDocumentInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDocumentOutputConfig. */ + interface IBatchDocumentOutputConfig { + + /** BatchDocumentOutputConfig gcsDestination */ + gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); + } + + /** Represents a BatchDocumentOutputConfig. */ + class BatchDocumentOutputConfig implements IBatchDocumentOutputConfig { + + /** + * Constructs a new BatchDocumentOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchDocumentOutputConfig); + + /** BatchDocumentOutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3.IGcsDestination|null); + + /** BatchDocumentOutputConfig destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new BatchDocumentOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDocumentOutputConfig instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchDocumentOutputConfig): google.cloud.translation.v3.BatchDocumentOutputConfig; + + /** + * Encodes the specified BatchDocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. + * @param message BatchDocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. + * @param message BatchDocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchDocumentOutputConfig; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchDocumentOutputConfig; + + /** + * Verifies a BatchDocumentOutputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDocumentOutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchDocumentOutputConfig; + + /** + * Creates a plain object from a BatchDocumentOutputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentOutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchDocumentOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDocumentOutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDocumentOutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateDocumentResponse. */ + interface IBatchTranslateDocumentResponse { + + /** BatchTranslateDocumentResponse totalPages */ + totalPages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse translatedPages */ + translatedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse failedPages */ + failedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse totalBillablePages */ + totalBillablePages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse totalBillableCharacters */ + totalBillableCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateDocumentResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateDocumentResponse. */ + class BatchTranslateDocumentResponse implements IBatchTranslateDocumentResponse { + + /** + * Constructs a new BatchTranslateDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateDocumentResponse); + + /** BatchTranslateDocumentResponse totalPages. */ + public totalPages: (number|Long|string); + + /** BatchTranslateDocumentResponse translatedPages. */ + public translatedPages: (number|Long|string); + + /** BatchTranslateDocumentResponse failedPages. */ + public failedPages: (number|Long|string); + + /** BatchTranslateDocumentResponse totalBillablePages. */ + public totalBillablePages: (number|Long|string); + + /** BatchTranslateDocumentResponse totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse totalBillableCharacters. */ + public totalBillableCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateDocumentResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateDocumentResponse instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateDocumentResponse): google.cloud.translation.v3.BatchTranslateDocumentResponse; + + /** + * Encodes the specified BatchTranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. + * @param message BatchTranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. + * @param message BatchTranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateDocumentResponse; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateDocumentResponse; + + /** + * Verifies a BatchTranslateDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateDocumentResponse; + + /** + * Creates a plain object from a BatchTranslateDocumentResponse message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateDocumentMetadata. */ + interface IBatchTranslateDocumentMetadata { + + /** BatchTranslateDocumentMetadata state */ + state?: (google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|null); + + /** BatchTranslateDocumentMetadata totalPages */ + totalPages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata translatedPages */ + translatedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata failedPages */ + failedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalBillablePages */ + totalBillablePages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalBillableCharacters */ + totalBillableCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateDocumentMetadata. */ + class BatchTranslateDocumentMetadata implements IBatchTranslateDocumentMetadata { + + /** + * Constructs a new BatchTranslateDocumentMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3.IBatchTranslateDocumentMetadata); + + /** BatchTranslateDocumentMetadata state. */ + public state: (google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|keyof typeof google.cloud.translation.v3.BatchTranslateDocumentMetadata.State); + + /** BatchTranslateDocumentMetadata totalPages. */ + public totalPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata translatedPages. */ + public translatedPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata failedPages. */ + public failedPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalBillablePages. */ + public totalBillablePages: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalBillableCharacters. */ + public totalBillableCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateDocumentMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateDocumentMetadata instance + */ + public static create(properties?: google.cloud.translation.v3.IBatchTranslateDocumentMetadata): google.cloud.translation.v3.BatchTranslateDocumentMetadata; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. + * @param message BatchTranslateDocumentMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3.IBatchTranslateDocumentMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. + * @param message BatchTranslateDocumentMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3.IBatchTranslateDocumentMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3.BatchTranslateDocumentMetadata; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3.BatchTranslateDocumentMetadata; + + /** + * Verifies a BatchTranslateDocumentMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateDocumentMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateDocumentMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3.BatchTranslateDocumentMetadata; + + /** + * Creates a plain object from a BatchTranslateDocumentMetadata message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3.BatchTranslateDocumentMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateDocumentMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateDocumentMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BatchTranslateDocumentMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + } + + /** Namespace v3beta1. */ + namespace v3beta1 { + + /** Represents a TranslationService */ + class TranslationService extends $protobuf.rpc.Service { + + /** + * Constructs a new TranslationService 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 TranslationService 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): TranslationService; + + /** + * Calls TranslateText. + * @param request TranslateTextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TranslateTextResponse + */ + public translateText(request: google.cloud.translation.v3beta1.ITranslateTextRequest, callback: google.cloud.translation.v3beta1.TranslationService.TranslateTextCallback): void; + + /** + * Calls TranslateText. + * @param request TranslateTextRequest message or plain object + * @returns Promise + */ + public translateText(request: google.cloud.translation.v3beta1.ITranslateTextRequest): Promise; + + /** + * Calls DetectLanguage. + * @param request DetectLanguageRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DetectLanguageResponse + */ + public detectLanguage(request: google.cloud.translation.v3beta1.IDetectLanguageRequest, callback: google.cloud.translation.v3beta1.TranslationService.DetectLanguageCallback): void; + + /** + * Calls DetectLanguage. + * @param request DetectLanguageRequest message or plain object + * @returns Promise + */ + public detectLanguage(request: google.cloud.translation.v3beta1.IDetectLanguageRequest): Promise; + + /** + * Calls GetSupportedLanguages. + * @param request GetSupportedLanguagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SupportedLanguages + */ + public getSupportedLanguages(request: google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, callback: google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguagesCallback): void; + + /** + * Calls GetSupportedLanguages. + * @param request GetSupportedLanguagesRequest message or plain object + * @returns Promise + */ + public getSupportedLanguages(request: google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest): Promise; + + /** + * Calls TranslateDocument. + * @param request TranslateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TranslateDocumentResponse + */ + public translateDocument(request: google.cloud.translation.v3beta1.ITranslateDocumentRequest, callback: google.cloud.translation.v3beta1.TranslationService.TranslateDocumentCallback): void; + + /** + * Calls TranslateDocument. + * @param request TranslateDocumentRequest message or plain object + * @returns Promise + */ + public translateDocument(request: google.cloud.translation.v3beta1.ITranslateDocumentRequest): Promise; + + /** + * Calls BatchTranslateText. + * @param request BatchTranslateTextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchTranslateText(request: google.cloud.translation.v3beta1.IBatchTranslateTextRequest, callback: google.cloud.translation.v3beta1.TranslationService.BatchTranslateTextCallback): void; + + /** + * Calls BatchTranslateText. + * @param request BatchTranslateTextRequest message or plain object + * @returns Promise + */ + public batchTranslateText(request: google.cloud.translation.v3beta1.IBatchTranslateTextRequest): Promise; + + /** + * Calls BatchTranslateDocument. + * @param request BatchTranslateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchTranslateDocument(request: google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest, callback: google.cloud.translation.v3beta1.TranslationService.BatchTranslateDocumentCallback): void; + + /** + * Calls BatchTranslateDocument. + * @param request BatchTranslateDocumentRequest message or plain object + * @returns Promise + */ + public batchTranslateDocument(request: google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest): Promise; + + /** + * Calls CreateGlossary. + * @param request CreateGlossaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createGlossary(request: google.cloud.translation.v3beta1.ICreateGlossaryRequest, callback: google.cloud.translation.v3beta1.TranslationService.CreateGlossaryCallback): void; + + /** + * Calls CreateGlossary. + * @param request CreateGlossaryRequest message or plain object + * @returns Promise + */ + public createGlossary(request: google.cloud.translation.v3beta1.ICreateGlossaryRequest): Promise; + + /** + * Calls ListGlossaries. + * @param request ListGlossariesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListGlossariesResponse + */ + public listGlossaries(request: google.cloud.translation.v3beta1.IListGlossariesRequest, callback: google.cloud.translation.v3beta1.TranslationService.ListGlossariesCallback): void; + + /** + * Calls ListGlossaries. + * @param request ListGlossariesRequest message or plain object + * @returns Promise + */ + public listGlossaries(request: google.cloud.translation.v3beta1.IListGlossariesRequest): Promise; + + /** + * Calls GetGlossary. + * @param request GetGlossaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Glossary + */ + public getGlossary(request: google.cloud.translation.v3beta1.IGetGlossaryRequest, callback: google.cloud.translation.v3beta1.TranslationService.GetGlossaryCallback): void; + + /** + * Calls GetGlossary. + * @param request GetGlossaryRequest message or plain object + * @returns Promise + */ + public getGlossary(request: google.cloud.translation.v3beta1.IGetGlossaryRequest): Promise; + + /** + * Calls DeleteGlossary. + * @param request DeleteGlossaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteGlossary(request: google.cloud.translation.v3beta1.IDeleteGlossaryRequest, callback: google.cloud.translation.v3beta1.TranslationService.DeleteGlossaryCallback): void; + + /** + * Calls DeleteGlossary. + * @param request DeleteGlossaryRequest message or plain object + * @returns Promise + */ + public deleteGlossary(request: google.cloud.translation.v3beta1.IDeleteGlossaryRequest): Promise; + } + + namespace TranslationService { + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|translateText}. + * @param error Error, if any + * @param [response] TranslateTextResponse + */ + type TranslateTextCallback = (error: (Error|null), response?: google.cloud.translation.v3beta1.TranslateTextResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|detectLanguage}. + * @param error Error, if any + * @param [response] DetectLanguageResponse + */ + type DetectLanguageCallback = (error: (Error|null), response?: google.cloud.translation.v3beta1.DetectLanguageResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|getSupportedLanguages}. + * @param error Error, if any + * @param [response] SupportedLanguages + */ + type GetSupportedLanguagesCallback = (error: (Error|null), response?: google.cloud.translation.v3beta1.SupportedLanguages) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|translateDocument}. + * @param error Error, if any + * @param [response] TranslateDocumentResponse + */ + type TranslateDocumentCallback = (error: (Error|null), response?: google.cloud.translation.v3beta1.TranslateDocumentResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|batchTranslateText}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchTranslateTextCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|batchTranslateDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchTranslateDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|createGlossary}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateGlossaryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|listGlossaries}. + * @param error Error, if any + * @param [response] ListGlossariesResponse + */ + type ListGlossariesCallback = (error: (Error|null), response?: google.cloud.translation.v3beta1.ListGlossariesResponse) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|getGlossary}. + * @param error Error, if any + * @param [response] Glossary + */ + type GetGlossaryCallback = (error: (Error|null), response?: google.cloud.translation.v3beta1.Glossary) => void; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|deleteGlossary}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteGlossaryCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a TranslateTextGlossaryConfig. */ + interface ITranslateTextGlossaryConfig { + + /** TranslateTextGlossaryConfig glossary */ + glossary?: (string|null); + + /** TranslateTextGlossaryConfig ignoreCase */ + ignoreCase?: (boolean|null); + } + + /** Represents a TranslateTextGlossaryConfig. */ + class TranslateTextGlossaryConfig implements ITranslateTextGlossaryConfig { + + /** + * Constructs a new TranslateTextGlossaryConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig); + + /** TranslateTextGlossaryConfig glossary. */ + public glossary: string; + + /** TranslateTextGlossaryConfig ignoreCase. */ + public ignoreCase: boolean; + + /** + * Creates a new TranslateTextGlossaryConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateTextGlossaryConfig instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig): google.cloud.translation.v3beta1.TranslateTextGlossaryConfig; + + /** + * Encodes the specified TranslateTextGlossaryConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify|verify} messages. + * @param message TranslateTextGlossaryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateTextGlossaryConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify|verify} messages. + * @param message TranslateTextGlossaryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.TranslateTextGlossaryConfig; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.TranslateTextGlossaryConfig; + + /** + * Verifies a TranslateTextGlossaryConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateTextGlossaryConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateTextGlossaryConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.TranslateTextGlossaryConfig; + + /** + * Creates a plain object from a TranslateTextGlossaryConfig message. Also converts values to other types if specified. + * @param message TranslateTextGlossaryConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.TranslateTextGlossaryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateTextGlossaryConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateTextGlossaryConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TranslateTextRequest. */ + interface ITranslateTextRequest { + + /** TranslateTextRequest contents */ + contents?: (string[]|null); + + /** TranslateTextRequest mimeType */ + mimeType?: (string|null); + + /** TranslateTextRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** TranslateTextRequest targetLanguageCode */ + targetLanguageCode?: (string|null); + + /** TranslateTextRequest parent */ + parent?: (string|null); + + /** TranslateTextRequest model */ + model?: (string|null); + + /** TranslateTextRequest glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + + /** TranslateTextRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a TranslateTextRequest. */ + class TranslateTextRequest implements ITranslateTextRequest { + + /** + * Constructs a new TranslateTextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ITranslateTextRequest); + + /** TranslateTextRequest contents. */ + public contents: string[]; + + /** TranslateTextRequest mimeType. */ + public mimeType: string; + + /** TranslateTextRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** TranslateTextRequest targetLanguageCode. */ + public targetLanguageCode: string; + + /** TranslateTextRequest parent. */ + public parent: string; + + /** TranslateTextRequest model. */ + public model: string; + + /** TranslateTextRequest glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + + /** TranslateTextRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new TranslateTextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateTextRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ITranslateTextRequest): google.cloud.translation.v3beta1.TranslateTextRequest; + + /** + * Encodes the specified TranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextRequest.verify|verify} messages. + * @param message TranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ITranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextRequest.verify|verify} messages. + * @param message TranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ITranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.TranslateTextRequest; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.TranslateTextRequest; + + /** + * Verifies a TranslateTextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateTextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.TranslateTextRequest; + + /** + * Creates a plain object from a TranslateTextRequest message. Also converts values to other types if specified. + * @param message TranslateTextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.TranslateTextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateTextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateTextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TranslateTextResponse. */ + interface ITranslateTextResponse { + + /** TranslateTextResponse translations */ + translations?: (google.cloud.translation.v3beta1.ITranslation[]|null); + + /** TranslateTextResponse glossaryTranslations */ + glossaryTranslations?: (google.cloud.translation.v3beta1.ITranslation[]|null); + } + + /** Represents a TranslateTextResponse. */ + class TranslateTextResponse implements ITranslateTextResponse { + + /** + * Constructs a new TranslateTextResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ITranslateTextResponse); + + /** TranslateTextResponse translations. */ + public translations: google.cloud.translation.v3beta1.ITranslation[]; + + /** TranslateTextResponse glossaryTranslations. */ + public glossaryTranslations: google.cloud.translation.v3beta1.ITranslation[]; + + /** + * Creates a new TranslateTextResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateTextResponse instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ITranslateTextResponse): google.cloud.translation.v3beta1.TranslateTextResponse; + + /** + * Encodes the specified TranslateTextResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextResponse.verify|verify} messages. + * @param message TranslateTextResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ITranslateTextResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateTextResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextResponse.verify|verify} messages. + * @param message TranslateTextResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ITranslateTextResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.TranslateTextResponse; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.TranslateTextResponse; + + /** + * Verifies a TranslateTextResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateTextResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateTextResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.TranslateTextResponse; + + /** + * Creates a plain object from a TranslateTextResponse message. Also converts values to other types if specified. + * @param message TranslateTextResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.TranslateTextResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateTextResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateTextResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Translation. */ + interface ITranslation { + + /** Translation translatedText */ + translatedText?: (string|null); + + /** Translation model */ + model?: (string|null); + + /** Translation detectedLanguageCode */ + detectedLanguageCode?: (string|null); + + /** Translation glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + } + + /** Represents a Translation. */ + class Translation implements ITranslation { + + /** + * Constructs a new Translation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ITranslation); + + /** Translation translatedText. */ + public translatedText: string; + + /** Translation model. */ + public model: string; + + /** Translation detectedLanguageCode. */ + public detectedLanguageCode: string; + + /** Translation glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + + /** + * Creates a new Translation instance using the specified properties. + * @param [properties] Properties to set + * @returns Translation instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ITranslation): google.cloud.translation.v3beta1.Translation; + + /** + * Encodes the specified Translation message. Does not implicitly {@link google.cloud.translation.v3beta1.Translation.verify|verify} messages. + * @param message Translation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Translation.verify|verify} messages. + * @param message Translation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ITranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Translation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.Translation; + + /** + * Decodes a Translation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.Translation; + + /** + * Verifies a Translation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Translation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Translation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.Translation; + + /** + * Creates a plain object from a Translation message. Also converts values to other types if specified. + * @param message Translation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.Translation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Translation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Translation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DetectLanguageRequest. */ + interface IDetectLanguageRequest { + + /** DetectLanguageRequest parent */ + parent?: (string|null); + + /** DetectLanguageRequest model */ + model?: (string|null); + + /** DetectLanguageRequest content */ + content?: (string|null); + + /** DetectLanguageRequest mimeType */ + mimeType?: (string|null); + + /** DetectLanguageRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a DetectLanguageRequest. */ + class DetectLanguageRequest implements IDetectLanguageRequest { + + /** + * Constructs a new DetectLanguageRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDetectLanguageRequest); + + /** DetectLanguageRequest parent. */ + public parent: string; + + /** DetectLanguageRequest model. */ + public model: string; + + /** DetectLanguageRequest content. */ + public content?: (string|null); + + /** DetectLanguageRequest mimeType. */ + public mimeType: string; + + /** DetectLanguageRequest labels. */ + public labels: { [k: string]: string }; + + /** DetectLanguageRequest source. */ + public source?: "content"; + + /** + * Creates a new DetectLanguageRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectLanguageRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDetectLanguageRequest): google.cloud.translation.v3beta1.DetectLanguageRequest; + + /** + * Encodes the specified DetectLanguageRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageRequest.verify|verify} messages. + * @param message DetectLanguageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IDetectLanguageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectLanguageRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageRequest.verify|verify} messages. + * @param message DetectLanguageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IDetectLanguageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.DetectLanguageRequest; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.DetectLanguageRequest; + + /** + * Verifies a DetectLanguageRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectLanguageRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectLanguageRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.DetectLanguageRequest; + + /** + * Creates a plain object from a DetectLanguageRequest message. Also converts values to other types if specified. + * @param message DetectLanguageRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.DetectLanguageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectLanguageRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectLanguageRequest + * @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.translation.v3beta1.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.translation.v3beta1.IDetectedLanguage): google.cloud.translation.v3beta1.DetectedLanguage; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.IDetectedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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 a DetectLanguageResponse. */ + interface IDetectLanguageResponse { + + /** DetectLanguageResponse languages */ + languages?: (google.cloud.translation.v3beta1.IDetectedLanguage[]|null); + } + + /** Represents a DetectLanguageResponse. */ + class DetectLanguageResponse implements IDetectLanguageResponse { + + /** + * Constructs a new DetectLanguageResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDetectLanguageResponse); + + /** DetectLanguageResponse languages. */ + public languages: google.cloud.translation.v3beta1.IDetectedLanguage[]; + + /** + * Creates a new DetectLanguageResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectLanguageResponse instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDetectLanguageResponse): google.cloud.translation.v3beta1.DetectLanguageResponse; + + /** + * Encodes the specified DetectLanguageResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageResponse.verify|verify} messages. + * @param message DetectLanguageResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IDetectLanguageResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectLanguageResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageResponse.verify|verify} messages. + * @param message DetectLanguageResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IDetectLanguageResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.DetectLanguageResponse; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.DetectLanguageResponse; + + /** + * Verifies a DetectLanguageResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectLanguageResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectLanguageResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.DetectLanguageResponse; + + /** + * Creates a plain object from a DetectLanguageResponse message. Also converts values to other types if specified. + * @param message DetectLanguageResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.DetectLanguageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectLanguageResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectLanguageResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetSupportedLanguagesRequest. */ + interface IGetSupportedLanguagesRequest { + + /** GetSupportedLanguagesRequest parent */ + parent?: (string|null); + + /** GetSupportedLanguagesRequest displayLanguageCode */ + displayLanguageCode?: (string|null); + + /** GetSupportedLanguagesRequest model */ + model?: (string|null); + } + + /** Represents a GetSupportedLanguagesRequest. */ + class GetSupportedLanguagesRequest implements IGetSupportedLanguagesRequest { + + /** + * Constructs a new GetSupportedLanguagesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest); + + /** GetSupportedLanguagesRequest parent. */ + public parent: string; + + /** GetSupportedLanguagesRequest displayLanguageCode. */ + public displayLanguageCode: string; + + /** GetSupportedLanguagesRequest model. */ + public model: string; + + /** + * Creates a new GetSupportedLanguagesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSupportedLanguagesRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest): google.cloud.translation.v3beta1.GetSupportedLanguagesRequest; + + /** + * Encodes the specified GetSupportedLanguagesRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.GetSupportedLanguagesRequest.verify|verify} messages. + * @param message GetSupportedLanguagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSupportedLanguagesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GetSupportedLanguagesRequest.verify|verify} messages. + * @param message GetSupportedLanguagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.GetSupportedLanguagesRequest; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.GetSupportedLanguagesRequest; + + /** + * Verifies a GetSupportedLanguagesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetSupportedLanguagesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSupportedLanguagesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.GetSupportedLanguagesRequest; + + /** + * Creates a plain object from a GetSupportedLanguagesRequest message. Also converts values to other types if specified. + * @param message GetSupportedLanguagesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.GetSupportedLanguagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSupportedLanguagesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetSupportedLanguagesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SupportedLanguages. */ + interface ISupportedLanguages { + + /** SupportedLanguages languages */ + languages?: (google.cloud.translation.v3beta1.ISupportedLanguage[]|null); + } + + /** Represents a SupportedLanguages. */ + class SupportedLanguages implements ISupportedLanguages { + + /** + * Constructs a new SupportedLanguages. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ISupportedLanguages); + + /** SupportedLanguages languages. */ + public languages: google.cloud.translation.v3beta1.ISupportedLanguage[]; + + /** + * Creates a new SupportedLanguages instance using the specified properties. + * @param [properties] Properties to set + * @returns SupportedLanguages instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ISupportedLanguages): google.cloud.translation.v3beta1.SupportedLanguages; + + /** + * Encodes the specified SupportedLanguages message. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguages.verify|verify} messages. + * @param message SupportedLanguages message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ISupportedLanguages, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SupportedLanguages message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguages.verify|verify} messages. + * @param message SupportedLanguages message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ISupportedLanguages, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.SupportedLanguages; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.SupportedLanguages; + + /** + * Verifies a SupportedLanguages message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SupportedLanguages message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SupportedLanguages + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.SupportedLanguages; + + /** + * Creates a plain object from a SupportedLanguages message. Also converts values to other types if specified. + * @param message SupportedLanguages + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.SupportedLanguages, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SupportedLanguages to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SupportedLanguages + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SupportedLanguage. */ + interface ISupportedLanguage { + + /** SupportedLanguage languageCode */ + languageCode?: (string|null); + + /** SupportedLanguage displayName */ + displayName?: (string|null); + + /** SupportedLanguage supportSource */ + supportSource?: (boolean|null); + + /** SupportedLanguage supportTarget */ + supportTarget?: (boolean|null); + } + + /** Represents a SupportedLanguage. */ + class SupportedLanguage implements ISupportedLanguage { + + /** + * Constructs a new SupportedLanguage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ISupportedLanguage); + + /** SupportedLanguage languageCode. */ + public languageCode: string; + + /** SupportedLanguage displayName. */ + public displayName: string; + + /** SupportedLanguage supportSource. */ + public supportSource: boolean; + + /** SupportedLanguage supportTarget. */ + public supportTarget: boolean; + + /** + * Creates a new SupportedLanguage instance using the specified properties. + * @param [properties] Properties to set + * @returns SupportedLanguage instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ISupportedLanguage): google.cloud.translation.v3beta1.SupportedLanguage; + + /** + * Encodes the specified SupportedLanguage message. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguage.verify|verify} messages. + * @param message SupportedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ISupportedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SupportedLanguage message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguage.verify|verify} messages. + * @param message SupportedLanguage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ISupportedLanguage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.SupportedLanguage; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.SupportedLanguage; + + /** + * Verifies a SupportedLanguage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SupportedLanguage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SupportedLanguage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.SupportedLanguage; + + /** + * Creates a plain object from a SupportedLanguage message. Also converts values to other types if specified. + * @param message SupportedLanguage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.SupportedLanguage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SupportedLanguage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SupportedLanguage + * @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 inputUri */ + inputUri?: (string|null); + } + + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { + + /** + * Constructs a new GcsSource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IGcsSource); + + /** GcsSource inputUri. */ + public inputUri: string; + + /** + * Creates a new GcsSource instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSource instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IGcsSource): google.cloud.translation.v3beta1.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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 an InputConfig. */ + interface IInputConfig { + + /** InputConfig mimeType */ + mimeType?: (string|null); + + /** InputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + } + + /** Represents an InputConfig. */ + class InputConfig implements IInputConfig { + + /** + * Constructs a new InputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IInputConfig); + + /** InputConfig mimeType. */ + public mimeType: string; + + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + + /** 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.translation.v3beta1.IInputConfig): google.cloud.translation.v3beta1.InputConfig; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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 a GcsDestination. */ + interface IGcsDestination { + + /** GcsDestination outputUriPrefix */ + outputUriPrefix?: (string|null); + } + + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { + + /** + * Constructs a new GcsDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IGcsDestination); + + /** GcsDestination outputUriPrefix. */ + public outputUriPrefix: string; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDestination instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IGcsDestination): google.cloud.translation.v3beta1.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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 OutputConfig. */ + interface IOutputConfig { + + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.translation.v3beta1.IGcsDestination|null); + } + + /** Represents an OutputConfig. */ + class OutputConfig implements IOutputConfig { + + /** + * Constructs a new OutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IOutputConfig); + + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3beta1.IGcsDestination|null); + + /** 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.translation.v3beta1.IOutputConfig): google.cloud.translation.v3beta1.OutputConfig; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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 DocumentInputConfig. */ + interface IDocumentInputConfig { + + /** DocumentInputConfig content */ + content?: (Uint8Array|string|null); + + /** DocumentInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + + /** DocumentInputConfig mimeType */ + mimeType?: (string|null); + } + + /** Represents a DocumentInputConfig. */ + class DocumentInputConfig implements IDocumentInputConfig { + + /** + * Constructs a new DocumentInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDocumentInputConfig); + + /** DocumentInputConfig content. */ + public content?: (Uint8Array|string|null); + + /** DocumentInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + + /** DocumentInputConfig mimeType. */ + public mimeType: string; + + /** DocumentInputConfig source. */ + public source?: ("content"|"gcsSource"); + + /** + * Creates a new DocumentInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentInputConfig instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDocumentInputConfig): google.cloud.translation.v3beta1.DocumentInputConfig; + + /** + * Encodes the specified DocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentInputConfig.verify|verify} messages. + * @param message DocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentInputConfig.verify|verify} messages. + * @param message DocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.DocumentInputConfig; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.DocumentInputConfig; + + /** + * Verifies a DocumentInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.DocumentInputConfig; + + /** + * Creates a plain object from a DocumentInputConfig message. Also converts values to other types if specified. + * @param message DocumentInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.DocumentInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentInputConfig + * @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 gcsDestination */ + gcsDestination?: (google.cloud.translation.v3beta1.IGcsDestination|null); + + /** DocumentOutputConfig mimeType */ + mimeType?: (string|null); + } + + /** Represents a DocumentOutputConfig. */ + class DocumentOutputConfig implements IDocumentOutputConfig { + + /** + * Constructs a new DocumentOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDocumentOutputConfig); + + /** DocumentOutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3beta1.IGcsDestination|null); + + /** DocumentOutputConfig mimeType. */ + public mimeType: string; + + /** DocumentOutputConfig destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentOutputConfig instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDocumentOutputConfig): google.cloud.translation.v3beta1.DocumentOutputConfig; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.IDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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; + } + + /** Properties of a TranslateDocumentRequest. */ + interface ITranslateDocumentRequest { + + /** TranslateDocumentRequest parent */ + parent?: (string|null); + + /** TranslateDocumentRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** TranslateDocumentRequest targetLanguageCode */ + targetLanguageCode?: (string|null); + + /** TranslateDocumentRequest documentInputConfig */ + documentInputConfig?: (google.cloud.translation.v3beta1.IDocumentInputConfig|null); + + /** TranslateDocumentRequest documentOutputConfig */ + documentOutputConfig?: (google.cloud.translation.v3beta1.IDocumentOutputConfig|null); + + /** TranslateDocumentRequest model */ + model?: (string|null); + + /** TranslateDocumentRequest glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + + /** TranslateDocumentRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a TranslateDocumentRequest. */ + class TranslateDocumentRequest implements ITranslateDocumentRequest { + + /** + * Constructs a new TranslateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ITranslateDocumentRequest); + + /** TranslateDocumentRequest parent. */ + public parent: string; + + /** TranslateDocumentRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** TranslateDocumentRequest targetLanguageCode. */ + public targetLanguageCode: string; + + /** TranslateDocumentRequest documentInputConfig. */ + public documentInputConfig?: (google.cloud.translation.v3beta1.IDocumentInputConfig|null); + + /** TranslateDocumentRequest documentOutputConfig. */ + public documentOutputConfig?: (google.cloud.translation.v3beta1.IDocumentOutputConfig|null); + + /** TranslateDocumentRequest model. */ + public model: string; + + /** TranslateDocumentRequest glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + + /** TranslateDocumentRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new TranslateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateDocumentRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ITranslateDocumentRequest): google.cloud.translation.v3beta1.TranslateDocumentRequest; + + /** + * Encodes the specified TranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentRequest.verify|verify} messages. + * @param message TranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ITranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentRequest.verify|verify} messages. + * @param message TranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ITranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.TranslateDocumentRequest; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.TranslateDocumentRequest; + + /** + * Verifies a TranslateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.TranslateDocumentRequest; + + /** + * Creates a plain object from a TranslateDocumentRequest message. Also converts values to other types if specified. + * @param message TranslateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.TranslateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentTranslation. */ + interface IDocumentTranslation { + + /** DocumentTranslation byteStreamOutputs */ + byteStreamOutputs?: (Uint8Array[]|null); + + /** DocumentTranslation mimeType */ + mimeType?: (string|null); + + /** DocumentTranslation detectedLanguageCode */ + detectedLanguageCode?: (string|null); + } + + /** Represents a DocumentTranslation. */ + class DocumentTranslation implements IDocumentTranslation { + + /** + * Constructs a new DocumentTranslation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDocumentTranslation); + + /** DocumentTranslation byteStreamOutputs. */ + public byteStreamOutputs: Uint8Array[]; + + /** DocumentTranslation mimeType. */ + public mimeType: string; + + /** DocumentTranslation detectedLanguageCode. */ + public detectedLanguageCode: string; + + /** + * Creates a new DocumentTranslation instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentTranslation instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDocumentTranslation): google.cloud.translation.v3beta1.DocumentTranslation; + + /** + * Encodes the specified DocumentTranslation message. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentTranslation.verify|verify} messages. + * @param message DocumentTranslation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IDocumentTranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentTranslation message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentTranslation.verify|verify} messages. + * @param message DocumentTranslation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IDocumentTranslation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.DocumentTranslation; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.DocumentTranslation; + + /** + * Verifies a DocumentTranslation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentTranslation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentTranslation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.DocumentTranslation; + + /** + * Creates a plain object from a DocumentTranslation message. Also converts values to other types if specified. + * @param message DocumentTranslation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.DocumentTranslation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentTranslation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentTranslation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TranslateDocumentResponse. */ + interface ITranslateDocumentResponse { + + /** TranslateDocumentResponse documentTranslation */ + documentTranslation?: (google.cloud.translation.v3beta1.IDocumentTranslation|null); + + /** TranslateDocumentResponse glossaryDocumentTranslation */ + glossaryDocumentTranslation?: (google.cloud.translation.v3beta1.IDocumentTranslation|null); + + /** TranslateDocumentResponse model */ + model?: (string|null); + + /** TranslateDocumentResponse glossaryConfig */ + glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + } + + /** Represents a TranslateDocumentResponse. */ + class TranslateDocumentResponse implements ITranslateDocumentResponse { + + /** + * Constructs a new TranslateDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ITranslateDocumentResponse); + + /** TranslateDocumentResponse documentTranslation. */ + public documentTranslation?: (google.cloud.translation.v3beta1.IDocumentTranslation|null); + + /** TranslateDocumentResponse glossaryDocumentTranslation. */ + public glossaryDocumentTranslation?: (google.cloud.translation.v3beta1.IDocumentTranslation|null); + + /** TranslateDocumentResponse model. */ + public model: string; + + /** TranslateDocumentResponse glossaryConfig. */ + public glossaryConfig?: (google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null); + + /** + * Creates a new TranslateDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TranslateDocumentResponse instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ITranslateDocumentResponse): google.cloud.translation.v3beta1.TranslateDocumentResponse; + + /** + * Encodes the specified TranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentResponse.verify|verify} messages. + * @param message TranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ITranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentResponse.verify|verify} messages. + * @param message TranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ITranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.TranslateDocumentResponse; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.TranslateDocumentResponse; + + /** + * Verifies a TranslateDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TranslateDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.TranslateDocumentResponse; + + /** + * Creates a plain object from a TranslateDocumentResponse message. Also converts values to other types if specified. + * @param message TranslateDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.TranslateDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TranslateDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TranslateDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateTextRequest. */ + interface IBatchTranslateTextRequest { + + /** BatchTranslateTextRequest parent */ + parent?: (string|null); + + /** BatchTranslateTextRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** BatchTranslateTextRequest targetLanguageCodes */ + targetLanguageCodes?: (string[]|null); + + /** BatchTranslateTextRequest models */ + models?: ({ [k: string]: string }|null); + + /** BatchTranslateTextRequest inputConfigs */ + inputConfigs?: (google.cloud.translation.v3beta1.IInputConfig[]|null); + + /** BatchTranslateTextRequest outputConfig */ + outputConfig?: (google.cloud.translation.v3beta1.IOutputConfig|null); + + /** BatchTranslateTextRequest glossaries */ + glossaries?: ({ [k: string]: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig }|null); + + /** BatchTranslateTextRequest labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a BatchTranslateTextRequest. */ + class BatchTranslateTextRequest implements IBatchTranslateTextRequest { + + /** + * Constructs a new BatchTranslateTextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchTranslateTextRequest); + + /** BatchTranslateTextRequest parent. */ + public parent: string; + + /** BatchTranslateTextRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** BatchTranslateTextRequest targetLanguageCodes. */ + public targetLanguageCodes: string[]; + + /** BatchTranslateTextRequest models. */ + public models: { [k: string]: string }; + + /** BatchTranslateTextRequest inputConfigs. */ + public inputConfigs: google.cloud.translation.v3beta1.IInputConfig[]; + + /** BatchTranslateTextRequest outputConfig. */ + public outputConfig?: (google.cloud.translation.v3beta1.IOutputConfig|null); + + /** BatchTranslateTextRequest glossaries. */ + public glossaries: { [k: string]: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig }; + + /** BatchTranslateTextRequest labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new BatchTranslateTextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateTextRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchTranslateTextRequest): google.cloud.translation.v3beta1.BatchTranslateTextRequest; + + /** + * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateTextRequest.verify|verify} messages. + * @param message BatchTranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateTextRequest.verify|verify} messages. + * @param message BatchTranslateTextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchTranslateTextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchTranslateTextRequest; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchTranslateTextRequest; + + /** + * Verifies a BatchTranslateTextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateTextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchTranslateTextRequest; + + /** + * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. + * @param message BatchTranslateTextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchTranslateTextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateTextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateTextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateMetadata. */ + interface IBatchTranslateMetadata { + + /** BatchTranslateMetadata state */ + state?: (google.cloud.translation.v3beta1.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3beta1.BatchTranslateMetadata.State|null); + + /** BatchTranslateMetadata translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateMetadata. */ + class BatchTranslateMetadata implements IBatchTranslateMetadata { + + /** + * Constructs a new BatchTranslateMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchTranslateMetadata); + + /** BatchTranslateMetadata state. */ + public state: (google.cloud.translation.v3beta1.BatchTranslateMetadata.State|keyof typeof google.cloud.translation.v3beta1.BatchTranslateMetadata.State); + + /** BatchTranslateMetadata translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateMetadata failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateMetadata totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateMetadata instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchTranslateMetadata): google.cloud.translation.v3beta1.BatchTranslateMetadata; + + /** + * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateMetadata.verify|verify} messages. + * @param message BatchTranslateMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateMetadata.verify|verify} messages. + * @param message BatchTranslateMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchTranslateMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchTranslateMetadata; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchTranslateMetadata; + + /** + * Verifies a BatchTranslateMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchTranslateMetadata; + + /** + * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. + * @param message BatchTranslateMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchTranslateMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BatchTranslateMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a BatchTranslateResponse. */ + interface IBatchTranslateResponse { + + /** BatchTranslateResponse totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateResponse. */ + class BatchTranslateResponse implements IBatchTranslateResponse { + + /** + * Constructs a new BatchTranslateResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchTranslateResponse); + + /** BatchTranslateResponse totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateResponse translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateResponse failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateResponse instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchTranslateResponse): google.cloud.translation.v3beta1.BatchTranslateResponse; + + /** + * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateResponse.verify|verify} messages. + * @param message BatchTranslateResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateResponse.verify|verify} messages. + * @param message BatchTranslateResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchTranslateResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchTranslateResponse; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchTranslateResponse; + + /** + * Verifies a BatchTranslateResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchTranslateResponse; + + /** + * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. + * @param message BatchTranslateResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchTranslateResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GlossaryInputConfig. */ + interface IGlossaryInputConfig { + + /** GlossaryInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + } + + /** Represents a GlossaryInputConfig. */ + class GlossaryInputConfig implements IGlossaryInputConfig { + + /** + * Constructs a new GlossaryInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IGlossaryInputConfig); + + /** GlossaryInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + + /** GlossaryInputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new GlossaryInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GlossaryInputConfig instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IGlossaryInputConfig): google.cloud.translation.v3beta1.GlossaryInputConfig; + + /** + * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.GlossaryInputConfig.verify|verify} messages. + * @param message GlossaryInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GlossaryInputConfig.verify|verify} messages. + * @param message GlossaryInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IGlossaryInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.GlossaryInputConfig; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.GlossaryInputConfig; + + /** + * Verifies a GlossaryInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GlossaryInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.GlossaryInputConfig; + + /** + * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. + * @param message GlossaryInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.GlossaryInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GlossaryInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GlossaryInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Glossary. */ + interface IGlossary { + + /** Glossary name */ + name?: (string|null); + + /** Glossary languagePair */ + languagePair?: (google.cloud.translation.v3beta1.Glossary.ILanguageCodePair|null); + + /** Glossary languageCodesSet */ + languageCodesSet?: (google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet|null); + + /** Glossary inputConfig */ + inputConfig?: (google.cloud.translation.v3beta1.IGlossaryInputConfig|null); + + /** Glossary entryCount */ + entryCount?: (number|null); + + /** Glossary submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** Glossary endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Glossary. */ + class Glossary implements IGlossary { + + /** + * Constructs a new Glossary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IGlossary); + + /** Glossary name. */ + public name: string; + + /** Glossary languagePair. */ + public languagePair?: (google.cloud.translation.v3beta1.Glossary.ILanguageCodePair|null); + + /** Glossary languageCodesSet. */ + public languageCodesSet?: (google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet|null); + + /** Glossary inputConfig. */ + public inputConfig?: (google.cloud.translation.v3beta1.IGlossaryInputConfig|null); + + /** Glossary entryCount. */ + public entryCount: number; + + /** Glossary submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** Glossary endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** Glossary languages. */ + public languages?: ("languagePair"|"languageCodesSet"); + + /** + * Creates a new Glossary instance using the specified properties. + * @param [properties] Properties to set + * @returns Glossary instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IGlossary): google.cloud.translation.v3beta1.Glossary; + + /** + * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.verify|verify} messages. + * @param message Glossary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.verify|verify} messages. + * @param message Glossary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IGlossary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Glossary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.Glossary; + + /** + * Decodes a Glossary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.Glossary; + + /** + * Verifies a Glossary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Glossary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.Glossary; + + /** + * Creates a plain object from a Glossary message. Also converts values to other types if specified. + * @param message Glossary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.Glossary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Glossary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Glossary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Glossary { + + /** Properties of a LanguageCodePair. */ + interface ILanguageCodePair { + + /** LanguageCodePair sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** LanguageCodePair targetLanguageCode */ + targetLanguageCode?: (string|null); + } + + /** Represents a LanguageCodePair. */ + class LanguageCodePair implements ILanguageCodePair { + + /** + * Constructs a new LanguageCodePair. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.Glossary.ILanguageCodePair); + + /** LanguageCodePair sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** LanguageCodePair targetLanguageCode. */ + public targetLanguageCode: string; + + /** + * Creates a new LanguageCodePair instance using the specified properties. + * @param [properties] Properties to set + * @returns LanguageCodePair instance + */ + public static create(properties?: google.cloud.translation.v3beta1.Glossary.ILanguageCodePair): google.cloud.translation.v3beta1.Glossary.LanguageCodePair; + + /** + * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodePair.verify|verify} messages. + * @param message LanguageCodePair message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodePair.verify|verify} messages. + * @param message LanguageCodePair message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.Glossary.ILanguageCodePair, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.Glossary.LanguageCodePair; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.Glossary.LanguageCodePair; + + /** + * Verifies a LanguageCodePair message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LanguageCodePair + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.Glossary.LanguageCodePair; + + /** + * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. + * @param message LanguageCodePair + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.Glossary.LanguageCodePair, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LanguageCodePair to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LanguageCodePair + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LanguageCodesSet. */ + interface ILanguageCodesSet { + + /** LanguageCodesSet languageCodes */ + languageCodes?: (string[]|null); + } + + /** Represents a LanguageCodesSet. */ + class LanguageCodesSet implements ILanguageCodesSet { + + /** + * Constructs a new LanguageCodesSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet); + + /** LanguageCodesSet languageCodes. */ + public languageCodes: string[]; + + /** + * Creates a new LanguageCodesSet instance using the specified properties. + * @param [properties] Properties to set + * @returns LanguageCodesSet instance + */ + public static create(properties?: google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet): google.cloud.translation.v3beta1.Glossary.LanguageCodesSet; + + /** + * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.verify|verify} messages. + * @param message LanguageCodesSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.verify|verify} messages. + * @param message LanguageCodesSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.Glossary.LanguageCodesSet; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.Glossary.LanguageCodesSet; + + /** + * Verifies a LanguageCodesSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LanguageCodesSet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.Glossary.LanguageCodesSet; + + /** + * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. + * @param message LanguageCodesSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.Glossary.LanguageCodesSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LanguageCodesSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LanguageCodesSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a CreateGlossaryRequest. */ + interface ICreateGlossaryRequest { + + /** CreateGlossaryRequest parent */ + parent?: (string|null); + + /** CreateGlossaryRequest glossary */ + glossary?: (google.cloud.translation.v3beta1.IGlossary|null); + } + + /** Represents a CreateGlossaryRequest. */ + class CreateGlossaryRequest implements ICreateGlossaryRequest { + + /** + * Constructs a new CreateGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ICreateGlossaryRequest); + + /** CreateGlossaryRequest parent. */ + public parent: string; + + /** CreateGlossaryRequest glossary. */ + public glossary?: (google.cloud.translation.v3beta1.IGlossary|null); + + /** + * Creates a new CreateGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ICreateGlossaryRequest): google.cloud.translation.v3beta1.CreateGlossaryRequest; + + /** + * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryRequest.verify|verify} messages. + * @param message CreateGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryRequest.verify|verify} messages. + * @param message CreateGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ICreateGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.CreateGlossaryRequest; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.CreateGlossaryRequest; + + /** + * Verifies a CreateGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.CreateGlossaryRequest; + + /** + * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. + * @param message CreateGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.CreateGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateGlossaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetGlossaryRequest. */ + interface IGetGlossaryRequest { + + /** GetGlossaryRequest name */ + name?: (string|null); + } + + /** Represents a GetGlossaryRequest. */ + class GetGlossaryRequest implements IGetGlossaryRequest { + + /** + * Constructs a new GetGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IGetGlossaryRequest); + + /** GetGlossaryRequest name. */ + public name: string; + + /** + * Creates a new GetGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IGetGlossaryRequest): google.cloud.translation.v3beta1.GetGlossaryRequest; + + /** + * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.GetGlossaryRequest.verify|verify} messages. + * @param message GetGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GetGlossaryRequest.verify|verify} messages. + * @param message GetGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IGetGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.GetGlossaryRequest; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.GetGlossaryRequest; + + /** + * Verifies a GetGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.GetGlossaryRequest; + + /** + * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. + * @param message GetGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.GetGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetGlossaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteGlossaryRequest. */ + interface IDeleteGlossaryRequest { + + /** DeleteGlossaryRequest name */ + name?: (string|null); + } + + /** Represents a DeleteGlossaryRequest. */ + class DeleteGlossaryRequest implements IDeleteGlossaryRequest { + + /** + * Constructs a new DeleteGlossaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDeleteGlossaryRequest); + + /** DeleteGlossaryRequest name. */ + public name: string; + + /** + * Creates a new DeleteGlossaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGlossaryRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDeleteGlossaryRequest): google.cloud.translation.v3beta1.DeleteGlossaryRequest; + + /** + * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryRequest.verify|verify} messages. + * @param message DeleteGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryRequest.verify|verify} messages. + * @param message DeleteGlossaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IDeleteGlossaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.DeleteGlossaryRequest; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.DeleteGlossaryRequest; + + /** + * Verifies a DeleteGlossaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGlossaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.DeleteGlossaryRequest; + + /** + * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. + * @param message DeleteGlossaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.DeleteGlossaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGlossaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteGlossaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListGlossariesRequest. */ + interface IListGlossariesRequest { + + /** ListGlossariesRequest parent */ + parent?: (string|null); + + /** ListGlossariesRequest pageSize */ + pageSize?: (number|null); + + /** ListGlossariesRequest pageToken */ + pageToken?: (string|null); + + /** ListGlossariesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListGlossariesRequest. */ + class ListGlossariesRequest implements IListGlossariesRequest { + + /** + * Constructs a new ListGlossariesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IListGlossariesRequest); + + /** ListGlossariesRequest parent. */ + public parent: string; + + /** ListGlossariesRequest pageSize. */ + public pageSize: number; + + /** ListGlossariesRequest pageToken. */ + public pageToken: string; + + /** ListGlossariesRequest filter. */ + public filter: string; + + /** + * Creates a new ListGlossariesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGlossariesRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IListGlossariesRequest): google.cloud.translation.v3beta1.ListGlossariesRequest; + + /** + * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesRequest.verify|verify} messages. + * @param message ListGlossariesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesRequest.verify|verify} messages. + * @param message ListGlossariesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IListGlossariesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.ListGlossariesRequest; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.ListGlossariesRequest; + + /** + * Verifies a ListGlossariesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGlossariesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.ListGlossariesRequest; + + /** + * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. + * @param message ListGlossariesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.ListGlossariesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGlossariesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGlossariesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListGlossariesResponse. */ + interface IListGlossariesResponse { + + /** ListGlossariesResponse glossaries */ + glossaries?: (google.cloud.translation.v3beta1.IGlossary[]|null); + + /** ListGlossariesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListGlossariesResponse. */ + class ListGlossariesResponse implements IListGlossariesResponse { + + /** + * Constructs a new ListGlossariesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IListGlossariesResponse); + + /** ListGlossariesResponse glossaries. */ + public glossaries: google.cloud.translation.v3beta1.IGlossary[]; + + /** ListGlossariesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListGlossariesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGlossariesResponse instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IListGlossariesResponse): google.cloud.translation.v3beta1.ListGlossariesResponse; + + /** + * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesResponse.verify|verify} messages. + * @param message ListGlossariesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesResponse.verify|verify} messages. + * @param message ListGlossariesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IListGlossariesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.ListGlossariesResponse; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.ListGlossariesResponse; + + /** + * Verifies a ListGlossariesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGlossariesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.ListGlossariesResponse; + + /** + * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. + * @param message ListGlossariesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.ListGlossariesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGlossariesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGlossariesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateGlossaryMetadata. */ + interface ICreateGlossaryMetadata { + + /** CreateGlossaryMetadata name */ + name?: (string|null); + + /** CreateGlossaryMetadata state */ + state?: (google.cloud.translation.v3beta1.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3beta1.CreateGlossaryMetadata.State|null); + + /** CreateGlossaryMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CreateGlossaryMetadata. */ + class CreateGlossaryMetadata implements ICreateGlossaryMetadata { + + /** + * Constructs a new CreateGlossaryMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.ICreateGlossaryMetadata); + + /** CreateGlossaryMetadata name. */ + public name: string; + + /** CreateGlossaryMetadata state. */ + public state: (google.cloud.translation.v3beta1.CreateGlossaryMetadata.State|keyof typeof google.cloud.translation.v3beta1.CreateGlossaryMetadata.State); + + /** CreateGlossaryMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CreateGlossaryMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateGlossaryMetadata instance + */ + public static create(properties?: google.cloud.translation.v3beta1.ICreateGlossaryMetadata): google.cloud.translation.v3beta1.CreateGlossaryMetadata; + + /** + * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryMetadata.verify|verify} messages. + * @param message CreateGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryMetadata.verify|verify} messages. + * @param message CreateGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.ICreateGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.CreateGlossaryMetadata; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.CreateGlossaryMetadata; + + /** + * Verifies a CreateGlossaryMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateGlossaryMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.CreateGlossaryMetadata; + + /** + * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. + * @param message CreateGlossaryMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.CreateGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateGlossaryMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateGlossaryMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CreateGlossaryMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a DeleteGlossaryMetadata. */ + interface IDeleteGlossaryMetadata { + + /** DeleteGlossaryMetadata name */ + name?: (string|null); + + /** DeleteGlossaryMetadata state */ + state?: (google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State|null); + + /** DeleteGlossaryMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DeleteGlossaryMetadata. */ + class DeleteGlossaryMetadata implements IDeleteGlossaryMetadata { + + /** + * Constructs a new DeleteGlossaryMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDeleteGlossaryMetadata); + + /** DeleteGlossaryMetadata name. */ + public name: string; + + /** DeleteGlossaryMetadata state. */ + public state: (google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State|keyof typeof google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State); + + /** DeleteGlossaryMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DeleteGlossaryMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGlossaryMetadata instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDeleteGlossaryMetadata): google.cloud.translation.v3beta1.DeleteGlossaryMetadata; + + /** + * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryMetadata.verify|verify} messages. + * @param message DeleteGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryMetadata.verify|verify} messages. + * @param message DeleteGlossaryMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IDeleteGlossaryMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.DeleteGlossaryMetadata; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.DeleteGlossaryMetadata; + + /** + * Verifies a DeleteGlossaryMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGlossaryMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.DeleteGlossaryMetadata; + + /** + * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. + * @param message DeleteGlossaryMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.DeleteGlossaryMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGlossaryMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteGlossaryMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DeleteGlossaryMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + + /** Properties of a DeleteGlossaryResponse. */ + interface IDeleteGlossaryResponse { + + /** DeleteGlossaryResponse name */ + name?: (string|null); + + /** DeleteGlossaryResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** DeleteGlossaryResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DeleteGlossaryResponse. */ + class DeleteGlossaryResponse implements IDeleteGlossaryResponse { + + /** + * Constructs a new DeleteGlossaryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IDeleteGlossaryResponse); + + /** DeleteGlossaryResponse name. */ + public name: string; + + /** DeleteGlossaryResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** DeleteGlossaryResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DeleteGlossaryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGlossaryResponse instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IDeleteGlossaryResponse): google.cloud.translation.v3beta1.DeleteGlossaryResponse; + + /** + * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryResponse.verify|verify} messages. + * @param message DeleteGlossaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryResponse.verify|verify} messages. + * @param message DeleteGlossaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IDeleteGlossaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.DeleteGlossaryResponse; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.DeleteGlossaryResponse; + + /** + * Verifies a DeleteGlossaryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGlossaryResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.DeleteGlossaryResponse; + + /** + * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. + * @param message DeleteGlossaryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.DeleteGlossaryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGlossaryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteGlossaryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateDocumentRequest. */ + interface IBatchTranslateDocumentRequest { + + /** BatchTranslateDocumentRequest parent */ + parent?: (string|null); + + /** BatchTranslateDocumentRequest sourceLanguageCode */ + sourceLanguageCode?: (string|null); + + /** BatchTranslateDocumentRequest targetLanguageCodes */ + targetLanguageCodes?: (string[]|null); + + /** BatchTranslateDocumentRequest inputConfigs */ + inputConfigs?: (google.cloud.translation.v3beta1.IBatchDocumentInputConfig[]|null); + + /** BatchTranslateDocumentRequest outputConfig */ + outputConfig?: (google.cloud.translation.v3beta1.IBatchDocumentOutputConfig|null); + + /** BatchTranslateDocumentRequest models */ + models?: ({ [k: string]: string }|null); + + /** BatchTranslateDocumentRequest glossaries */ + glossaries?: ({ [k: string]: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig }|null); + + /** BatchTranslateDocumentRequest formatConversions */ + formatConversions?: ({ [k: string]: string }|null); + } + + /** Represents a BatchTranslateDocumentRequest. */ + class BatchTranslateDocumentRequest implements IBatchTranslateDocumentRequest { + + /** + * Constructs a new BatchTranslateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest); + + /** BatchTranslateDocumentRequest parent. */ + public parent: string; + + /** BatchTranslateDocumentRequest sourceLanguageCode. */ + public sourceLanguageCode: string; + + /** BatchTranslateDocumentRequest targetLanguageCodes. */ + public targetLanguageCodes: string[]; + + /** BatchTranslateDocumentRequest inputConfigs. */ + public inputConfigs: google.cloud.translation.v3beta1.IBatchDocumentInputConfig[]; + + /** BatchTranslateDocumentRequest outputConfig. */ + public outputConfig?: (google.cloud.translation.v3beta1.IBatchDocumentOutputConfig|null); + + /** BatchTranslateDocumentRequest models. */ + public models: { [k: string]: string }; + + /** BatchTranslateDocumentRequest glossaries. */ + public glossaries: { [k: string]: google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig }; + + /** BatchTranslateDocumentRequest formatConversions. */ + public formatConversions: { [k: string]: string }; + + /** + * Creates a new BatchTranslateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateDocumentRequest instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest): google.cloud.translation.v3beta1.BatchTranslateDocumentRequest; + + /** + * Encodes the specified BatchTranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.verify|verify} messages. + * @param message BatchTranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.verify|verify} messages. + * @param message BatchTranslateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchTranslateDocumentRequest; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchTranslateDocumentRequest; + + /** + * Verifies a BatchTranslateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchTranslateDocumentRequest; + + /** + * Creates a plain object from a BatchTranslateDocumentRequest message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchTranslateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDocumentInputConfig. */ + interface IBatchDocumentInputConfig { + + /** BatchDocumentInputConfig gcsSource */ + gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + } + + /** Represents a BatchDocumentInputConfig. */ + class BatchDocumentInputConfig implements IBatchDocumentInputConfig { + + /** + * Constructs a new BatchDocumentInputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchDocumentInputConfig); + + /** BatchDocumentInputConfig gcsSource. */ + public gcsSource?: (google.cloud.translation.v3beta1.IGcsSource|null); + + /** BatchDocumentInputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new BatchDocumentInputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDocumentInputConfig instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchDocumentInputConfig): google.cloud.translation.v3beta1.BatchDocumentInputConfig; + + /** + * Encodes the specified BatchDocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentInputConfig.verify|verify} messages. + * @param message BatchDocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentInputConfig.verify|verify} messages. + * @param message BatchDocumentInputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchDocumentInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchDocumentInputConfig; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchDocumentInputConfig; + + /** + * Verifies a BatchDocumentInputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDocumentInputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchDocumentInputConfig; + + /** + * Creates a plain object from a BatchDocumentInputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentInputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchDocumentInputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDocumentInputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDocumentInputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDocumentOutputConfig. */ + interface IBatchDocumentOutputConfig { + + /** BatchDocumentOutputConfig gcsDestination */ + gcsDestination?: (google.cloud.translation.v3beta1.IGcsDestination|null); + } + + /** Represents a BatchDocumentOutputConfig. */ + class BatchDocumentOutputConfig implements IBatchDocumentOutputConfig { + + /** + * Constructs a new BatchDocumentOutputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchDocumentOutputConfig); + + /** BatchDocumentOutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.translation.v3beta1.IGcsDestination|null); + + /** BatchDocumentOutputConfig destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new BatchDocumentOutputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDocumentOutputConfig instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchDocumentOutputConfig): google.cloud.translation.v3beta1.BatchDocumentOutputConfig; + + /** + * Encodes the specified BatchDocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentOutputConfig.verify|verify} messages. + * @param message BatchDocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentOutputConfig.verify|verify} messages. + * @param message BatchDocumentOutputConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchDocumentOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchDocumentOutputConfig; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchDocumentOutputConfig; + + /** + * Verifies a BatchDocumentOutputConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDocumentOutputConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchDocumentOutputConfig; + + /** + * Creates a plain object from a BatchDocumentOutputConfig message. Also converts values to other types if specified. + * @param message BatchDocumentOutputConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchDocumentOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDocumentOutputConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDocumentOutputConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateDocumentResponse. */ + interface IBatchTranslateDocumentResponse { + + /** BatchTranslateDocumentResponse totalPages */ + totalPages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse translatedPages */ + translatedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse failedPages */ + failedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse totalBillablePages */ + totalBillablePages?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse totalBillableCharacters */ + totalBillableCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentResponse submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateDocumentResponse endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateDocumentResponse. */ + class BatchTranslateDocumentResponse implements IBatchTranslateDocumentResponse { + + /** + * Constructs a new BatchTranslateDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse); + + /** BatchTranslateDocumentResponse totalPages. */ + public totalPages: (number|Long|string); + + /** BatchTranslateDocumentResponse translatedPages. */ + public translatedPages: (number|Long|string); + + /** BatchTranslateDocumentResponse failedPages. */ + public failedPages: (number|Long|string); + + /** BatchTranslateDocumentResponse totalBillablePages. */ + public totalBillablePages: (number|Long|string); + + /** BatchTranslateDocumentResponse totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse totalBillableCharacters. */ + public totalBillableCharacters: (number|Long|string); + + /** BatchTranslateDocumentResponse submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** BatchTranslateDocumentResponse endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateDocumentResponse instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse): google.cloud.translation.v3beta1.BatchTranslateDocumentResponse; + + /** + * Encodes the specified BatchTranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentResponse.verify|verify} messages. + * @param message BatchTranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentResponse.verify|verify} messages. + * @param message BatchTranslateDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchTranslateDocumentResponse; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchTranslateDocumentResponse; + + /** + * Verifies a BatchTranslateDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchTranslateDocumentResponse; + + /** + * Creates a plain object from a BatchTranslateDocumentResponse message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchTranslateDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchTranslateDocumentMetadata. */ + interface IBatchTranslateDocumentMetadata { + + /** BatchTranslateDocumentMetadata state */ + state?: (google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State|keyof typeof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State|null); + + /** BatchTranslateDocumentMetadata totalPages */ + totalPages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata translatedPages */ + translatedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata failedPages */ + failedPages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalBillablePages */ + totalBillablePages?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalCharacters */ + totalCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata translatedCharacters */ + translatedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata failedCharacters */ + failedCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata totalBillableCharacters */ + totalBillableCharacters?: (number|Long|string|null); + + /** BatchTranslateDocumentMetadata submitTime */ + submitTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BatchTranslateDocumentMetadata. */ + class BatchTranslateDocumentMetadata implements IBatchTranslateDocumentMetadata { + + /** + * Constructs a new BatchTranslateDocumentMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata); + + /** BatchTranslateDocumentMetadata state. */ + public state: (google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State|keyof typeof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State); + + /** BatchTranslateDocumentMetadata totalPages. */ + public totalPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata translatedPages. */ + public translatedPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata failedPages. */ + public failedPages: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalBillablePages. */ + public totalBillablePages: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalCharacters. */ + public totalCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata translatedCharacters. */ + public translatedCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata failedCharacters. */ + public failedCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata totalBillableCharacters. */ + public totalBillableCharacters: (number|Long|string); + + /** BatchTranslateDocumentMetadata submitTime. */ + public submitTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BatchTranslateDocumentMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchTranslateDocumentMetadata instance + */ + public static create(properties?: google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata): google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.verify|verify} messages. + * @param message BatchTranslateDocumentMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.verify|verify} messages. + * @param message BatchTranslateDocumentMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata; + + /** + * Verifies a BatchTranslateDocumentMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchTranslateDocumentMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchTranslateDocumentMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata; + + /** + * Creates a plain object from a BatchTranslateDocumentMetadata message. Also converts values to other types if specified. + * @param message BatchTranslateDocumentMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchTranslateDocumentMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchTranslateDocumentMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BatchTranslateDocumentMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLING = 4, + CANCELLED = 5 + } + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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; + } + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * 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; + } + } + + /** 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 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 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 an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a 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; + } + } + + /** 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; + } + } + + /** 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; + } + } +} diff --git a/packages/google-cloud-translate/protos/protos.js b/packages/google-cloud-translate/protos/protos.js new file mode 100644 index 00000000000..a83416b519c --- /dev/null +++ b/packages/google-cloud-translate/protos/protos.js @@ -0,0 +1,38489 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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_translate_protos || ($protobuf.roots._google_cloud_translate_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.translation = (function() { + + /** + * Namespace translation. + * @memberof google.cloud + * @namespace + */ + var translation = {}; + + translation.v3 = (function() { + + /** + * Namespace v3. + * @memberof google.cloud.translation + * @namespace + */ + var v3 = {}; + + v3.TranslationService = (function() { + + /** + * Constructs a new TranslationService service. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a TranslationService + * @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 TranslationService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (TranslationService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = TranslationService; + + /** + * Creates new TranslationService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.translation.v3.TranslationService + * @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 {TranslationService} RPC service. Useful where requests and/or responses are streamed. + */ + TranslationService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|translateText}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef TranslateTextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3.TranslateTextResponse} [response] TranslateTextResponse + */ + + /** + * Calls TranslateText. + * @function translateText + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ITranslateTextRequest} request TranslateTextRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.TranslateTextCallback} callback Node-style callback called with the error, if any, and TranslateTextResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.translateText = function translateText(request, callback) { + return this.rpcCall(translateText, $root.google.cloud.translation.v3.TranslateTextRequest, $root.google.cloud.translation.v3.TranslateTextResponse, request, callback); + }, "name", { value: "TranslateText" }); + + /** + * Calls TranslateText. + * @function translateText + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ITranslateTextRequest} request TranslateTextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|detectLanguage}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef DetectLanguageCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3.DetectLanguageResponse} [response] DetectLanguageResponse + */ + + /** + * Calls DetectLanguage. + * @function detectLanguage + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IDetectLanguageRequest} request DetectLanguageRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.DetectLanguageCallback} callback Node-style callback called with the error, if any, and DetectLanguageResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.detectLanguage = function detectLanguage(request, callback) { + return this.rpcCall(detectLanguage, $root.google.cloud.translation.v3.DetectLanguageRequest, $root.google.cloud.translation.v3.DetectLanguageResponse, request, callback); + }, "name", { value: "DetectLanguage" }); + + /** + * Calls DetectLanguage. + * @function detectLanguage + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IDetectLanguageRequest} request DetectLanguageRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|getSupportedLanguages}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef GetSupportedLanguagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3.SupportedLanguages} [response] SupportedLanguages + */ + + /** + * Calls GetSupportedLanguages. + * @function getSupportedLanguages + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IGetSupportedLanguagesRequest} request GetSupportedLanguagesRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.GetSupportedLanguagesCallback} callback Node-style callback called with the error, if any, and SupportedLanguages + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.getSupportedLanguages = function getSupportedLanguages(request, callback) { + return this.rpcCall(getSupportedLanguages, $root.google.cloud.translation.v3.GetSupportedLanguagesRequest, $root.google.cloud.translation.v3.SupportedLanguages, request, callback); + }, "name", { value: "GetSupportedLanguages" }); + + /** + * Calls GetSupportedLanguages. + * @function getSupportedLanguages + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IGetSupportedLanguagesRequest} request GetSupportedLanguagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|translateDocument}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef TranslateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3.TranslateDocumentResponse} [response] TranslateDocumentResponse + */ + + /** + * Calls TranslateDocument. + * @function translateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} request TranslateDocumentRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.TranslateDocumentCallback} callback Node-style callback called with the error, if any, and TranslateDocumentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.translateDocument = function translateDocument(request, callback) { + return this.rpcCall(translateDocument, $root.google.cloud.translation.v3.TranslateDocumentRequest, $root.google.cloud.translation.v3.TranslateDocumentResponse, request, callback); + }, "name", { value: "TranslateDocument" }); + + /** + * Calls TranslateDocument. + * @function translateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} request TranslateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|batchTranslateText}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef BatchTranslateTextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchTranslateText. + * @function batchTranslateText + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} request BatchTranslateTextRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.BatchTranslateTextCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.batchTranslateText = function batchTranslateText(request, callback) { + return this.rpcCall(batchTranslateText, $root.google.cloud.translation.v3.BatchTranslateTextRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchTranslateText" }); + + /** + * Calls BatchTranslateText. + * @function batchTranslateText + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} request BatchTranslateTextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|batchTranslateDocument}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef BatchTranslateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchTranslateDocument. + * @function batchTranslateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} request BatchTranslateDocumentRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.BatchTranslateDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.batchTranslateDocument = function batchTranslateDocument(request, callback) { + return this.rpcCall(batchTranslateDocument, $root.google.cloud.translation.v3.BatchTranslateDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchTranslateDocument" }); + + /** + * Calls BatchTranslateDocument. + * @function batchTranslateDocument + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} request BatchTranslateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|createGlossary}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef CreateGlossaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateGlossary. + * @function createGlossary + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ICreateGlossaryRequest} request CreateGlossaryRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.CreateGlossaryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.createGlossary = function createGlossary(request, callback) { + return this.rpcCall(createGlossary, $root.google.cloud.translation.v3.CreateGlossaryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateGlossary" }); + + /** + * Calls CreateGlossary. + * @function createGlossary + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.ICreateGlossaryRequest} request CreateGlossaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|listGlossaries}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef ListGlossariesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3.ListGlossariesResponse} [response] ListGlossariesResponse + */ + + /** + * Calls ListGlossaries. + * @function listGlossaries + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IListGlossariesRequest} request ListGlossariesRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.ListGlossariesCallback} callback Node-style callback called with the error, if any, and ListGlossariesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.listGlossaries = function listGlossaries(request, callback) { + return this.rpcCall(listGlossaries, $root.google.cloud.translation.v3.ListGlossariesRequest, $root.google.cloud.translation.v3.ListGlossariesResponse, request, callback); + }, "name", { value: "ListGlossaries" }); + + /** + * Calls ListGlossaries. + * @function listGlossaries + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IListGlossariesRequest} request ListGlossariesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|getGlossary}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef GetGlossaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3.Glossary} [response] Glossary + */ + + /** + * Calls GetGlossary. + * @function getGlossary + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IGetGlossaryRequest} request GetGlossaryRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.GetGlossaryCallback} callback Node-style callback called with the error, if any, and Glossary + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.getGlossary = function getGlossary(request, callback) { + return this.rpcCall(getGlossary, $root.google.cloud.translation.v3.GetGlossaryRequest, $root.google.cloud.translation.v3.Glossary, request, callback); + }, "name", { value: "GetGlossary" }); + + /** + * Calls GetGlossary. + * @function getGlossary + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IGetGlossaryRequest} request GetGlossaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3.TranslationService|deleteGlossary}. + * @memberof google.cloud.translation.v3.TranslationService + * @typedef DeleteGlossaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteGlossary. + * @function deleteGlossary + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} request DeleteGlossaryRequest message or plain object + * @param {google.cloud.translation.v3.TranslationService.DeleteGlossaryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.deleteGlossary = function deleteGlossary(request, callback) { + return this.rpcCall(deleteGlossary, $root.google.cloud.translation.v3.DeleteGlossaryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteGlossary" }); + + /** + * Calls DeleteGlossary. + * @function deleteGlossary + * @memberof google.cloud.translation.v3.TranslationService + * @instance + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} request DeleteGlossaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return TranslationService; + })(); + + v3.TranslateTextGlossaryConfig = (function() { + + /** + * Properties of a TranslateTextGlossaryConfig. + * @memberof google.cloud.translation.v3 + * @interface ITranslateTextGlossaryConfig + * @property {string|null} [glossary] TranslateTextGlossaryConfig glossary + * @property {boolean|null} [ignoreCase] TranslateTextGlossaryConfig ignoreCase + */ + + /** + * Constructs a new TranslateTextGlossaryConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a TranslateTextGlossaryConfig. + * @implements ITranslateTextGlossaryConfig + * @constructor + * @param {google.cloud.translation.v3.ITranslateTextGlossaryConfig=} [properties] Properties to set + */ + function TranslateTextGlossaryConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranslateTextGlossaryConfig glossary. + * @member {string} glossary + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @instance + */ + TranslateTextGlossaryConfig.prototype.glossary = ""; + + /** + * TranslateTextGlossaryConfig ignoreCase. + * @member {boolean} ignoreCase + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @instance + */ + TranslateTextGlossaryConfig.prototype.ignoreCase = false; + + /** + * Creates a new TranslateTextGlossaryConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3.ITranslateTextGlossaryConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig instance + */ + TranslateTextGlossaryConfig.create = function create(properties) { + return new TranslateTextGlossaryConfig(properties); + }; + + /** + * Encodes the specified TranslateTextGlossaryConfig message. Does not implicitly {@link google.cloud.translation.v3.TranslateTextGlossaryConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3.ITranslateTextGlossaryConfig} message TranslateTextGlossaryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextGlossaryConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.glossary != null && Object.hasOwnProperty.call(message, "glossary")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.glossary); + if (message.ignoreCase != null && Object.hasOwnProperty.call(message, "ignoreCase")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.ignoreCase); + return writer; + }; + + /** + * Encodes the specified TranslateTextGlossaryConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateTextGlossaryConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3.ITranslateTextGlossaryConfig} message TranslateTextGlossaryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextGlossaryConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextGlossaryConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.TranslateTextGlossaryConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.glossary = reader.string(); + break; + } + case 2: { + message.ignoreCase = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextGlossaryConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateTextGlossaryConfig message. + * @function verify + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateTextGlossaryConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.glossary != null && message.hasOwnProperty("glossary")) + if (!$util.isString(message.glossary)) + return "glossary: string expected"; + if (message.ignoreCase != null && message.hasOwnProperty("ignoreCase")) + if (typeof message.ignoreCase !== "boolean") + return "ignoreCase: boolean expected"; + return null; + }; + + /** + * Creates a TranslateTextGlossaryConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig + */ + TranslateTextGlossaryConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.TranslateTextGlossaryConfig) + return object; + var message = new $root.google.cloud.translation.v3.TranslateTextGlossaryConfig(); + if (object.glossary != null) + message.glossary = String(object.glossary); + if (object.ignoreCase != null) + message.ignoreCase = Boolean(object.ignoreCase); + return message; + }; + + /** + * Creates a plain object from a TranslateTextGlossaryConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3.TranslateTextGlossaryConfig} message TranslateTextGlossaryConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateTextGlossaryConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.glossary = ""; + object.ignoreCase = false; + } + if (message.glossary != null && message.hasOwnProperty("glossary")) + object.glossary = message.glossary; + if (message.ignoreCase != null && message.hasOwnProperty("ignoreCase")) + object.ignoreCase = message.ignoreCase; + return object; + }; + + /** + * Converts this TranslateTextGlossaryConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @instance + * @returns {Object.} JSON object + */ + TranslateTextGlossaryConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateTextGlossaryConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3.TranslateTextGlossaryConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateTextGlossaryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.TranslateTextGlossaryConfig"; + }; + + return TranslateTextGlossaryConfig; + })(); + + v3.TranslateTextRequest = (function() { + + /** + * Properties of a TranslateTextRequest. + * @memberof google.cloud.translation.v3 + * @interface ITranslateTextRequest + * @property {Array.|null} [contents] TranslateTextRequest contents + * @property {string|null} [mimeType] TranslateTextRequest mimeType + * @property {string|null} [sourceLanguageCode] TranslateTextRequest sourceLanguageCode + * @property {string|null} [targetLanguageCode] TranslateTextRequest targetLanguageCode + * @property {string|null} [parent] TranslateTextRequest parent + * @property {string|null} [model] TranslateTextRequest model + * @property {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateTextRequest glossaryConfig + * @property {Object.|null} [labels] TranslateTextRequest labels + */ + + /** + * Constructs a new TranslateTextRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a TranslateTextRequest. + * @implements ITranslateTextRequest + * @constructor + * @param {google.cloud.translation.v3.ITranslateTextRequest=} [properties] Properties to set + */ + function TranslateTextRequest(properties) { + this.contents = []; + 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]]; + } + + /** + * TranslateTextRequest contents. + * @member {Array.} contents + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.contents = $util.emptyArray; + + /** + * TranslateTextRequest mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.mimeType = ""; + + /** + * TranslateTextRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.sourceLanguageCode = ""; + + /** + * TranslateTextRequest targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.targetLanguageCode = ""; + + /** + * TranslateTextRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.parent = ""; + + /** + * TranslateTextRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.model = ""; + + /** + * TranslateTextRequest glossaryConfig. + * @member {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.glossaryConfig = null; + + /** + * TranslateTextRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new TranslateTextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3.ITranslateTextRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.TranslateTextRequest} TranslateTextRequest instance + */ + TranslateTextRequest.create = function create(properties) { + return new TranslateTextRequest(properties); + }; + + /** + * Encodes the specified TranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.TranslateTextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3.ITranslateTextRequest} message TranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contents != null && message.contents.length) + for (var i = 0; i < message.contents.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.contents[i]); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.targetLanguageCode); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.parent); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateTextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3.ITranslateTextRequest} message TranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.TranslateTextRequest} TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.TranslateTextRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.contents && message.contents.length)) + message.contents = []; + message.contents.push(reader.string()); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 4: { + message.sourceLanguageCode = reader.string(); + break; + } + case 5: { + message.targetLanguageCode = reader.string(); + break; + } + case 8: { + message.parent = reader.string(); + break; + } + case 6: { + message.model = reader.string(); + break; + } + case 7: { + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.TranslateTextRequest} TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateTextRequest message. + * @function verify + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateTextRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contents != null && message.hasOwnProperty("contents")) { + if (!Array.isArray(message.contents)) + return "contents: array expected"; + for (var i = 0; i < message.contents.length; ++i) + if (!$util.isString(message.contents[i])) + return "contents: string[] expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a TranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.TranslateTextRequest} TranslateTextRequest + */ + TranslateTextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.TranslateTextRequest) + return object; + var message = new $root.google.cloud.translation.v3.TranslateTextRequest(); + if (object.contents) { + if (!Array.isArray(object.contents)) + throw TypeError(".google.cloud.translation.v3.TranslateTextRequest.contents: array expected"); + message.contents = []; + for (var i = 0; i < object.contents.length; ++i) + message.contents[i] = String(object.contents[i]); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + if (object.parent != null) + message.parent = String(object.parent); + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateTextRequest.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateTextRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a TranslateTextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3.TranslateTextRequest} message TranslateTextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateTextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contents = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.mimeType = ""; + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + object.model = ""; + object.glossaryConfig = null; + object.parent = ""; + } + if (message.contents && message.contents.length) { + object.contents = []; + for (var j = 0; j < message.contents.length; ++j) + object.contents[j] = message.contents[j]; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this TranslateTextRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @instance + * @returns {Object.} JSON object + */ + TranslateTextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateTextRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.TranslateTextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.TranslateTextRequest"; + }; + + return TranslateTextRequest; + })(); + + v3.TranslateTextResponse = (function() { + + /** + * Properties of a TranslateTextResponse. + * @memberof google.cloud.translation.v3 + * @interface ITranslateTextResponse + * @property {Array.|null} [translations] TranslateTextResponse translations + * @property {Array.|null} [glossaryTranslations] TranslateTextResponse glossaryTranslations + */ + + /** + * Constructs a new TranslateTextResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a TranslateTextResponse. + * @implements ITranslateTextResponse + * @constructor + * @param {google.cloud.translation.v3.ITranslateTextResponse=} [properties] Properties to set + */ + function TranslateTextResponse(properties) { + this.translations = []; + this.glossaryTranslations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranslateTextResponse translations. + * @member {Array.} translations + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @instance + */ + TranslateTextResponse.prototype.translations = $util.emptyArray; + + /** + * TranslateTextResponse glossaryTranslations. + * @member {Array.} glossaryTranslations + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @instance + */ + TranslateTextResponse.prototype.glossaryTranslations = $util.emptyArray; + + /** + * Creates a new TranslateTextResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3.ITranslateTextResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.TranslateTextResponse} TranslateTextResponse instance + */ + TranslateTextResponse.create = function create(properties) { + return new TranslateTextResponse(properties); + }; + + /** + * Encodes the specified TranslateTextResponse message. Does not implicitly {@link google.cloud.translation.v3.TranslateTextResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3.ITranslateTextResponse} message TranslateTextResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.translations != null && message.translations.length) + for (var i = 0; i < message.translations.length; ++i) + $root.google.cloud.translation.v3.Translation.encode(message.translations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.glossaryTranslations != null && message.glossaryTranslations.length) + for (var i = 0; i < message.glossaryTranslations.length; ++i) + $root.google.cloud.translation.v3.Translation.encode(message.glossaryTranslations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateTextResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateTextResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3.ITranslateTextResponse} message TranslateTextResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.TranslateTextResponse} TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.TranslateTextResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.translations && message.translations.length)) + message.translations = []; + message.translations.push($root.google.cloud.translation.v3.Translation.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.glossaryTranslations && message.glossaryTranslations.length)) + message.glossaryTranslations = []; + message.glossaryTranslations.push($root.google.cloud.translation.v3.Translation.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.TranslateTextResponse} TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateTextResponse message. + * @function verify + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateTextResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.translations != null && message.hasOwnProperty("translations")) { + if (!Array.isArray(message.translations)) + return "translations: array expected"; + for (var i = 0; i < message.translations.length; ++i) { + var error = $root.google.cloud.translation.v3.Translation.verify(message.translations[i]); + if (error) + return "translations." + error; + } + } + if (message.glossaryTranslations != null && message.hasOwnProperty("glossaryTranslations")) { + if (!Array.isArray(message.glossaryTranslations)) + return "glossaryTranslations: array expected"; + for (var i = 0; i < message.glossaryTranslations.length; ++i) { + var error = $root.google.cloud.translation.v3.Translation.verify(message.glossaryTranslations[i]); + if (error) + return "glossaryTranslations." + error; + } + } + return null; + }; + + /** + * Creates a TranslateTextResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.TranslateTextResponse} TranslateTextResponse + */ + TranslateTextResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.TranslateTextResponse) + return object; + var message = new $root.google.cloud.translation.v3.TranslateTextResponse(); + if (object.translations) { + if (!Array.isArray(object.translations)) + throw TypeError(".google.cloud.translation.v3.TranslateTextResponse.translations: array expected"); + message.translations = []; + for (var i = 0; i < object.translations.length; ++i) { + if (typeof object.translations[i] !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateTextResponse.translations: object expected"); + message.translations[i] = $root.google.cloud.translation.v3.Translation.fromObject(object.translations[i]); + } + } + if (object.glossaryTranslations) { + if (!Array.isArray(object.glossaryTranslations)) + throw TypeError(".google.cloud.translation.v3.TranslateTextResponse.glossaryTranslations: array expected"); + message.glossaryTranslations = []; + for (var i = 0; i < object.glossaryTranslations.length; ++i) { + if (typeof object.glossaryTranslations[i] !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateTextResponse.glossaryTranslations: object expected"); + message.glossaryTranslations[i] = $root.google.cloud.translation.v3.Translation.fromObject(object.glossaryTranslations[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TranslateTextResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3.TranslateTextResponse} message TranslateTextResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateTextResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.translations = []; + object.glossaryTranslations = []; + } + if (message.translations && message.translations.length) { + object.translations = []; + for (var j = 0; j < message.translations.length; ++j) + object.translations[j] = $root.google.cloud.translation.v3.Translation.toObject(message.translations[j], options); + } + if (message.glossaryTranslations && message.glossaryTranslations.length) { + object.glossaryTranslations = []; + for (var j = 0; j < message.glossaryTranslations.length; ++j) + object.glossaryTranslations[j] = $root.google.cloud.translation.v3.Translation.toObject(message.glossaryTranslations[j], options); + } + return object; + }; + + /** + * Converts this TranslateTextResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @instance + * @returns {Object.} JSON object + */ + TranslateTextResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateTextResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3.TranslateTextResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateTextResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.TranslateTextResponse"; + }; + + return TranslateTextResponse; + })(); + + v3.Translation = (function() { + + /** + * Properties of a Translation. + * @memberof google.cloud.translation.v3 + * @interface ITranslation + * @property {string|null} [translatedText] Translation translatedText + * @property {string|null} [model] Translation model + * @property {string|null} [detectedLanguageCode] Translation detectedLanguageCode + * @property {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null} [glossaryConfig] Translation glossaryConfig + */ + + /** + * Constructs a new Translation. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a Translation. + * @implements ITranslation + * @constructor + * @param {google.cloud.translation.v3.ITranslation=} [properties] Properties to set + */ + function Translation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Translation translatedText. + * @member {string} translatedText + * @memberof google.cloud.translation.v3.Translation + * @instance + */ + Translation.prototype.translatedText = ""; + + /** + * Translation model. + * @member {string} model + * @memberof google.cloud.translation.v3.Translation + * @instance + */ + Translation.prototype.model = ""; + + /** + * Translation detectedLanguageCode. + * @member {string} detectedLanguageCode + * @memberof google.cloud.translation.v3.Translation + * @instance + */ + Translation.prototype.detectedLanguageCode = ""; + + /** + * Translation glossaryConfig. + * @member {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3.Translation + * @instance + */ + Translation.prototype.glossaryConfig = null; + + /** + * Creates a new Translation instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {google.cloud.translation.v3.ITranslation=} [properties] Properties to set + * @returns {google.cloud.translation.v3.Translation} Translation instance + */ + Translation.create = function create(properties) { + return new Translation(properties); + }; + + /** + * Encodes the specified Translation message. Does not implicitly {@link google.cloud.translation.v3.Translation.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {google.cloud.translation.v3.ITranslation} message Translation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Translation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.translatedText != null && Object.hasOwnProperty.call(message, "translatedText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.translatedText); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguageCode != null && Object.hasOwnProperty.call(message, "detectedLanguageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.detectedLanguageCode); + return writer; + }; + + /** + * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Translation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {google.cloud.translation.v3.ITranslation} message Translation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Translation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Translation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.Translation} Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Translation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Translation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.translatedText = reader.string(); + break; + } + case 2: { + message.model = reader.string(); + break; + } + case 4: { + message.detectedLanguageCode = reader.string(); + break; + } + case 3: { + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Translation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.Translation} Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Translation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Translation message. + * @function verify + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Translation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.translatedText != null && message.hasOwnProperty("translatedText")) + if (!$util.isString(message.translatedText)) + return "translatedText: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + if (!$util.isString(message.detectedLanguageCode)) + return "detectedLanguageCode: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + return null; + }; + + /** + * Creates a Translation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.Translation} Translation + */ + Translation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.Translation) + return object; + var message = new $root.google.cloud.translation.v3.Translation(); + if (object.translatedText != null) + message.translatedText = String(object.translatedText); + if (object.model != null) + message.model = String(object.model); + if (object.detectedLanguageCode != null) + message.detectedLanguageCode = String(object.detectedLanguageCode); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3.Translation.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + return message; + }; + + /** + * Creates a plain object from a Translation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {google.cloud.translation.v3.Translation} message Translation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Translation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.translatedText = ""; + object.model = ""; + object.glossaryConfig = null; + object.detectedLanguageCode = ""; + } + if (message.translatedText != null && message.hasOwnProperty("translatedText")) + object.translatedText = message.translatedText; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + object.detectedLanguageCode = message.detectedLanguageCode; + return object; + }; + + /** + * Converts this Translation to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.Translation + * @instance + * @returns {Object.} JSON object + */ + Translation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Translation + * @function getTypeUrl + * @memberof google.cloud.translation.v3.Translation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Translation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.Translation"; + }; + + return Translation; + })(); + + v3.DetectLanguageRequest = (function() { + + /** + * Properties of a DetectLanguageRequest. + * @memberof google.cloud.translation.v3 + * @interface IDetectLanguageRequest + * @property {string|null} [parent] DetectLanguageRequest parent + * @property {string|null} [model] DetectLanguageRequest model + * @property {string|null} [content] DetectLanguageRequest content + * @property {string|null} [mimeType] DetectLanguageRequest mimeType + * @property {Object.|null} [labels] DetectLanguageRequest labels + */ + + /** + * Constructs a new DetectLanguageRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DetectLanguageRequest. + * @implements IDetectLanguageRequest + * @constructor + * @param {google.cloud.translation.v3.IDetectLanguageRequest=} [properties] Properties to set + */ + function DetectLanguageRequest(properties) { + 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]]; + } + + /** + * DetectLanguageRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.parent = ""; + + /** + * DetectLanguageRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.model = ""; + + /** + * DetectLanguageRequest content. + * @member {string|null|undefined} content + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.content = null; + + /** + * DetectLanguageRequest mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.mimeType = ""; + + /** + * DetectLanguageRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.labels = $util.emptyObject; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DetectLanguageRequest source. + * @member {"content"|undefined} source + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @instance + */ + Object.defineProperty(DetectLanguageRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["content"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DetectLanguageRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3.IDetectLanguageRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DetectLanguageRequest} DetectLanguageRequest instance + */ + DetectLanguageRequest.create = function create(properties) { + return new DetectLanguageRequest(properties); + }; + + /** + * Encodes the specified DetectLanguageRequest message. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3.IDetectLanguageRequest} message DetectLanguageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageRequest.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).string(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.model); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.parent); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectLanguageRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3.IDetectLanguageRequest} message DetectLanguageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DetectLanguageRequest} DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DetectLanguageRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.parent = reader.string(); + break; + } + case 4: { + message.model = reader.string(); + break; + } + case 1: { + message.content = reader.string(); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 6: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DetectLanguageRequest} DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectLanguageRequest message. + * @function verify + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectLanguageRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.content != null && message.hasOwnProperty("content")) { + properties.source = 1; + if (!$util.isString(message.content)) + return "content: string expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a DetectLanguageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DetectLanguageRequest} DetectLanguageRequest + */ + DetectLanguageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DetectLanguageRequest) + return object; + var message = new $root.google.cloud.translation.v3.DetectLanguageRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.model != null) + message.model = String(object.model); + if (object.content != null) + message.content = String(object.content); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3.DetectLanguageRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a DetectLanguageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3.DetectLanguageRequest} message DetectLanguageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectLanguageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.mimeType = ""; + object.model = ""; + object.parent = ""; + } + if (message.content != null && message.hasOwnProperty("content")) { + object.content = message.content; + if (options.oneofs) + object.source = "content"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this DetectLanguageRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @instance + * @returns {Object.} JSON object + */ + DetectLanguageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectLanguageRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.DetectLanguageRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectLanguageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.DetectLanguageRequest"; + }; + + return DetectLanguageRequest; + })(); + + v3.DetectedLanguage = (function() { + + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.translation.v3 + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ + + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.translation.v3.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.translation.v3.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; + + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.translation.v3.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DetectedLanguage + * @static + * @param {google.cloud.translation.v3.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.translation.v3.DetectedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DetectedLanguage + * @static + * @param {google.cloud.translation.v3.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.translation.v3.DetectedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DetectedLanguage + * @static + * @param {google.cloud.translation.v3.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.translation.v3.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.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.translation.v3.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.translation.v3.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.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.translation.v3.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.translation.v3.DetectedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DetectedLanguage} DetectedLanguage + */ + DetectedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DetectedLanguage) + return object; + var message = new $root.google.cloud.translation.v3.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.translation.v3.DetectedLanguage + * @static + * @param {google.cloud.translation.v3.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.translation.v3.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.translation.v3.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.translation.v3.DetectedLanguage"; + }; + + return DetectedLanguage; + })(); + + v3.DetectLanguageResponse = (function() { + + /** + * Properties of a DetectLanguageResponse. + * @memberof google.cloud.translation.v3 + * @interface IDetectLanguageResponse + * @property {Array.|null} [languages] DetectLanguageResponse languages + */ + + /** + * Constructs a new DetectLanguageResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DetectLanguageResponse. + * @implements IDetectLanguageResponse + * @constructor + * @param {google.cloud.translation.v3.IDetectLanguageResponse=} [properties] Properties to set + */ + function DetectLanguageResponse(properties) { + this.languages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectLanguageResponse languages. + * @member {Array.} languages + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @instance + */ + DetectLanguageResponse.prototype.languages = $util.emptyArray; + + /** + * Creates a new DetectLanguageResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3.IDetectLanguageResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DetectLanguageResponse} DetectLanguageResponse instance + */ + DetectLanguageResponse.create = function create(properties) { + return new DetectLanguageResponse(properties); + }; + + /** + * Encodes the specified DetectLanguageResponse message. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3.IDetectLanguageResponse} message DetectLanguageResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languages != null && message.languages.length) + for (var i = 0; i < message.languages.length; ++i) + $root.google.cloud.translation.v3.DetectedLanguage.encode(message.languages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectLanguageResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DetectLanguageResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3.IDetectLanguageResponse} message DetectLanguageResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DetectLanguageResponse} DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DetectLanguageResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.languages && message.languages.length)) + message.languages = []; + message.languages.push($root.google.cloud.translation.v3.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DetectLanguageResponse} DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectLanguageResponse message. + * @function verify + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectLanguageResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languages != null && message.hasOwnProperty("languages")) { + if (!Array.isArray(message.languages)) + return "languages: array expected"; + for (var i = 0; i < message.languages.length; ++i) { + var error = $root.google.cloud.translation.v3.DetectedLanguage.verify(message.languages[i]); + if (error) + return "languages." + error; + } + } + return null; + }; + + /** + * Creates a DetectLanguageResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DetectLanguageResponse} DetectLanguageResponse + */ + DetectLanguageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DetectLanguageResponse) + return object; + var message = new $root.google.cloud.translation.v3.DetectLanguageResponse(); + if (object.languages) { + if (!Array.isArray(object.languages)) + throw TypeError(".google.cloud.translation.v3.DetectLanguageResponse.languages: array expected"); + message.languages = []; + for (var i = 0; i < object.languages.length; ++i) { + if (typeof object.languages[i] !== "object") + throw TypeError(".google.cloud.translation.v3.DetectLanguageResponse.languages: object expected"); + message.languages[i] = $root.google.cloud.translation.v3.DetectedLanguage.fromObject(object.languages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DetectLanguageResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3.DetectLanguageResponse} message DetectLanguageResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectLanguageResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languages = []; + if (message.languages && message.languages.length) { + object.languages = []; + for (var j = 0; j < message.languages.length; ++j) + object.languages[j] = $root.google.cloud.translation.v3.DetectedLanguage.toObject(message.languages[j], options); + } + return object; + }; + + /** + * Converts this DetectLanguageResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @instance + * @returns {Object.} JSON object + */ + DetectLanguageResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectLanguageResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3.DetectLanguageResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectLanguageResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.DetectLanguageResponse"; + }; + + return DetectLanguageResponse; + })(); + + v3.GetSupportedLanguagesRequest = (function() { + + /** + * Properties of a GetSupportedLanguagesRequest. + * @memberof google.cloud.translation.v3 + * @interface IGetSupportedLanguagesRequest + * @property {string|null} [parent] GetSupportedLanguagesRequest parent + * @property {string|null} [displayLanguageCode] GetSupportedLanguagesRequest displayLanguageCode + * @property {string|null} [model] GetSupportedLanguagesRequest model + */ + + /** + * Constructs a new GetSupportedLanguagesRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a GetSupportedLanguagesRequest. + * @implements IGetSupportedLanguagesRequest + * @constructor + * @param {google.cloud.translation.v3.IGetSupportedLanguagesRequest=} [properties] Properties to set + */ + function GetSupportedLanguagesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSupportedLanguagesRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @instance + */ + GetSupportedLanguagesRequest.prototype.parent = ""; + + /** + * GetSupportedLanguagesRequest displayLanguageCode. + * @member {string} displayLanguageCode + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @instance + */ + GetSupportedLanguagesRequest.prototype.displayLanguageCode = ""; + + /** + * GetSupportedLanguagesRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @instance + */ + GetSupportedLanguagesRequest.prototype.model = ""; + + /** + * Creates a new GetSupportedLanguagesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3.IGetSupportedLanguagesRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest instance + */ + GetSupportedLanguagesRequest.create = function create(properties) { + return new GetSupportedLanguagesRequest(properties); + }; + + /** + * Encodes the specified GetSupportedLanguagesRequest message. Does not implicitly {@link google.cloud.translation.v3.GetSupportedLanguagesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3.IGetSupportedLanguagesRequest} message GetSupportedLanguagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSupportedLanguagesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayLanguageCode != null && Object.hasOwnProperty.call(message, "displayLanguageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayLanguageCode); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.model); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GetSupportedLanguagesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetSupportedLanguagesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3.IGetSupportedLanguagesRequest} message GetSupportedLanguagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSupportedLanguagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSupportedLanguagesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.GetSupportedLanguagesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.parent = reader.string(); + break; + } + case 1: { + message.displayLanguageCode = reader.string(); + break; + } + case 2: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSupportedLanguagesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSupportedLanguagesRequest message. + * @function verify + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSupportedLanguagesRequest.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.displayLanguageCode != null && message.hasOwnProperty("displayLanguageCode")) + if (!$util.isString(message.displayLanguageCode)) + return "displayLanguageCode: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a GetSupportedLanguagesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest + */ + GetSupportedLanguagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.GetSupportedLanguagesRequest) + return object; + var message = new $root.google.cloud.translation.v3.GetSupportedLanguagesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.displayLanguageCode != null) + message.displayLanguageCode = String(object.displayLanguageCode); + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a GetSupportedLanguagesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3.GetSupportedLanguagesRequest} message GetSupportedLanguagesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSupportedLanguagesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayLanguageCode = ""; + object.model = ""; + object.parent = ""; + } + if (message.displayLanguageCode != null && message.hasOwnProperty("displayLanguageCode")) + object.displayLanguageCode = message.displayLanguageCode; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GetSupportedLanguagesRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @instance + * @returns {Object.} JSON object + */ + GetSupportedLanguagesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSupportedLanguagesRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.GetSupportedLanguagesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSupportedLanguagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.GetSupportedLanguagesRequest"; + }; + + return GetSupportedLanguagesRequest; + })(); + + v3.SupportedLanguages = (function() { + + /** + * Properties of a SupportedLanguages. + * @memberof google.cloud.translation.v3 + * @interface ISupportedLanguages + * @property {Array.|null} [languages] SupportedLanguages languages + */ + + /** + * Constructs a new SupportedLanguages. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a SupportedLanguages. + * @implements ISupportedLanguages + * @constructor + * @param {google.cloud.translation.v3.ISupportedLanguages=} [properties] Properties to set + */ + function SupportedLanguages(properties) { + this.languages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SupportedLanguages languages. + * @member {Array.} languages + * @memberof google.cloud.translation.v3.SupportedLanguages + * @instance + */ + SupportedLanguages.prototype.languages = $util.emptyArray; + + /** + * Creates a new SupportedLanguages instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {google.cloud.translation.v3.ISupportedLanguages=} [properties] Properties to set + * @returns {google.cloud.translation.v3.SupportedLanguages} SupportedLanguages instance + */ + SupportedLanguages.create = function create(properties) { + return new SupportedLanguages(properties); + }; + + /** + * Encodes the specified SupportedLanguages message. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguages.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {google.cloud.translation.v3.ISupportedLanguages} message SupportedLanguages message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguages.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languages != null && message.languages.length) + for (var i = 0; i < message.languages.length; ++i) + $root.google.cloud.translation.v3.SupportedLanguage.encode(message.languages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SupportedLanguages message, length delimited. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguages.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {google.cloud.translation.v3.ISupportedLanguages} message SupportedLanguages message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguages.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.SupportedLanguages} SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguages.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.SupportedLanguages(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.languages && message.languages.length)) + message.languages = []; + message.languages.push($root.google.cloud.translation.v3.SupportedLanguage.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.SupportedLanguages} SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguages.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SupportedLanguages message. + * @function verify + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SupportedLanguages.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languages != null && message.hasOwnProperty("languages")) { + if (!Array.isArray(message.languages)) + return "languages: array expected"; + for (var i = 0; i < message.languages.length; ++i) { + var error = $root.google.cloud.translation.v3.SupportedLanguage.verify(message.languages[i]); + if (error) + return "languages." + error; + } + } + return null; + }; + + /** + * Creates a SupportedLanguages message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.SupportedLanguages} SupportedLanguages + */ + SupportedLanguages.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.SupportedLanguages) + return object; + var message = new $root.google.cloud.translation.v3.SupportedLanguages(); + if (object.languages) { + if (!Array.isArray(object.languages)) + throw TypeError(".google.cloud.translation.v3.SupportedLanguages.languages: array expected"); + message.languages = []; + for (var i = 0; i < object.languages.length; ++i) { + if (typeof object.languages[i] !== "object") + throw TypeError(".google.cloud.translation.v3.SupportedLanguages.languages: object expected"); + message.languages[i] = $root.google.cloud.translation.v3.SupportedLanguage.fromObject(object.languages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SupportedLanguages message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {google.cloud.translation.v3.SupportedLanguages} message SupportedLanguages + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SupportedLanguages.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languages = []; + if (message.languages && message.languages.length) { + object.languages = []; + for (var j = 0; j < message.languages.length; ++j) + object.languages[j] = $root.google.cloud.translation.v3.SupportedLanguage.toObject(message.languages[j], options); + } + return object; + }; + + /** + * Converts this SupportedLanguages to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.SupportedLanguages + * @instance + * @returns {Object.} JSON object + */ + SupportedLanguages.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SupportedLanguages + * @function getTypeUrl + * @memberof google.cloud.translation.v3.SupportedLanguages + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SupportedLanguages.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.SupportedLanguages"; + }; + + return SupportedLanguages; + })(); + + v3.SupportedLanguage = (function() { + + /** + * Properties of a SupportedLanguage. + * @memberof google.cloud.translation.v3 + * @interface ISupportedLanguage + * @property {string|null} [languageCode] SupportedLanguage languageCode + * @property {string|null} [displayName] SupportedLanguage displayName + * @property {boolean|null} [supportSource] SupportedLanguage supportSource + * @property {boolean|null} [supportTarget] SupportedLanguage supportTarget + */ + + /** + * Constructs a new SupportedLanguage. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a SupportedLanguage. + * @implements ISupportedLanguage + * @constructor + * @param {google.cloud.translation.v3.ISupportedLanguage=} [properties] Properties to set + */ + function SupportedLanguage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SupportedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.translation.v3.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.languageCode = ""; + + /** + * SupportedLanguage displayName. + * @member {string} displayName + * @memberof google.cloud.translation.v3.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.displayName = ""; + + /** + * SupportedLanguage supportSource. + * @member {boolean} supportSource + * @memberof google.cloud.translation.v3.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.supportSource = false; + + /** + * SupportedLanguage supportTarget. + * @member {boolean} supportTarget + * @memberof google.cloud.translation.v3.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.supportTarget = false; + + /** + * Creates a new SupportedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {google.cloud.translation.v3.ISupportedLanguage=} [properties] Properties to set + * @returns {google.cloud.translation.v3.SupportedLanguage} SupportedLanguage instance + */ + SupportedLanguage.create = function create(properties) { + return new SupportedLanguage(properties); + }; + + /** + * Encodes the specified SupportedLanguage message. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {google.cloud.translation.v3.ISupportedLanguage} message SupportedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguage.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.supportSource != null && Object.hasOwnProperty.call(message, "supportSource")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.supportSource); + if (message.supportTarget != null && Object.hasOwnProperty.call(message, "supportTarget")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.supportTarget); + return writer; + }; + + /** + * Encodes the specified SupportedLanguage message, length delimited. Does not implicitly {@link google.cloud.translation.v3.SupportedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {google.cloud.translation.v3.ISupportedLanguage} message SupportedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.SupportedLanguage} SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.SupportedLanguage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.supportSource = reader.bool(); + break; + } + case 4: { + message.supportTarget = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.SupportedLanguage} SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SupportedLanguage message. + * @function verify + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SupportedLanguage.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.supportSource != null && message.hasOwnProperty("supportSource")) + if (typeof message.supportSource !== "boolean") + return "supportSource: boolean expected"; + if (message.supportTarget != null && message.hasOwnProperty("supportTarget")) + if (typeof message.supportTarget !== "boolean") + return "supportTarget: boolean expected"; + return null; + }; + + /** + * Creates a SupportedLanguage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.SupportedLanguage} SupportedLanguage + */ + SupportedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.SupportedLanguage) + return object; + var message = new $root.google.cloud.translation.v3.SupportedLanguage(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.supportSource != null) + message.supportSource = Boolean(object.supportSource); + if (object.supportTarget != null) + message.supportTarget = Boolean(object.supportTarget); + return message; + }; + + /** + * Creates a plain object from a SupportedLanguage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {google.cloud.translation.v3.SupportedLanguage} message SupportedLanguage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SupportedLanguage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.languageCode = ""; + object.displayName = ""; + object.supportSource = false; + object.supportTarget = false; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.supportSource != null && message.hasOwnProperty("supportSource")) + object.supportSource = message.supportSource; + if (message.supportTarget != null && message.hasOwnProperty("supportTarget")) + object.supportTarget = message.supportTarget; + return object; + }; + + /** + * Converts this SupportedLanguage to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.SupportedLanguage + * @instance + * @returns {Object.} JSON object + */ + SupportedLanguage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SupportedLanguage + * @function getTypeUrl + * @memberof google.cloud.translation.v3.SupportedLanguage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SupportedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.SupportedLanguage"; + }; + + return SupportedLanguage; + })(); + + v3.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.translation.v3 + * @interface IGcsSource + * @property {string|null} [inputUri] GcsSource inputUri + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.translation.v3.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 inputUri. + * @member {string} inputUri + * @memberof google.cloud.translation.v3.GcsSource + * @instance + */ + GcsSource.prototype.inputUri = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.GcsSource + * @static + * @param {google.cloud.translation.v3.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.translation.v3.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.translation.v3.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.GcsSource + * @static + * @param {google.cloud.translation.v3.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.inputUri != null && Object.hasOwnProperty.call(message, "inputUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUri); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.GcsSource + * @static + * @param {google.cloud.translation.v3.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.translation.v3.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.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.translation.v3.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.inputUri = 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.translation.v3.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.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.translation.v3.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.inputUri != null && message.hasOwnProperty("inputUri")) + if (!$util.isString(message.inputUri)) + return "inputUri: 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.translation.v3.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.GcsSource) + return object; + var message = new $root.google.cloud.translation.v3.GcsSource(); + if (object.inputUri != null) + message.inputUri = String(object.inputUri); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.GcsSource + * @static + * @param {google.cloud.translation.v3.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.inputUri = ""; + if (message.inputUri != null && message.hasOwnProperty("inputUri")) + object.inputUri = message.inputUri; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.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.translation.v3.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.translation.v3.GcsSource"; + }; + + return GcsSource; + })(); + + v3.InputConfig = (function() { + + /** + * Properties of an InputConfig. + * @memberof google.cloud.translation.v3 + * @interface IInputConfig + * @property {string|null} [mimeType] InputConfig mimeType + * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] InputConfig gcsSource + */ + + /** + * Constructs a new InputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents an InputConfig. + * @implements IInputConfig + * @constructor + * @param {google.cloud.translation.v3.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 mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.InputConfig + * @instance + */ + InputConfig.prototype.mimeType = ""; + + /** + * InputConfig gcsSource. + * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3.InputConfig + * @instance + */ + InputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3.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.translation.v3.InputConfig + * @static + * @param {google.cloud.translation.v3.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.InputConfig} InputConfig instance + */ + InputConfig.create = function create(properties) { + return new InputConfig(properties); + }; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.translation.v3.InputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.InputConfig + * @static + * @param {google.cloud.translation.v3.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.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mimeType); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.InputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.InputConfig + * @static + * @param {google.cloud.translation.v3.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.translation.v3.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.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.translation.v3.InputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mimeType = reader.string(); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); + 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.translation.v3.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.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.translation.v3.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.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.translation.v3.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.InputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.InputConfig} InputConfig + */ + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.InputConfig) + return object; + var message = new $root.google.cloud.translation.v3.InputConfig(); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.InputConfig + * @static + * @param {google.cloud.translation.v3.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.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this InputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.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.translation.v3.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.translation.v3.InputConfig"; + }; + + return InputConfig; + })(); + + v3.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.translation.v3 + * @interface IGcsDestination + * @property {string|null} [outputUriPrefix] GcsDestination outputUriPrefix + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.translation.v3.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 outputUriPrefix. + * @member {string} outputUriPrefix + * @memberof google.cloud.translation.v3.GcsDestination + * @instance + */ + GcsDestination.prototype.outputUriPrefix = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.GcsDestination + * @static + * @param {google.cloud.translation.v3.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.translation.v3.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.translation.v3.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.GcsDestination + * @static + * @param {google.cloud.translation.v3.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.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.outputUriPrefix); + return writer; + }; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.GcsDestination + * @static + * @param {google.cloud.translation.v3.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.translation.v3.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.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.translation.v3.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.outputUriPrefix = 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.translation.v3.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.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.translation.v3.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.outputUriPrefix != null && message.hasOwnProperty("outputUriPrefix")) + if (!$util.isString(message.outputUriPrefix)) + return "outputUriPrefix: 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.translation.v3.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.GcsDestination) + return object; + var message = new $root.google.cloud.translation.v3.GcsDestination(); + if (object.outputUriPrefix != null) + message.outputUriPrefix = String(object.outputUriPrefix); + return message; + }; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.GcsDestination + * @static + * @param {google.cloud.translation.v3.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.outputUriPrefix = ""; + if (message.outputUriPrefix != null && message.hasOwnProperty("outputUriPrefix")) + object.outputUriPrefix = message.outputUriPrefix; + return object; + }; + + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.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.translation.v3.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.translation.v3.GcsDestination"; + }; + + return GcsDestination; + })(); + + v3.OutputConfig = (function() { + + /** + * Properties of an OutputConfig. + * @memberof google.cloud.translation.v3 + * @interface IOutputConfig + * @property {google.cloud.translation.v3.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + */ + + /** + * Constructs a new OutputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig + * @constructor + * @param {google.cloud.translation.v3.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.translation.v3.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3.OutputConfig + * @instance + */ + OutputConfig.prototype.gcsDestination = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * OutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3.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.translation.v3.OutputConfig + * @static + * @param {google.cloud.translation.v3.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.OutputConfig} OutputConfig instance + */ + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); + }; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.translation.v3.OutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.OutputConfig + * @static + * @param {google.cloud.translation.v3.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.translation.v3.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.OutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.OutputConfig + * @static + * @param {google.cloud.translation.v3.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.translation.v3.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.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.translation.v3.OutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.decode(reader, reader.uint32()); + 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.translation.v3.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.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.translation.v3.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.translation.v3.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + return null; + }; + + /** + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.OutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.OutputConfig} OutputConfig + */ + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.OutputConfig) + return object; + var message = new $root.google.cloud.translation.v3.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.fromObject(object.gcsDestination); + } + return message; + }; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.OutputConfig + * @static + * @param {google.cloud.translation.v3.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 (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + return object; + }; + + /** + * Converts this OutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.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.translation.v3.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.translation.v3.OutputConfig"; + }; + + return OutputConfig; + })(); + + v3.DocumentInputConfig = (function() { + + /** + * Properties of a DocumentInputConfig. + * @memberof google.cloud.translation.v3 + * @interface IDocumentInputConfig + * @property {Uint8Array|null} [content] DocumentInputConfig content + * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] DocumentInputConfig gcsSource + * @property {string|null} [mimeType] DocumentInputConfig mimeType + */ + + /** + * Constructs a new DocumentInputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DocumentInputConfig. + * @implements IDocumentInputConfig + * @constructor + * @param {google.cloud.translation.v3.IDocumentInputConfig=} [properties] Properties to set + */ + function DocumentInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentInputConfig content. + * @member {Uint8Array|null|undefined} content + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @instance + */ + DocumentInputConfig.prototype.content = null; + + /** + * DocumentInputConfig gcsSource. + * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @instance + */ + DocumentInputConfig.prototype.gcsSource = null; + + /** + * DocumentInputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @instance + */ + DocumentInputConfig.prototype.mimeType = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DocumentInputConfig source. + * @member {"content"|"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @instance + */ + Object.defineProperty(DocumentInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["content", "gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DocumentInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3.IDocumentInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig instance + */ + DocumentInputConfig.create = function create(properties) { + return new DocumentInputConfig(properties); + }; + + /** + * Encodes the specified DocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3.IDocumentInputConfig} message DocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentInputConfig.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.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified DocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3.IDocumentInputConfig} message DocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DocumentInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.content = reader.bytes(); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); + break; + } + case 4: { + message.mimeType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentInputConfig message. + * @function verify + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.content != null && message.hasOwnProperty("content")) { + properties.source = 1; + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.translation.v3.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 a DocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DocumentInputConfig} DocumentInputConfig + */ + DocumentInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DocumentInputConfig) + return object; + var message = new $root.google.cloud.translation.v3.DocumentInputConfig(); + 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.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3.DocumentInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a DocumentInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3.DocumentInputConfig} message DocumentInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + 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 (options.oneofs) + object.source = "content"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3.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 DocumentInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @instance + * @returns {Object.} JSON object + */ + DocumentInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentInputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3.DocumentInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.DocumentInputConfig"; + }; + + return DocumentInputConfig; + })(); + + v3.DocumentOutputConfig = (function() { + + /** + * Properties of a DocumentOutputConfig. + * @memberof google.cloud.translation.v3 + * @interface IDocumentOutputConfig + * @property {google.cloud.translation.v3.IGcsDestination|null} [gcsDestination] DocumentOutputConfig gcsDestination + * @property {string|null} [mimeType] DocumentOutputConfig mimeType + */ + + /** + * Constructs a new DocumentOutputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DocumentOutputConfig. + * @implements IDocumentOutputConfig + * @constructor + * @param {google.cloud.translation.v3.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 gcsDestination. + * @member {google.cloud.translation.v3.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @instance + */ + DocumentOutputConfig.prototype.gcsDestination = null; + + /** + * DocumentOutputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @instance + */ + DocumentOutputConfig.prototype.mimeType = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DocumentOutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @instance + */ + Object.defineProperty(DocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.IDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DocumentOutputConfig} DocumentOutputConfig instance + */ + DocumentOutputConfig.create = function create(properties) { + return new DocumentOutputConfig(properties); + }; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.DocumentOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.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.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.translation.v3.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.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.translation.v3.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.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.translation.v3.DocumentOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.decode(reader, reader.uint32()); + break; + } + case 3: { + message.mimeType = reader.string(); + 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.translation.v3.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.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.translation.v3.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.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.translation.v3.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DocumentOutputConfig} DocumentOutputConfig + */ + DocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DocumentOutputConfig) + return object; + var message = new $root.google.cloud.translation.v3.DocumentOutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3.DocumentOutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.fromObject(object.gcsDestination); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.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 (options.defaults) + object.mimeType = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this DocumentOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.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.translation.v3.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.translation.v3.DocumentOutputConfig"; + }; + + return DocumentOutputConfig; + })(); + + v3.TranslateDocumentRequest = (function() { + + /** + * Properties of a TranslateDocumentRequest. + * @memberof google.cloud.translation.v3 + * @interface ITranslateDocumentRequest + * @property {string|null} [parent] TranslateDocumentRequest parent + * @property {string|null} [sourceLanguageCode] TranslateDocumentRequest sourceLanguageCode + * @property {string|null} [targetLanguageCode] TranslateDocumentRequest targetLanguageCode + * @property {google.cloud.translation.v3.IDocumentInputConfig|null} [documentInputConfig] TranslateDocumentRequest documentInputConfig + * @property {google.cloud.translation.v3.IDocumentOutputConfig|null} [documentOutputConfig] TranslateDocumentRequest documentOutputConfig + * @property {string|null} [model] TranslateDocumentRequest model + * @property {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateDocumentRequest glossaryConfig + * @property {Object.|null} [labels] TranslateDocumentRequest labels + */ + + /** + * Constructs a new TranslateDocumentRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a TranslateDocumentRequest. + * @implements ITranslateDocumentRequest + * @constructor + * @param {google.cloud.translation.v3.ITranslateDocumentRequest=} [properties] Properties to set + */ + function TranslateDocumentRequest(properties) { + 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]]; + } + + /** + * TranslateDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.parent = ""; + + /** + * TranslateDocumentRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.sourceLanguageCode = ""; + + /** + * TranslateDocumentRequest targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.targetLanguageCode = ""; + + /** + * TranslateDocumentRequest documentInputConfig. + * @member {google.cloud.translation.v3.IDocumentInputConfig|null|undefined} documentInputConfig + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.documentInputConfig = null; + + /** + * TranslateDocumentRequest documentOutputConfig. + * @member {google.cloud.translation.v3.IDocumentOutputConfig|null|undefined} documentOutputConfig + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.documentOutputConfig = null; + + /** + * TranslateDocumentRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.model = ""; + + /** + * TranslateDocumentRequest glossaryConfig. + * @member {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.glossaryConfig = null; + + /** + * TranslateDocumentRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new TranslateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.ITranslateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest instance + */ + TranslateDocumentRequest.create = function create(properties) { + return new TranslateDocumentRequest(properties); + }; + + /** + * Encodes the specified TranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} message TranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentRequest.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.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCode); + if (message.documentInputConfig != null && Object.hasOwnProperty.call(message, "documentInputConfig")) + $root.google.cloud.translation.v3.DocumentInputConfig.encode(message.documentInputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.documentOutputConfig != null && Object.hasOwnProperty.call(message, "documentOutputConfig")) + $root.google.cloud.translation.v3.DocumentOutputConfig.encode(message.documentOutputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.ITranslateDocumentRequest} message TranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.TranslateDocumentRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sourceLanguageCode = reader.string(); + break; + } + case 3: { + message.targetLanguageCode = reader.string(); + break; + } + case 4: { + message.documentInputConfig = $root.google.cloud.translation.v3.DocumentInputConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.documentOutputConfig = $root.google.cloud.translation.v3.DocumentOutputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.model = reader.string(); + break; + } + case 7: { + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateDocumentRequest message. + * @function verify + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateDocumentRequest.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.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + if (message.documentInputConfig != null && message.hasOwnProperty("documentInputConfig")) { + var error = $root.google.cloud.translation.v3.DocumentInputConfig.verify(message.documentInputConfig); + if (error) + return "documentInputConfig." + error; + } + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) { + var error = $root.google.cloud.translation.v3.DocumentOutputConfig.verify(message.documentOutputConfig); + if (error) + return "documentOutputConfig." + error; + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a TranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.TranslateDocumentRequest} TranslateDocumentRequest + */ + TranslateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.TranslateDocumentRequest) + return object; + var message = new $root.google.cloud.translation.v3.TranslateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + if (object.documentInputConfig != null) { + if (typeof object.documentInputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.documentInputConfig: object expected"); + message.documentInputConfig = $root.google.cloud.translation.v3.DocumentInputConfig.fromObject(object.documentInputConfig); + } + if (object.documentOutputConfig != null) { + if (typeof object.documentOutputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.documentOutputConfig: object expected"); + message.documentOutputConfig = $root.google.cloud.translation.v3.DocumentOutputConfig.fromObject(object.documentOutputConfig); + } + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a TranslateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.TranslateDocumentRequest} message TranslateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.parent = ""; + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + object.documentInputConfig = null; + object.documentOutputConfig = null; + object.model = ""; + object.glossaryConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + if (message.documentInputConfig != null && message.hasOwnProperty("documentInputConfig")) + object.documentInputConfig = $root.google.cloud.translation.v3.DocumentInputConfig.toObject(message.documentInputConfig, options); + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) + object.documentOutputConfig = $root.google.cloud.translation.v3.DocumentOutputConfig.toObject(message.documentOutputConfig, options); + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this TranslateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + TranslateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.TranslateDocumentRequest"; + }; + + return TranslateDocumentRequest; + })(); + + v3.DocumentTranslation = (function() { + + /** + * Properties of a DocumentTranslation. + * @memberof google.cloud.translation.v3 + * @interface IDocumentTranslation + * @property {Array.|null} [byteStreamOutputs] DocumentTranslation byteStreamOutputs + * @property {string|null} [mimeType] DocumentTranslation mimeType + * @property {string|null} [detectedLanguageCode] DocumentTranslation detectedLanguageCode + */ + + /** + * Constructs a new DocumentTranslation. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DocumentTranslation. + * @implements IDocumentTranslation + * @constructor + * @param {google.cloud.translation.v3.IDocumentTranslation=} [properties] Properties to set + */ + function DocumentTranslation(properties) { + this.byteStreamOutputs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentTranslation byteStreamOutputs. + * @member {Array.} byteStreamOutputs + * @memberof google.cloud.translation.v3.DocumentTranslation + * @instance + */ + DocumentTranslation.prototype.byteStreamOutputs = $util.emptyArray; + + /** + * DocumentTranslation mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3.DocumentTranslation + * @instance + */ + DocumentTranslation.prototype.mimeType = ""; + + /** + * DocumentTranslation detectedLanguageCode. + * @member {string} detectedLanguageCode + * @memberof google.cloud.translation.v3.DocumentTranslation + * @instance + */ + DocumentTranslation.prototype.detectedLanguageCode = ""; + + /** + * Creates a new DocumentTranslation instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {google.cloud.translation.v3.IDocumentTranslation=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation instance + */ + DocumentTranslation.create = function create(properties) { + return new DocumentTranslation(properties); + }; + + /** + * Encodes the specified DocumentTranslation message. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {google.cloud.translation.v3.IDocumentTranslation} message DocumentTranslation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTranslation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.byteStreamOutputs != null && message.byteStreamOutputs.length) + for (var i = 0; i < message.byteStreamOutputs.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.byteStreamOutputs[i]); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.detectedLanguageCode != null && Object.hasOwnProperty.call(message, "detectedLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.detectedLanguageCode); + return writer; + }; + + /** + * Encodes the specified DocumentTranslation message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DocumentTranslation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {google.cloud.translation.v3.IDocumentTranslation} message DocumentTranslation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTranslation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTranslation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DocumentTranslation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.byteStreamOutputs && message.byteStreamOutputs.length)) + message.byteStreamOutputs = []; + message.byteStreamOutputs.push(reader.bytes()); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } + case 3: { + message.detectedLanguageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTranslation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentTranslation message. + * @function verify + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentTranslation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.byteStreamOutputs != null && message.hasOwnProperty("byteStreamOutputs")) { + if (!Array.isArray(message.byteStreamOutputs)) + return "byteStreamOutputs: array expected"; + for (var i = 0; i < message.byteStreamOutputs.length; ++i) + if (!(message.byteStreamOutputs[i] && typeof message.byteStreamOutputs[i].length === "number" || $util.isString(message.byteStreamOutputs[i]))) + return "byteStreamOutputs: buffer[] expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + if (!$util.isString(message.detectedLanguageCode)) + return "detectedLanguageCode: string expected"; + return null; + }; + + /** + * Creates a DocumentTranslation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DocumentTranslation} DocumentTranslation + */ + DocumentTranslation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DocumentTranslation) + return object; + var message = new $root.google.cloud.translation.v3.DocumentTranslation(); + if (object.byteStreamOutputs) { + if (!Array.isArray(object.byteStreamOutputs)) + throw TypeError(".google.cloud.translation.v3.DocumentTranslation.byteStreamOutputs: array expected"); + message.byteStreamOutputs = []; + for (var i = 0; i < object.byteStreamOutputs.length; ++i) + if (typeof object.byteStreamOutputs[i] === "string") + $util.base64.decode(object.byteStreamOutputs[i], message.byteStreamOutputs[i] = $util.newBuffer($util.base64.length(object.byteStreamOutputs[i])), 0); + else if (object.byteStreamOutputs[i].length >= 0) + message.byteStreamOutputs[i] = object.byteStreamOutputs[i]; + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.detectedLanguageCode != null) + message.detectedLanguageCode = String(object.detectedLanguageCode); + return message; + }; + + /** + * Creates a plain object from a DocumentTranslation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {google.cloud.translation.v3.DocumentTranslation} message DocumentTranslation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentTranslation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.byteStreamOutputs = []; + if (options.defaults) { + object.mimeType = ""; + object.detectedLanguageCode = ""; + } + if (message.byteStreamOutputs && message.byteStreamOutputs.length) { + object.byteStreamOutputs = []; + for (var j = 0; j < message.byteStreamOutputs.length; ++j) + object.byteStreamOutputs[j] = options.bytes === String ? $util.base64.encode(message.byteStreamOutputs[j], 0, message.byteStreamOutputs[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.byteStreamOutputs[j]) : message.byteStreamOutputs[j]; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + object.detectedLanguageCode = message.detectedLanguageCode; + return object; + }; + + /** + * Converts this DocumentTranslation to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DocumentTranslation + * @instance + * @returns {Object.} JSON object + */ + DocumentTranslation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentTranslation + * @function getTypeUrl + * @memberof google.cloud.translation.v3.DocumentTranslation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentTranslation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.DocumentTranslation"; + }; + + return DocumentTranslation; + })(); + + v3.TranslateDocumentResponse = (function() { + + /** + * Properties of a TranslateDocumentResponse. + * @memberof google.cloud.translation.v3 + * @interface ITranslateDocumentResponse + * @property {google.cloud.translation.v3.IDocumentTranslation|null} [documentTranslation] TranslateDocumentResponse documentTranslation + * @property {google.cloud.translation.v3.IDocumentTranslation|null} [glossaryDocumentTranslation] TranslateDocumentResponse glossaryDocumentTranslation + * @property {string|null} [model] TranslateDocumentResponse model + * @property {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateDocumentResponse glossaryConfig + */ + + /** + * Constructs a new TranslateDocumentResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a TranslateDocumentResponse. + * @implements ITranslateDocumentResponse + * @constructor + * @param {google.cloud.translation.v3.ITranslateDocumentResponse=} [properties] Properties to set + */ + function TranslateDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranslateDocumentResponse documentTranslation. + * @member {google.cloud.translation.v3.IDocumentTranslation|null|undefined} documentTranslation + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.documentTranslation = null; + + /** + * TranslateDocumentResponse glossaryDocumentTranslation. + * @member {google.cloud.translation.v3.IDocumentTranslation|null|undefined} glossaryDocumentTranslation + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.glossaryDocumentTranslation = null; + + /** + * TranslateDocumentResponse model. + * @member {string} model + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.model = ""; + + /** + * TranslateDocumentResponse glossaryConfig. + * @member {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.glossaryConfig = null; + + /** + * Creates a new TranslateDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.ITranslateDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse instance + */ + TranslateDocumentResponse.create = function create(properties) { + return new TranslateDocumentResponse(properties); + }; + + /** + * Encodes the specified TranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.ITranslateDocumentResponse} message TranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentTranslation != null && Object.hasOwnProperty.call(message, "documentTranslation")) + $root.google.cloud.translation.v3.DocumentTranslation.encode(message.documentTranslation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.glossaryDocumentTranslation != null && Object.hasOwnProperty.call(message, "glossaryDocumentTranslation")) + $root.google.cloud.translation.v3.DocumentTranslation.encode(message.glossaryDocumentTranslation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.TranslateDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.ITranslateDocumentResponse} message TranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.TranslateDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.documentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.decode(reader, reader.uint32()); + break; + } + case 2: { + message.glossaryDocumentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.decode(reader, reader.uint32()); + break; + } + case 3: { + message.model = reader.string(); + break; + } + case 4: { + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateDocumentResponse message. + * @function verify + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentTranslation != null && message.hasOwnProperty("documentTranslation")) { + var error = $root.google.cloud.translation.v3.DocumentTranslation.verify(message.documentTranslation); + if (error) + return "documentTranslation." + error; + } + if (message.glossaryDocumentTranslation != null && message.hasOwnProperty("glossaryDocumentTranslation")) { + var error = $root.google.cloud.translation.v3.DocumentTranslation.verify(message.glossaryDocumentTranslation); + if (error) + return "glossaryDocumentTranslation." + error; + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + return null; + }; + + /** + * Creates a TranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.TranslateDocumentResponse} TranslateDocumentResponse + */ + TranslateDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.TranslateDocumentResponse) + return object; + var message = new $root.google.cloud.translation.v3.TranslateDocumentResponse(); + if (object.documentTranslation != null) { + if (typeof object.documentTranslation !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentResponse.documentTranslation: object expected"); + message.documentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.fromObject(object.documentTranslation); + } + if (object.glossaryDocumentTranslation != null) { + if (typeof object.glossaryDocumentTranslation !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentResponse.glossaryDocumentTranslation: object expected"); + message.glossaryDocumentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.fromObject(object.glossaryDocumentTranslation); + } + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3.TranslateDocumentResponse.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + return message; + }; + + /** + * Creates a plain object from a TranslateDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.TranslateDocumentResponse} message TranslateDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.documentTranslation = null; + object.glossaryDocumentTranslation = null; + object.model = ""; + object.glossaryConfig = null; + } + if (message.documentTranslation != null && message.hasOwnProperty("documentTranslation")) + object.documentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.toObject(message.documentTranslation, options); + if (message.glossaryDocumentTranslation != null && message.hasOwnProperty("glossaryDocumentTranslation")) + object.glossaryDocumentTranslation = $root.google.cloud.translation.v3.DocumentTranslation.toObject(message.glossaryDocumentTranslation, options); + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + return object; + }; + + /** + * Converts this TranslateDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + TranslateDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3.TranslateDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.TranslateDocumentResponse"; + }; + + return TranslateDocumentResponse; + })(); + + v3.BatchTranslateTextRequest = (function() { + + /** + * Properties of a BatchTranslateTextRequest. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateTextRequest + * @property {string|null} [parent] BatchTranslateTextRequest parent + * @property {string|null} [sourceLanguageCode] BatchTranslateTextRequest sourceLanguageCode + * @property {Array.|null} [targetLanguageCodes] BatchTranslateTextRequest targetLanguageCodes + * @property {Object.|null} [models] BatchTranslateTextRequest models + * @property {Array.|null} [inputConfigs] BatchTranslateTextRequest inputConfigs + * @property {google.cloud.translation.v3.IOutputConfig|null} [outputConfig] BatchTranslateTextRequest outputConfig + * @property {Object.|null} [glossaries] BatchTranslateTextRequest glossaries + * @property {Object.|null} [labels] BatchTranslateTextRequest labels + */ + + /** + * Constructs a new BatchTranslateTextRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateTextRequest. + * @implements IBatchTranslateTextRequest + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest=} [properties] Properties to set + */ + function BatchTranslateTextRequest(properties) { + this.targetLanguageCodes = []; + this.models = {}; + this.inputConfigs = []; + this.glossaries = {}; + 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]]; + } + + /** + * BatchTranslateTextRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.parent = ""; + + /** + * BatchTranslateTextRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.sourceLanguageCode = ""; + + /** + * BatchTranslateTextRequest targetLanguageCodes. + * @member {Array.} targetLanguageCodes + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.targetLanguageCodes = $util.emptyArray; + + /** + * BatchTranslateTextRequest models. + * @member {Object.} models + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.models = $util.emptyObject; + + /** + * BatchTranslateTextRequest inputConfigs. + * @member {Array.} inputConfigs + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.inputConfigs = $util.emptyArray; + + /** + * BatchTranslateTextRequest outputConfig. + * @member {google.cloud.translation.v3.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.outputConfig = null; + + /** + * BatchTranslateTextRequest glossaries. + * @member {Object.} glossaries + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.glossaries = $util.emptyObject; + + /** + * BatchTranslateTextRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new BatchTranslateTextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest instance + */ + BatchTranslateTextRequest.create = function create(properties) { + return new BatchTranslateTextRequest(properties); + }; + + /** + * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateTextRequest.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.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCodes != null && message.targetLanguageCodes.length) + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCodes[i]); + if (message.models != null && Object.hasOwnProperty.call(message, "models")) + for (var keys = Object.keys(message.models), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.models[keys[i]]).ldelim(); + if (message.inputConfigs != null && message.inputConfigs.length) + for (var i = 0; i < message.inputConfigs.length; ++i) + $root.google.cloud.translation.v3.InputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.translation.v3.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.glossaries != null && Object.hasOwnProperty.call(message, "glossaries")) + for (var keys = Object.keys(message.glossaries), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateTextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateTextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateTextRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sourceLanguageCode = reader.string(); + break; + } + case 3: { + if (!(message.targetLanguageCodes && message.targetLanguageCodes.length)) + message.targetLanguageCodes = []; + message.targetLanguageCodes.push(reader.string()); + break; + } + case 4: { + if (message.models === $util.emptyObject) + message.models = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.models[key] = value; + break; + } + case 5: { + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.translation.v3.InputConfig.decode(reader, reader.uint32())); + break; + } + case 6: { + message.outputConfig = $root.google.cloud.translation.v3.OutputConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + if (message.glossaries === $util.emptyObject) + message.glossaries = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.glossaries[key] = value; + break; + } + case 9: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateTextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateTextRequest message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateTextRequest.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.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCodes != null && message.hasOwnProperty("targetLanguageCodes")) { + if (!Array.isArray(message.targetLanguageCodes)) + return "targetLanguageCodes: array expected"; + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + if (!$util.isString(message.targetLanguageCodes[i])) + return "targetLanguageCodes: string[] expected"; + } + if (message.models != null && message.hasOwnProperty("models")) { + if (!$util.isObject(message.models)) + return "models: object expected"; + var key = Object.keys(message.models); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.models[key[i]])) + return "models: string{k: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.translation.v3.InputConfig.verify(message.inputConfigs[i]); + if (error) + return "inputConfigs." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.translation.v3.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!$util.isObject(message.glossaries)) + return "glossaries: object expected"; + var key = Object.keys(message.glossaries); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaries[key[i]]); + if (error) + return "glossaries." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateTextRequest} BatchTranslateTextRequest + */ + BatchTranslateTextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateTextRequest) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateTextRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCodes) { + if (!Array.isArray(object.targetLanguageCodes)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.targetLanguageCodes: array expected"); + message.targetLanguageCodes = []; + for (var i = 0; i < object.targetLanguageCodes.length; ++i) + message.targetLanguageCodes[i] = String(object.targetLanguageCodes[i]); + } + if (object.models) { + if (typeof object.models !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.models: object expected"); + message.models = {}; + for (var keys = Object.keys(object.models), i = 0; i < keys.length; ++i) + message.models[keys[i]] = String(object.models[keys[i]]); + } + if (object.inputConfigs) { + if (!Array.isArray(object.inputConfigs)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.inputConfigs: array expected"); + message.inputConfigs = []; + for (var i = 0; i < object.inputConfigs.length; ++i) { + if (typeof object.inputConfigs[i] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.inputConfigs: object expected"); + message.inputConfigs[i] = $root.google.cloud.translation.v3.InputConfig.fromObject(object.inputConfigs[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.translation.v3.OutputConfig.fromObject(object.outputConfig); + } + if (object.glossaries) { + if (typeof object.glossaries !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.glossaries: object expected"); + message.glossaries = {}; + for (var keys = Object.keys(object.glossaries), i = 0; i < keys.length; ++i) { + if (typeof object.glossaries[keys[i]] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.glossaries: object expected"); + message.glossaries[keys[i]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateTextRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3.BatchTranslateTextRequest} message BatchTranslateTextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateTextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.targetLanguageCodes = []; + object.inputConfigs = []; + } + if (options.objects || options.defaults) { + object.models = {}; + object.glossaries = {}; + object.labels = {}; + } + if (options.defaults) { + object.parent = ""; + object.sourceLanguageCode = ""; + object.outputConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCodes && message.targetLanguageCodes.length) { + object.targetLanguageCodes = []; + for (var j = 0; j < message.targetLanguageCodes.length; ++j) + object.targetLanguageCodes[j] = message.targetLanguageCodes[j]; + } + var keys2; + if (message.models && (keys2 = Object.keys(message.models)).length) { + object.models = {}; + for (var j = 0; j < keys2.length; ++j) + object.models[keys2[j]] = message.models[keys2[j]]; + } + if (message.inputConfigs && message.inputConfigs.length) { + object.inputConfigs = []; + for (var j = 0; j < message.inputConfigs.length; ++j) + object.inputConfigs[j] = $root.google.cloud.translation.v3.InputConfig.toObject(message.inputConfigs[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.translation.v3.OutputConfig.toObject(message.outputConfig, options); + if (message.glossaries && (keys2 = Object.keys(message.glossaries)).length) { + object.glossaries = {}; + for (var j = 0; j < keys2.length; ++j) + object.glossaries[keys2[j]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this BatchTranslateTextRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateTextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateTextRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchTranslateTextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchTranslateTextRequest"; + }; + + return BatchTranslateTextRequest; + })(); + + v3.BatchTranslateMetadata = (function() { + + /** + * Properties of a BatchTranslateMetadata. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateMetadata + * @property {google.cloud.translation.v3.BatchTranslateMetadata.State|null} [state] BatchTranslateMetadata state + * @property {number|Long|null} [translatedCharacters] BatchTranslateMetadata translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateMetadata failedCharacters + * @property {number|Long|null} [totalCharacters] BatchTranslateMetadata totalCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateMetadata submitTime + */ + + /** + * Constructs a new BatchTranslateMetadata. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateMetadata. + * @implements IBatchTranslateMetadata + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateMetadata=} [properties] Properties to set + */ + function BatchTranslateMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateMetadata state. + * @member {google.cloud.translation.v3.BatchTranslateMetadata.State} state + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.state = 0; + + /** + * BatchTranslateMetadata translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.submitTime = null; + + /** + * Creates a new BatchTranslateMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata instance + */ + BatchTranslateMetadata.create = function create(properties) { + return new BatchTranslateMetadata(properties); + }; + + /** + * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateMetadata.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.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.translatedCharacters = reader.int64(); + break; + } + case 3: { + message.failedCharacters = reader.int64(); + break; + } + case 4: { + message.totalCharacters = reader.int64(); + break; + } + case 5: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateMetadata message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateMetadata.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.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateMetadata} BatchTranslateMetadata + */ + BatchTranslateMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateMetadata) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateMetadata(); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3.BatchTranslateMetadata} message BatchTranslateMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.BatchTranslateMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3.BatchTranslateMetadata.State[message.state] : message.state; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this BatchTranslateMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchTranslateMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchTranslateMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3.BatchTranslateMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + BatchTranslateMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return BatchTranslateMetadata; + })(); + + v3.BatchTranslateResponse = (function() { + + /** + * Properties of a BatchTranslateResponse. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateResponse + * @property {number|Long|null} [totalCharacters] BatchTranslateResponse totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateResponse translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateResponse failedCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] BatchTranslateResponse endTime + */ + + /** + * Constructs a new BatchTranslateResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateResponse. + * @implements IBatchTranslateResponse + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateResponse=} [properties] Properties to set + */ + function BatchTranslateResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateResponse totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.submitTime = null; + + /** + * BatchTranslateResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.endTime = null; + + /** + * Creates a new BatchTranslateResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse instance + */ + BatchTranslateResponse.create = function create(properties) { + return new BatchTranslateResponse(properties); + }; + + /** + * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.totalCharacters = reader.int64(); + break; + } + case 2: { + message.translatedCharacters = reader.int64(); + break; + } + case 3: { + message.failedCharacters = reader.int64(); + break; + } + case 4: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateResponse message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateResponse} BatchTranslateResponse + */ + BatchTranslateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateResponse) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateResponse(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3.BatchTranslateResponse} message BatchTranslateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateResponse.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.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + object.endTime = null; + } + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this BatchTranslateResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchTranslateResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchTranslateResponse"; + }; + + return BatchTranslateResponse; + })(); + + v3.GlossaryInputConfig = (function() { + + /** + * Properties of a GlossaryInputConfig. + * @memberof google.cloud.translation.v3 + * @interface IGlossaryInputConfig + * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] GlossaryInputConfig gcsSource + */ + + /** + * Constructs a new GlossaryInputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a GlossaryInputConfig. + * @implements IGlossaryInputConfig + * @constructor + * @param {google.cloud.translation.v3.IGlossaryInputConfig=} [properties] Properties to set + */ + function GlossaryInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GlossaryInputConfig gcsSource. + * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @instance + */ + GlossaryInputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GlossaryInputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @instance + */ + Object.defineProperty(GlossaryInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GlossaryInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.IGlossaryInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig instance + */ + GlossaryInputConfig.create = function create(properties) { + return new GlossaryInputConfig(properties); + }; + + /** + * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlossaryInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GlossaryInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlossaryInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlossaryInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.GlossaryInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlossaryInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GlossaryInputConfig message. + * @function verify + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GlossaryInputConfig.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.translation.v3.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.GlossaryInputConfig} GlossaryInputConfig + */ + GlossaryInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.GlossaryInputConfig) + return object; + var message = new $root.google.cloud.translation.v3.GlossaryInputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3.GlossaryInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3.GlossaryInputConfig} message GlossaryInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GlossaryInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this GlossaryInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @instance + * @returns {Object.} JSON object + */ + GlossaryInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GlossaryInputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3.GlossaryInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GlossaryInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.GlossaryInputConfig"; + }; + + return GlossaryInputConfig; + })(); + + v3.Glossary = (function() { + + /** + * Properties of a Glossary. + * @memberof google.cloud.translation.v3 + * @interface IGlossary + * @property {string|null} [name] Glossary name + * @property {google.cloud.translation.v3.Glossary.ILanguageCodePair|null} [languagePair] Glossary languagePair + * @property {google.cloud.translation.v3.Glossary.ILanguageCodesSet|null} [languageCodesSet] Glossary languageCodesSet + * @property {google.cloud.translation.v3.IGlossaryInputConfig|null} [inputConfig] Glossary inputConfig + * @property {number|null} [entryCount] Glossary entryCount + * @property {google.protobuf.ITimestamp|null} [submitTime] Glossary submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] Glossary endTime + */ + + /** + * Constructs a new Glossary. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a Glossary. + * @implements IGlossary + * @constructor + * @param {google.cloud.translation.v3.IGlossary=} [properties] Properties to set + */ + function Glossary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Glossary name. + * @member {string} name + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.name = ""; + + /** + * Glossary languagePair. + * @member {google.cloud.translation.v3.Glossary.ILanguageCodePair|null|undefined} languagePair + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.languagePair = null; + + /** + * Glossary languageCodesSet. + * @member {google.cloud.translation.v3.Glossary.ILanguageCodesSet|null|undefined} languageCodesSet + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.languageCodesSet = null; + + /** + * Glossary inputConfig. + * @member {google.cloud.translation.v3.IGlossaryInputConfig|null|undefined} inputConfig + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.inputConfig = null; + + /** + * Glossary entryCount. + * @member {number} entryCount + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.entryCount = 0; + + /** + * Glossary submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.submitTime = null; + + /** + * Glossary endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.endTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Glossary languages. + * @member {"languagePair"|"languageCodesSet"|undefined} languages + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Object.defineProperty(Glossary.prototype, "languages", { + get: $util.oneOfGetter($oneOfFields = ["languagePair", "languageCodesSet"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Glossary instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.IGlossary=} [properties] Properties to set + * @returns {google.cloud.translation.v3.Glossary} Glossary instance + */ + Glossary.create = function create(properties) { + return new Glossary(properties); + }; + + /** + * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.IGlossary} message Glossary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Glossary.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.languagePair != null && Object.hasOwnProperty.call(message, "languagePair")) + $root.google.cloud.translation.v3.Glossary.LanguageCodePair.encode(message.languagePair, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCodesSet != null && Object.hasOwnProperty.call(message, "languageCodesSet")) + $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.encode(message.languageCodesSet, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.translation.v3.GlossaryInputConfig.encode(message.inputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.entryCount != null && Object.hasOwnProperty.call(message, "entryCount")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.entryCount); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.IGlossary} message Glossary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Glossary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Glossary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.Glossary} Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Glossary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.decode(reader, reader.uint32()); + break; + } + case 4: { + message.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.entryCount = reader.int32(); + break; + } + case 7: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Glossary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.Glossary} Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Glossary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Glossary message. + * @function verify + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Glossary.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.languagePair != null && message.hasOwnProperty("languagePair")) { + properties.languages = 1; + { + var error = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.verify(message.languagePair); + if (error) + return "languagePair." + error; + } + } + if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { + if (properties.languages === 1) + return "languages: multiple values"; + properties.languages = 1; + { + var error = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.verify(message.languageCodesSet); + if (error) + return "languageCodesSet." + error; + } + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.translation.v3.GlossaryInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.entryCount != null && message.hasOwnProperty("entryCount")) + if (!$util.isInteger(message.entryCount)) + return "entryCount: integer expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.Glossary} Glossary + */ + Glossary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.Glossary) + return object; + var message = new $root.google.cloud.translation.v3.Glossary(); + if (object.name != null) + message.name = String(object.name); + if (object.languagePair != null) { + if (typeof object.languagePair !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.languagePair: object expected"); + message.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.fromObject(object.languagePair); + } + if (object.languageCodesSet != null) { + if (typeof object.languageCodesSet !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.languageCodesSet: object expected"); + message.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.fromObject(object.languageCodesSet); + } + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.fromObject(object.inputConfig); + } + if (object.entryCount != null) + message.entryCount = object.entryCount | 0; + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.Glossary.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a Glossary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {google.cloud.translation.v3.Glossary} message Glossary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Glossary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputConfig = null; + object.entryCount = 0; + object.submitTime = null; + object.endTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languagePair != null && message.hasOwnProperty("languagePair")) { + object.languagePair = $root.google.cloud.translation.v3.Glossary.LanguageCodePair.toObject(message.languagePair, options); + if (options.oneofs) + object.languages = "languagePair"; + } + if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { + object.languageCodesSet = $root.google.cloud.translation.v3.Glossary.LanguageCodesSet.toObject(message.languageCodesSet, options); + if (options.oneofs) + object.languages = "languageCodesSet"; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.translation.v3.GlossaryInputConfig.toObject(message.inputConfig, options); + if (message.entryCount != null && message.hasOwnProperty("entryCount")) + object.entryCount = message.entryCount; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this Glossary to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.Glossary + * @instance + * @returns {Object.} JSON object + */ + Glossary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Glossary + * @function getTypeUrl + * @memberof google.cloud.translation.v3.Glossary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Glossary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.Glossary"; + }; + + Glossary.LanguageCodePair = (function() { + + /** + * Properties of a LanguageCodePair. + * @memberof google.cloud.translation.v3.Glossary + * @interface ILanguageCodePair + * @property {string|null} [sourceLanguageCode] LanguageCodePair sourceLanguageCode + * @property {string|null} [targetLanguageCode] LanguageCodePair targetLanguageCode + */ + + /** + * Constructs a new LanguageCodePair. + * @memberof google.cloud.translation.v3.Glossary + * @classdesc Represents a LanguageCodePair. + * @implements ILanguageCodePair + * @constructor + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair=} [properties] Properties to set + */ + function LanguageCodePair(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LanguageCodePair sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @instance + */ + LanguageCodePair.prototype.sourceLanguageCode = ""; + + /** + * LanguageCodePair targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @instance + */ + LanguageCodePair.prototype.targetLanguageCode = ""; + + /** + * Creates a new LanguageCodePair instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair=} [properties] Properties to set + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair instance + */ + LanguageCodePair.create = function create(properties) { + return new LanguageCodePair(properties); + }; + + /** + * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodePair.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLanguageCode); + return writer; + }; + + /** + * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodePair.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodePair.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodePair.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary.LanguageCodePair(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.sourceLanguageCode = reader.string(); + break; + } + case 2: { + message.targetLanguageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodePair.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LanguageCodePair message. + * @function verify + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LanguageCodePair.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + return null; + }; + + /** + * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.Glossary.LanguageCodePair} LanguageCodePair + */ + LanguageCodePair.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.Glossary.LanguageCodePair) + return object; + var message = new $root.google.cloud.translation.v3.Glossary.LanguageCodePair(); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + return message; + }; + + /** + * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3.Glossary.LanguageCodePair} message LanguageCodePair + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LanguageCodePair.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + } + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + return object; + }; + + /** + * Converts this LanguageCodePair to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @instance + * @returns {Object.} JSON object + */ + LanguageCodePair.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LanguageCodePair + * @function getTypeUrl + * @memberof google.cloud.translation.v3.Glossary.LanguageCodePair + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LanguageCodePair.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.Glossary.LanguageCodePair"; + }; + + return LanguageCodePair; + })(); + + Glossary.LanguageCodesSet = (function() { + + /** + * Properties of a LanguageCodesSet. + * @memberof google.cloud.translation.v3.Glossary + * @interface ILanguageCodesSet + * @property {Array.|null} [languageCodes] LanguageCodesSet languageCodes + */ + + /** + * Constructs a new LanguageCodesSet. + * @memberof google.cloud.translation.v3.Glossary + * @classdesc Represents a LanguageCodesSet. + * @implements ILanguageCodesSet + * @constructor + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet=} [properties] Properties to set + */ + function LanguageCodesSet(properties) { + this.languageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LanguageCodesSet languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @instance + */ + LanguageCodesSet.prototype.languageCodes = $util.emptyArray; + + /** + * Creates a new LanguageCodesSet instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet=} [properties] Properties to set + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet instance + */ + LanguageCodesSet.create = function create(properties) { + return new LanguageCodesSet(properties); + }; + + /** + * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodesSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCodes[i]); + return writer; + }; + + /** + * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3.Glossary.LanguageCodesSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodesSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodesSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.Glossary.LanguageCodesSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodesSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LanguageCodesSet message. + * @function verify + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LanguageCodesSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + return null; + }; + + /** + * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.Glossary.LanguageCodesSet} LanguageCodesSet + */ + LanguageCodesSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.Glossary.LanguageCodesSet) + return object; + var message = new $root.google.cloud.translation.v3.Glossary.LanguageCodesSet(); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.translation.v3.Glossary.LanguageCodesSet.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + return message; + }; + + /** + * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3.Glossary.LanguageCodesSet} message LanguageCodesSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LanguageCodesSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + return object; + }; + + /** + * Converts this LanguageCodesSet to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @instance + * @returns {Object.} JSON object + */ + LanguageCodesSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LanguageCodesSet + * @function getTypeUrl + * @memberof google.cloud.translation.v3.Glossary.LanguageCodesSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LanguageCodesSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.Glossary.LanguageCodesSet"; + }; + + return LanguageCodesSet; + })(); + + return Glossary; + })(); + + v3.CreateGlossaryRequest = (function() { + + /** + * Properties of a CreateGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @interface ICreateGlossaryRequest + * @property {string|null} [parent] CreateGlossaryRequest parent + * @property {google.cloud.translation.v3.IGlossary|null} [glossary] CreateGlossaryRequest glossary + */ + + /** + * Constructs a new CreateGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a CreateGlossaryRequest. + * @implements ICreateGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3.ICreateGlossaryRequest=} [properties] Properties to set + */ + function CreateGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateGlossaryRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @instance + */ + CreateGlossaryRequest.prototype.parent = ""; + + /** + * CreateGlossaryRequest glossary. + * @member {google.cloud.translation.v3.IGlossary|null|undefined} glossary + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @instance + */ + CreateGlossaryRequest.prototype.glossary = null; + + /** + * Creates a new CreateGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest instance + */ + CreateGlossaryRequest.create = function create(properties) { + return new CreateGlossaryRequest(properties); + }; + + /** + * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryRequest.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.glossary != null && Object.hasOwnProperty.call(message, "glossary")) + $root.google.cloud.translation.v3.Glossary.encode(message.glossary, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.CreateGlossaryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.glossary = $root.google.cloud.translation.v3.Glossary.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateGlossaryRequest.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.glossary != null && message.hasOwnProperty("glossary")) { + var error = $root.google.cloud.translation.v3.Glossary.verify(message.glossary); + if (error) + return "glossary." + error; + } + return null; + }; + + /** + * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.CreateGlossaryRequest} CreateGlossaryRequest + */ + CreateGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.CreateGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3.CreateGlossaryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.glossary != null) { + if (typeof object.glossary !== "object") + throw TypeError(".google.cloud.translation.v3.CreateGlossaryRequest.glossary: object expected"); + message.glossary = $root.google.cloud.translation.v3.Glossary.fromObject(object.glossary); + } + return message; + }; + + /** + * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3.CreateGlossaryRequest} message CreateGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateGlossaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.glossary = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.glossary != null && message.hasOwnProperty("glossary")) + object.glossary = $root.google.cloud.translation.v3.Glossary.toObject(message.glossary, options); + return object; + }; + + /** + * Converts this CreateGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + CreateGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateGlossaryRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.CreateGlossaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateGlossaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.CreateGlossaryRequest"; + }; + + return CreateGlossaryRequest; + })(); + + v3.GetGlossaryRequest = (function() { + + /** + * Properties of a GetGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @interface IGetGlossaryRequest + * @property {string|null} [name] GetGlossaryRequest name + */ + + /** + * Constructs a new GetGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a GetGlossaryRequest. + * @implements IGetGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3.IGetGlossaryRequest=} [properties] Properties to set + */ + function GetGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetGlossaryRequest name. + * @member {string} name + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @instance + */ + GetGlossaryRequest.prototype.name = ""; + + /** + * Creates a new GetGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IGetGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest instance + */ + GetGlossaryRequest.create = function create(properties) { + return new GetGlossaryRequest(properties); + }; + + /** + * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGlossaryRequest.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 GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.GetGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.GetGlossaryRequest(); + 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 GetGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGlossaryRequest.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 GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.GetGlossaryRequest} GetGlossaryRequest + */ + GetGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.GetGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3.GetGlossaryRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3.GetGlossaryRequest} message GetGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGlossaryRequest.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 GetGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + GetGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetGlossaryRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.GetGlossaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetGlossaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.GetGlossaryRequest"; + }; + + return GetGlossaryRequest; + })(); + + v3.DeleteGlossaryRequest = (function() { + + /** + * Properties of a DeleteGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @interface IDeleteGlossaryRequest + * @property {string|null} [name] DeleteGlossaryRequest name + */ + + /** + * Constructs a new DeleteGlossaryRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DeleteGlossaryRequest. + * @implements IDeleteGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest=} [properties] Properties to set + */ + function DeleteGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteGlossaryRequest name. + * @member {string} name + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @instance + */ + DeleteGlossaryRequest.prototype.name = ""; + + /** + * Creates a new DeleteGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest instance + */ + DeleteGlossaryRequest.create = function create(properties) { + return new DeleteGlossaryRequest(properties); + }; + + /** + * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryRequest.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 DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryRequest(); + 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 DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGlossaryRequest.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 DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DeleteGlossaryRequest} DeleteGlossaryRequest + */ + DeleteGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3.DeleteGlossaryRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3.DeleteGlossaryRequest} message DeleteGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGlossaryRequest.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 DeleteGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteGlossaryRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.DeleteGlossaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteGlossaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.DeleteGlossaryRequest"; + }; + + return DeleteGlossaryRequest; + })(); + + v3.ListGlossariesRequest = (function() { + + /** + * Properties of a ListGlossariesRequest. + * @memberof google.cloud.translation.v3 + * @interface IListGlossariesRequest + * @property {string|null} [parent] ListGlossariesRequest parent + * @property {number|null} [pageSize] ListGlossariesRequest pageSize + * @property {string|null} [pageToken] ListGlossariesRequest pageToken + * @property {string|null} [filter] ListGlossariesRequest filter + */ + + /** + * Constructs a new ListGlossariesRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a ListGlossariesRequest. + * @implements IListGlossariesRequest + * @constructor + * @param {google.cloud.translation.v3.IListGlossariesRequest=} [properties] Properties to set + */ + function ListGlossariesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListGlossariesRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.parent = ""; + + /** + * ListGlossariesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.pageSize = 0; + + /** + * ListGlossariesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.pageToken = ""; + + /** + * ListGlossariesRequest filter. + * @member {string} filter + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.filter = ""; + + /** + * Creates a new ListGlossariesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.IListGlossariesRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest instance + */ + ListGlossariesRequest.create = function create(properties) { + return new ListGlossariesRequest(properties); + }; + + /** + * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.ListGlossariesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGlossariesRequest message. + * @function verify + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGlossariesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.ListGlossariesRequest} ListGlossariesRequest + */ + ListGlossariesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.ListGlossariesRequest) + return object; + var message = new $root.google.cloud.translation.v3.ListGlossariesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3.ListGlossariesRequest} message ListGlossariesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGlossariesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListGlossariesRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @instance + * @returns {Object.} JSON object + */ + ListGlossariesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGlossariesRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.ListGlossariesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGlossariesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.ListGlossariesRequest"; + }; + + return ListGlossariesRequest; + })(); + + v3.ListGlossariesResponse = (function() { + + /** + * Properties of a ListGlossariesResponse. + * @memberof google.cloud.translation.v3 + * @interface IListGlossariesResponse + * @property {Array.|null} [glossaries] ListGlossariesResponse glossaries + * @property {string|null} [nextPageToken] ListGlossariesResponse nextPageToken + */ + + /** + * Constructs a new ListGlossariesResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a ListGlossariesResponse. + * @implements IListGlossariesResponse + * @constructor + * @param {google.cloud.translation.v3.IListGlossariesResponse=} [properties] Properties to set + */ + function ListGlossariesResponse(properties) { + this.glossaries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListGlossariesResponse glossaries. + * @member {Array.} glossaries + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @instance + */ + ListGlossariesResponse.prototype.glossaries = $util.emptyArray; + + /** + * ListGlossariesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @instance + */ + ListGlossariesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListGlossariesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.IListGlossariesResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse instance + */ + ListGlossariesResponse.create = function create(properties) { + return new ListGlossariesResponse(properties); + }; + + /** + * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.glossaries != null && message.glossaries.length) + for (var i = 0; i < message.glossaries.length; ++i) + $root.google.cloud.translation.v3.Glossary.encode(message.glossaries[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 ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.ListGlossariesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.ListGlossariesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.glossaries && message.glossaries.length)) + message.glossaries = []; + message.glossaries.push($root.google.cloud.translation.v3.Glossary.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGlossariesResponse message. + * @function verify + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGlossariesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!Array.isArray(message.glossaries)) + return "glossaries: array expected"; + for (var i = 0; i < message.glossaries.length; ++i) { + var error = $root.google.cloud.translation.v3.Glossary.verify(message.glossaries[i]); + if (error) + return "glossaries." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.ListGlossariesResponse} ListGlossariesResponse + */ + ListGlossariesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.ListGlossariesResponse) + return object; + var message = new $root.google.cloud.translation.v3.ListGlossariesResponse(); + if (object.glossaries) { + if (!Array.isArray(object.glossaries)) + throw TypeError(".google.cloud.translation.v3.ListGlossariesResponse.glossaries: array expected"); + message.glossaries = []; + for (var i = 0; i < object.glossaries.length; ++i) { + if (typeof object.glossaries[i] !== "object") + throw TypeError(".google.cloud.translation.v3.ListGlossariesResponse.glossaries: object expected"); + message.glossaries[i] = $root.google.cloud.translation.v3.Glossary.fromObject(object.glossaries[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3.ListGlossariesResponse} message ListGlossariesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGlossariesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.glossaries = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.glossaries && message.glossaries.length) { + object.glossaries = []; + for (var j = 0; j < message.glossaries.length; ++j) + object.glossaries[j] = $root.google.cloud.translation.v3.Glossary.toObject(message.glossaries[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListGlossariesResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @instance + * @returns {Object.} JSON object + */ + ListGlossariesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGlossariesResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3.ListGlossariesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGlossariesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.ListGlossariesResponse"; + }; + + return ListGlossariesResponse; + })(); + + v3.CreateGlossaryMetadata = (function() { + + /** + * Properties of a CreateGlossaryMetadata. + * @memberof google.cloud.translation.v3 + * @interface ICreateGlossaryMetadata + * @property {string|null} [name] CreateGlossaryMetadata name + * @property {google.cloud.translation.v3.CreateGlossaryMetadata.State|null} [state] CreateGlossaryMetadata state + * @property {google.protobuf.ITimestamp|null} [submitTime] CreateGlossaryMetadata submitTime + */ + + /** + * Constructs a new CreateGlossaryMetadata. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a CreateGlossaryMetadata. + * @implements ICreateGlossaryMetadata + * @constructor + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata=} [properties] Properties to set + */ + function CreateGlossaryMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateGlossaryMetadata name. + * @member {string} name + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @instance + */ + CreateGlossaryMetadata.prototype.name = ""; + + /** + * CreateGlossaryMetadata state. + * @member {google.cloud.translation.v3.CreateGlossaryMetadata.State} state + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @instance + */ + CreateGlossaryMetadata.prototype.state = 0; + + /** + * CreateGlossaryMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @instance + */ + CreateGlossaryMetadata.prototype.submitTime = null; + + /** + * Creates a new CreateGlossaryMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata instance + */ + CreateGlossaryMetadata.create = function create(properties) { + return new CreateGlossaryMetadata(properties); + }; + + /** + * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryMetadata.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.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.CreateGlossaryMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.CreateGlossaryMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateGlossaryMetadata message. + * @function verify + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateGlossaryMetadata.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.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.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.CreateGlossaryMetadata} CreateGlossaryMetadata + */ + CreateGlossaryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.CreateGlossaryMetadata) + return object; + var message = new $root.google.cloud.translation.v3.CreateGlossaryMetadata(); + if (object.name != null) + message.name = String(object.name); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.CreateGlossaryMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.CreateGlossaryMetadata} message CreateGlossaryMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateGlossaryMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.submitTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.CreateGlossaryMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3.CreateGlossaryMetadata.State[message.state] : message.state; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this CreateGlossaryMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateGlossaryMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateGlossaryMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3.CreateGlossaryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateGlossaryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.CreateGlossaryMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3.CreateGlossaryMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + CreateGlossaryMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return CreateGlossaryMetadata; + })(); + + v3.DeleteGlossaryMetadata = (function() { + + /** + * Properties of a DeleteGlossaryMetadata. + * @memberof google.cloud.translation.v3 + * @interface IDeleteGlossaryMetadata + * @property {string|null} [name] DeleteGlossaryMetadata name + * @property {google.cloud.translation.v3.DeleteGlossaryMetadata.State|null} [state] DeleteGlossaryMetadata state + * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryMetadata submitTime + */ + + /** + * Constructs a new DeleteGlossaryMetadata. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DeleteGlossaryMetadata. + * @implements IDeleteGlossaryMetadata + * @constructor + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata=} [properties] Properties to set + */ + function DeleteGlossaryMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteGlossaryMetadata name. + * @member {string} name + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.name = ""; + + /** + * DeleteGlossaryMetadata state. + * @member {google.cloud.translation.v3.DeleteGlossaryMetadata.State} state + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.state = 0; + + /** + * DeleteGlossaryMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.submitTime = null; + + /** + * Creates a new DeleteGlossaryMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata instance + */ + DeleteGlossaryMetadata.create = function create(properties) { + return new DeleteGlossaryMetadata(properties); + }; + + /** + * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryMetadata.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.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGlossaryMetadata message. + * @function verify + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGlossaryMetadata.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.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.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DeleteGlossaryMetadata} DeleteGlossaryMetadata + */ + DeleteGlossaryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryMetadata) + return object; + var message = new $root.google.cloud.translation.v3.DeleteGlossaryMetadata(); + if (object.name != null) + message.name = String(object.name); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.DeleteGlossaryMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3.DeleteGlossaryMetadata} message DeleteGlossaryMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGlossaryMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.submitTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.DeleteGlossaryMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3.DeleteGlossaryMetadata.State[message.state] : message.state; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this DeleteGlossaryMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteGlossaryMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteGlossaryMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3.DeleteGlossaryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteGlossaryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.DeleteGlossaryMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3.DeleteGlossaryMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + DeleteGlossaryMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return DeleteGlossaryMetadata; + })(); + + v3.DeleteGlossaryResponse = (function() { + + /** + * Properties of a DeleteGlossaryResponse. + * @memberof google.cloud.translation.v3 + * @interface IDeleteGlossaryResponse + * @property {string|null} [name] DeleteGlossaryResponse name + * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] DeleteGlossaryResponse endTime + */ + + /** + * Constructs a new DeleteGlossaryResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a DeleteGlossaryResponse. + * @implements IDeleteGlossaryResponse + * @constructor + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse=} [properties] Properties to set + */ + function DeleteGlossaryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteGlossaryResponse name. + * @member {string} name + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.name = ""; + + /** + * DeleteGlossaryResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.submitTime = null; + + /** + * DeleteGlossaryResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.endTime = null; + + /** + * Creates a new DeleteGlossaryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse instance + */ + DeleteGlossaryResponse.create = function create(properties) { + return new DeleteGlossaryResponse(properties); + }; + + /** + * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryResponse.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.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.DeleteGlossaryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.DeleteGlossaryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGlossaryResponse message. + * @function verify + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGlossaryResponse.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.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.DeleteGlossaryResponse} DeleteGlossaryResponse + */ + DeleteGlossaryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.DeleteGlossaryResponse) + return object; + var message = new $root.google.cloud.translation.v3.DeleteGlossaryResponse(); + if (object.name != null) + message.name = String(object.name); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.DeleteGlossaryResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.DeleteGlossaryResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3.DeleteGlossaryResponse} message DeleteGlossaryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGlossaryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.submitTime = null; + object.endTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this DeleteGlossaryResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @instance + * @returns {Object.} JSON object + */ + DeleteGlossaryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteGlossaryResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3.DeleteGlossaryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteGlossaryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.DeleteGlossaryResponse"; + }; + + return DeleteGlossaryResponse; + })(); + + v3.BatchTranslateDocumentRequest = (function() { + + /** + * Properties of a BatchTranslateDocumentRequest. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateDocumentRequest + * @property {string|null} [parent] BatchTranslateDocumentRequest parent + * @property {string|null} [sourceLanguageCode] BatchTranslateDocumentRequest sourceLanguageCode + * @property {Array.|null} [targetLanguageCodes] BatchTranslateDocumentRequest targetLanguageCodes + * @property {Array.|null} [inputConfigs] BatchTranslateDocumentRequest inputConfigs + * @property {google.cloud.translation.v3.IBatchDocumentOutputConfig|null} [outputConfig] BatchTranslateDocumentRequest outputConfig + * @property {Object.|null} [models] BatchTranslateDocumentRequest models + * @property {Object.|null} [glossaries] BatchTranslateDocumentRequest glossaries + * @property {Object.|null} [formatConversions] BatchTranslateDocumentRequest formatConversions + */ + + /** + * Constructs a new BatchTranslateDocumentRequest. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateDocumentRequest. + * @implements IBatchTranslateDocumentRequest + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest=} [properties] Properties to set + */ + function BatchTranslateDocumentRequest(properties) { + this.targetLanguageCodes = []; + this.inputConfigs = []; + this.models = {}; + this.glossaries = {}; + this.formatConversions = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.parent = ""; + + /** + * BatchTranslateDocumentRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.sourceLanguageCode = ""; + + /** + * BatchTranslateDocumentRequest targetLanguageCodes. + * @member {Array.} targetLanguageCodes + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.targetLanguageCodes = $util.emptyArray; + + /** + * BatchTranslateDocumentRequest inputConfigs. + * @member {Array.} inputConfigs + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.inputConfigs = $util.emptyArray; + + /** + * BatchTranslateDocumentRequest outputConfig. + * @member {google.cloud.translation.v3.IBatchDocumentOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.outputConfig = null; + + /** + * BatchTranslateDocumentRequest models. + * @member {Object.} models + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.models = $util.emptyObject; + + /** + * BatchTranslateDocumentRequest glossaries. + * @member {Object.} glossaries + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.glossaries = $util.emptyObject; + + /** + * BatchTranslateDocumentRequest formatConversions. + * @member {Object.} formatConversions + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.formatConversions = $util.emptyObject; + + /** + * Creates a new BatchTranslateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest instance + */ + BatchTranslateDocumentRequest.create = function create(properties) { + return new BatchTranslateDocumentRequest(properties); + }; + + /** + * Encodes the specified BatchTranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} message BatchTranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentRequest.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.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCodes != null && message.targetLanguageCodes.length) + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCodes[i]); + if (message.inputConfigs != null && message.inputConfigs.length) + for (var i = 0; i < message.inputConfigs.length; ++i) + $root.google.cloud.translation.v3.BatchDocumentInputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.translation.v3.BatchDocumentOutputConfig.encode(message.outputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.models != null && Object.hasOwnProperty.call(message, "models")) + for (var keys = Object.keys(message.models), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.models[keys[i]]).ldelim(); + if (message.glossaries != null && Object.hasOwnProperty.call(message, "glossaries")) + for (var keys = Object.keys(message.glossaries), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.formatConversions != null && Object.hasOwnProperty.call(message, "formatConversions")) + for (var keys = Object.keys(message.formatConversions), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.formatConversions[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentRequest} message BatchTranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateDocumentRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sourceLanguageCode = reader.string(); + break; + } + case 3: { + if (!(message.targetLanguageCodes && message.targetLanguageCodes.length)) + message.targetLanguageCodes = []; + message.targetLanguageCodes.push(reader.string()); + break; + } + case 4: { + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.translation.v3.BatchDocumentInputConfig.decode(reader, reader.uint32())); + break; + } + case 5: { + message.outputConfig = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + if (message.models === $util.emptyObject) + message.models = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.models[key] = value; + break; + } + case 7: { + if (message.glossaries === $util.emptyObject) + message.glossaries = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.glossaries[key] = value; + break; + } + case 8: { + if (message.formatConversions === $util.emptyObject) + message.formatConversions = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.formatConversions[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateDocumentRequest message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateDocumentRequest.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.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCodes != null && message.hasOwnProperty("targetLanguageCodes")) { + if (!Array.isArray(message.targetLanguageCodes)) + return "targetLanguageCodes: array expected"; + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + if (!$util.isString(message.targetLanguageCodes[i])) + return "targetLanguageCodes: 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.translation.v3.BatchDocumentInputConfig.verify(message.inputConfigs[i]); + if (error) + return "inputConfigs." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.models != null && message.hasOwnProperty("models")) { + if (!$util.isObject(message.models)) + return "models: object expected"; + var key = Object.keys(message.models); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.models[key[i]])) + return "models: string{k:string} expected"; + } + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!$util.isObject(message.glossaries)) + return "glossaries: object expected"; + var key = Object.keys(message.glossaries); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.verify(message.glossaries[key[i]]); + if (error) + return "glossaries." + error; + } + } + if (message.formatConversions != null && message.hasOwnProperty("formatConversions")) { + if (!$util.isObject(message.formatConversions)) + return "formatConversions: object expected"; + var key = Object.keys(message.formatConversions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.formatConversions[key[i]])) + return "formatConversions: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a BatchTranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest + */ + BatchTranslateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateDocumentRequest) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCodes) { + if (!Array.isArray(object.targetLanguageCodes)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.targetLanguageCodes: array expected"); + message.targetLanguageCodes = []; + for (var i = 0; i < object.targetLanguageCodes.length; ++i) + message.targetLanguageCodes[i] = String(object.targetLanguageCodes[i]); + } + if (object.inputConfigs) { + if (!Array.isArray(object.inputConfigs)) + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.inputConfigs: array expected"); + message.inputConfigs = []; + for (var i = 0; i < object.inputConfigs.length; ++i) { + if (typeof object.inputConfigs[i] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.inputConfigs: object expected"); + message.inputConfigs[i] = $root.google.cloud.translation.v3.BatchDocumentInputConfig.fromObject(object.inputConfigs[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.fromObject(object.outputConfig); + } + if (object.models) { + if (typeof object.models !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.models: object expected"); + message.models = {}; + for (var keys = Object.keys(object.models), i = 0; i < keys.length; ++i) + message.models[keys[i]] = String(object.models[keys[i]]); + } + if (object.glossaries) { + if (typeof object.glossaries !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.glossaries: object expected"); + message.glossaries = {}; + for (var keys = Object.keys(object.glossaries), i = 0; i < keys.length; ++i) { + if (typeof object.glossaries[keys[i]] !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.glossaries: object expected"); + message.glossaries[keys[i]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); + } + } + if (object.formatConversions) { + if (typeof object.formatConversions !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentRequest.formatConversions: object expected"); + message.formatConversions = {}; + for (var keys = Object.keys(object.formatConversions), i = 0; i < keys.length; ++i) + message.formatConversions[keys[i]] = String(object.formatConversions[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3.BatchTranslateDocumentRequest} message BatchTranslateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.targetLanguageCodes = []; + object.inputConfigs = []; + } + if (options.objects || options.defaults) { + object.models = {}; + object.glossaries = {}; + object.formatConversions = {}; + } + if (options.defaults) { + object.parent = ""; + object.sourceLanguageCode = ""; + object.outputConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCodes && message.targetLanguageCodes.length) { + object.targetLanguageCodes = []; + for (var j = 0; j < message.targetLanguageCodes.length; ++j) + object.targetLanguageCodes[j] = message.targetLanguageCodes[j]; + } + if (message.inputConfigs && message.inputConfigs.length) { + object.inputConfigs = []; + for (var j = 0; j < message.inputConfigs.length; ++j) + object.inputConfigs[j] = $root.google.cloud.translation.v3.BatchDocumentInputConfig.toObject(message.inputConfigs[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.translation.v3.BatchDocumentOutputConfig.toObject(message.outputConfig, options); + var keys2; + if (message.models && (keys2 = Object.keys(message.models)).length) { + object.models = {}; + for (var j = 0; j < keys2.length; ++j) + object.models[keys2[j]] = message.models[keys2[j]]; + } + if (message.glossaries && (keys2 = Object.keys(message.glossaries)).length) { + object.glossaries = {}; + for (var j = 0; j < keys2.length; ++j) + object.glossaries[keys2[j]] = $root.google.cloud.translation.v3.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); + } + if (message.formatConversions && (keys2 = Object.keys(message.formatConversions)).length) { + object.formatConversions = {}; + for (var j = 0; j < keys2.length; ++j) + object.formatConversions[keys2[j]] = message.formatConversions[keys2[j]]; + } + return object; + }; + + /** + * Converts this BatchTranslateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchTranslateDocumentRequest"; + }; + + return BatchTranslateDocumentRequest; + })(); + + v3.BatchDocumentInputConfig = (function() { + + /** + * Properties of a BatchDocumentInputConfig. + * @memberof google.cloud.translation.v3 + * @interface IBatchDocumentInputConfig + * @property {google.cloud.translation.v3.IGcsSource|null} [gcsSource] BatchDocumentInputConfig gcsSource + */ + + /** + * Constructs a new BatchDocumentInputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchDocumentInputConfig. + * @implements IBatchDocumentInputConfig + * @constructor + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig=} [properties] Properties to set + */ + function BatchDocumentInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDocumentInputConfig gcsSource. + * @member {google.cloud.translation.v3.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @instance + */ + BatchDocumentInputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchDocumentInputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @instance + */ + Object.defineProperty(BatchDocumentInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchDocumentInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig instance + */ + BatchDocumentInputConfig.create = function create(properties) { + return new BatchDocumentInputConfig(properties); + }; + + /** + * Encodes the specified BatchDocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig} message BatchDocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3.IBatchDocumentInputConfig} message BatchDocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchDocumentInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDocumentInputConfig message. + * @function verify + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDocumentInputConfig.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.translation.v3.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates a BatchDocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchDocumentInputConfig} BatchDocumentInputConfig + */ + BatchDocumentInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchDocumentInputConfig) + return object; + var message = new $root.google.cloud.translation.v3.BatchDocumentInputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3.BatchDocumentInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3.GcsSource.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from a BatchDocumentInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3.BatchDocumentInputConfig} message BatchDocumentInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDocumentInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this BatchDocumentInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchDocumentInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDocumentInputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchDocumentInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDocumentInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchDocumentInputConfig"; + }; + + return BatchDocumentInputConfig; + })(); + + v3.BatchDocumentOutputConfig = (function() { + + /** + * Properties of a BatchDocumentOutputConfig. + * @memberof google.cloud.translation.v3 + * @interface IBatchDocumentOutputConfig + * @property {google.cloud.translation.v3.IGcsDestination|null} [gcsDestination] BatchDocumentOutputConfig gcsDestination + */ + + /** + * Constructs a new BatchDocumentOutputConfig. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchDocumentOutputConfig. + * @implements IBatchDocumentOutputConfig + * @constructor + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig=} [properties] Properties to set + */ + function BatchDocumentOutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDocumentOutputConfig gcsDestination. + * @member {google.cloud.translation.v3.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @instance + */ + BatchDocumentOutputConfig.prototype.gcsDestination = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchDocumentOutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @instance + */ + Object.defineProperty(BatchDocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchDocumentOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig instance + */ + BatchDocumentOutputConfig.create = function create(properties) { + return new BatchDocumentOutputConfig(properties); + }; + + /** + * Encodes the specified BatchDocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig} message BatchDocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentOutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.translation.v3.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchDocumentOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.IBatchDocumentOutputConfig} message BatchDocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentOutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchDocumentOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentOutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDocumentOutputConfig message. + * @function verify + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDocumentOutputConfig.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.translation.v3.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + return null; + }; + + /** + * Creates a BatchDocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchDocumentOutputConfig} BatchDocumentOutputConfig + */ + BatchDocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchDocumentOutputConfig) + return object; + var message = new $root.google.cloud.translation.v3.BatchDocumentOutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3.BatchDocumentOutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.fromObject(object.gcsDestination); + } + return message; + }; + + /** + * Creates a plain object from a BatchDocumentOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3.BatchDocumentOutputConfig} message BatchDocumentOutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDocumentOutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + return object; + }; + + /** + * Converts this BatchDocumentOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchDocumentOutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDocumentOutputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchDocumentOutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDocumentOutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchDocumentOutputConfig"; + }; + + return BatchDocumentOutputConfig; + })(); + + v3.BatchTranslateDocumentResponse = (function() { + + /** + * Properties of a BatchTranslateDocumentResponse. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateDocumentResponse + * @property {number|Long|null} [totalPages] BatchTranslateDocumentResponse totalPages + * @property {number|Long|null} [translatedPages] BatchTranslateDocumentResponse translatedPages + * @property {number|Long|null} [failedPages] BatchTranslateDocumentResponse failedPages + * @property {number|Long|null} [totalBillablePages] BatchTranslateDocumentResponse totalBillablePages + * @property {number|Long|null} [totalCharacters] BatchTranslateDocumentResponse totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateDocumentResponse translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateDocumentResponse failedCharacters + * @property {number|Long|null} [totalBillableCharacters] BatchTranslateDocumentResponse totalBillableCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateDocumentResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] BatchTranslateDocumentResponse endTime + */ + + /** + * Constructs a new BatchTranslateDocumentResponse. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateDocumentResponse. + * @implements IBatchTranslateDocumentResponse + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse=} [properties] Properties to set + */ + function BatchTranslateDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateDocumentResponse totalPages. + * @member {number|Long} totalPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse translatedPages. + * @member {number|Long} translatedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.translatedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse failedPages. + * @member {number|Long} failedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.failedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalBillablePages. + * @member {number|Long} totalBillablePages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalBillablePages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalBillableCharacters. + * @member {number|Long} totalBillableCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalBillableCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.submitTime = null; + + /** + * BatchTranslateDocumentResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.endTime = null; + + /** + * Creates a new BatchTranslateDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse instance + */ + BatchTranslateDocumentResponse.create = function create(properties) { + return new BatchTranslateDocumentResponse(properties); + }; + + /** + * Encodes the specified BatchTranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse} message BatchTranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.totalPages != null && Object.hasOwnProperty.call(message, "totalPages")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.totalPages); + if (message.translatedPages != null && Object.hasOwnProperty.call(message, "translatedPages")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedPages); + if (message.failedPages != null && Object.hasOwnProperty.call(message, "failedPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedPages); + if (message.totalBillablePages != null && Object.hasOwnProperty.call(message, "totalBillablePages")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalBillablePages); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.failedCharacters); + if (message.totalBillableCharacters != null && Object.hasOwnProperty.call(message, "totalBillableCharacters")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.totalBillableCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentResponse} message BatchTranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.totalPages = reader.int64(); + break; + } + case 2: { + message.translatedPages = reader.int64(); + break; + } + case 3: { + message.failedPages = reader.int64(); + break; + } + case 4: { + message.totalBillablePages = reader.int64(); + break; + } + case 5: { + message.totalCharacters = reader.int64(); + break; + } + case 6: { + message.translatedCharacters = reader.int64(); + break; + } + case 7: { + message.failedCharacters = reader.int64(); + break; + } + case 8: { + message.totalBillableCharacters = reader.int64(); + break; + } + case 9: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 10: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateDocumentResponse message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages) && !(message.totalPages && $util.isInteger(message.totalPages.low) && $util.isInteger(message.totalPages.high))) + return "totalPages: integer|Long expected"; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (!$util.isInteger(message.translatedPages) && !(message.translatedPages && $util.isInteger(message.translatedPages.low) && $util.isInteger(message.translatedPages.high))) + return "translatedPages: integer|Long expected"; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (!$util.isInteger(message.failedPages) && !(message.failedPages && $util.isInteger(message.failedPages.low) && $util.isInteger(message.failedPages.high))) + return "failedPages: integer|Long expected"; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (!$util.isInteger(message.totalBillablePages) && !(message.totalBillablePages && $util.isInteger(message.totalBillablePages.low) && $util.isInteger(message.totalBillablePages.high))) + return "totalBillablePages: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (!$util.isInteger(message.totalBillableCharacters) && !(message.totalBillableCharacters && $util.isInteger(message.totalBillableCharacters.low) && $util.isInteger(message.totalBillableCharacters.high))) + return "totalBillableCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse + */ + BatchTranslateDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateDocumentResponse) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateDocumentResponse(); + if (object.totalPages != null) + if ($util.Long) + (message.totalPages = $util.Long.fromValue(object.totalPages)).unsigned = false; + else if (typeof object.totalPages === "string") + message.totalPages = parseInt(object.totalPages, 10); + else if (typeof object.totalPages === "number") + message.totalPages = object.totalPages; + else if (typeof object.totalPages === "object") + message.totalPages = new $util.LongBits(object.totalPages.low >>> 0, object.totalPages.high >>> 0).toNumber(); + if (object.translatedPages != null) + if ($util.Long) + (message.translatedPages = $util.Long.fromValue(object.translatedPages)).unsigned = false; + else if (typeof object.translatedPages === "string") + message.translatedPages = parseInt(object.translatedPages, 10); + else if (typeof object.translatedPages === "number") + message.translatedPages = object.translatedPages; + else if (typeof object.translatedPages === "object") + message.translatedPages = new $util.LongBits(object.translatedPages.low >>> 0, object.translatedPages.high >>> 0).toNumber(); + if (object.failedPages != null) + if ($util.Long) + (message.failedPages = $util.Long.fromValue(object.failedPages)).unsigned = false; + else if (typeof object.failedPages === "string") + message.failedPages = parseInt(object.failedPages, 10); + else if (typeof object.failedPages === "number") + message.failedPages = object.failedPages; + else if (typeof object.failedPages === "object") + message.failedPages = new $util.LongBits(object.failedPages.low >>> 0, object.failedPages.high >>> 0).toNumber(); + if (object.totalBillablePages != null) + if ($util.Long) + (message.totalBillablePages = $util.Long.fromValue(object.totalBillablePages)).unsigned = false; + else if (typeof object.totalBillablePages === "string") + message.totalBillablePages = parseInt(object.totalBillablePages, 10); + else if (typeof object.totalBillablePages === "number") + message.totalBillablePages = object.totalBillablePages; + else if (typeof object.totalBillablePages === "object") + message.totalBillablePages = new $util.LongBits(object.totalBillablePages.low >>> 0, object.totalBillablePages.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalBillableCharacters != null) + if ($util.Long) + (message.totalBillableCharacters = $util.Long.fromValue(object.totalBillableCharacters)).unsigned = false; + else if (typeof object.totalBillableCharacters === "string") + message.totalBillableCharacters = parseInt(object.totalBillableCharacters, 10); + else if (typeof object.totalBillableCharacters === "number") + message.totalBillableCharacters = object.totalBillableCharacters; + else if (typeof object.totalBillableCharacters === "object") + message.totalBillableCharacters = new $util.LongBits(object.totalBillableCharacters.low >>> 0, object.totalBillableCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3.BatchTranslateDocumentResponse} message BatchTranslateDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateDocumentResponse.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.totalPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillablePages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillablePages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillableCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillableCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + object.endTime = null; + } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (typeof message.totalPages === "number") + object.totalPages = options.longs === String ? String(message.totalPages) : message.totalPages; + else + object.totalPages = options.longs === String ? $util.Long.prototype.toString.call(message.totalPages) : options.longs === Number ? new $util.LongBits(message.totalPages.low >>> 0, message.totalPages.high >>> 0).toNumber() : message.totalPages; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (typeof message.translatedPages === "number") + object.translatedPages = options.longs === String ? String(message.translatedPages) : message.translatedPages; + else + object.translatedPages = options.longs === String ? $util.Long.prototype.toString.call(message.translatedPages) : options.longs === Number ? new $util.LongBits(message.translatedPages.low >>> 0, message.translatedPages.high >>> 0).toNumber() : message.translatedPages; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (typeof message.failedPages === "number") + object.failedPages = options.longs === String ? String(message.failedPages) : message.failedPages; + else + object.failedPages = options.longs === String ? $util.Long.prototype.toString.call(message.failedPages) : options.longs === Number ? new $util.LongBits(message.failedPages.low >>> 0, message.failedPages.high >>> 0).toNumber() : message.failedPages; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (typeof message.totalBillablePages === "number") + object.totalBillablePages = options.longs === String ? String(message.totalBillablePages) : message.totalBillablePages; + else + object.totalBillablePages = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillablePages) : options.longs === Number ? new $util.LongBits(message.totalBillablePages.low >>> 0, message.totalBillablePages.high >>> 0).toNumber() : message.totalBillablePages; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (typeof message.totalBillableCharacters === "number") + object.totalBillableCharacters = options.longs === String ? String(message.totalBillableCharacters) : message.totalBillableCharacters; + else + object.totalBillableCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillableCharacters) : options.longs === Number ? new $util.LongBits(message.totalBillableCharacters.low >>> 0, message.totalBillableCharacters.high >>> 0).toNumber() : message.totalBillableCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this BatchTranslateDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchTranslateDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchTranslateDocumentResponse"; + }; + + return BatchTranslateDocumentResponse; + })(); + + v3.BatchTranslateDocumentMetadata = (function() { + + /** + * Properties of a BatchTranslateDocumentMetadata. + * @memberof google.cloud.translation.v3 + * @interface IBatchTranslateDocumentMetadata + * @property {google.cloud.translation.v3.BatchTranslateDocumentMetadata.State|null} [state] BatchTranslateDocumentMetadata state + * @property {number|Long|null} [totalPages] BatchTranslateDocumentMetadata totalPages + * @property {number|Long|null} [translatedPages] BatchTranslateDocumentMetadata translatedPages + * @property {number|Long|null} [failedPages] BatchTranslateDocumentMetadata failedPages + * @property {number|Long|null} [totalBillablePages] BatchTranslateDocumentMetadata totalBillablePages + * @property {number|Long|null} [totalCharacters] BatchTranslateDocumentMetadata totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateDocumentMetadata translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateDocumentMetadata failedCharacters + * @property {number|Long|null} [totalBillableCharacters] BatchTranslateDocumentMetadata totalBillableCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateDocumentMetadata submitTime + */ + + /** + * Constructs a new BatchTranslateDocumentMetadata. + * @memberof google.cloud.translation.v3 + * @classdesc Represents a BatchTranslateDocumentMetadata. + * @implements IBatchTranslateDocumentMetadata + * @constructor + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata=} [properties] Properties to set + */ + function BatchTranslateDocumentMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateDocumentMetadata state. + * @member {google.cloud.translation.v3.BatchTranslateDocumentMetadata.State} state + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.state = 0; + + /** + * BatchTranslateDocumentMetadata totalPages. + * @member {number|Long} totalPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata translatedPages. + * @member {number|Long} translatedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.translatedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata failedPages. + * @member {number|Long} failedPages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.failedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalBillablePages. + * @member {number|Long} totalBillablePages + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalBillablePages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalBillableCharacters. + * @member {number|Long} totalBillableCharacters + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalBillableCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.submitTime = null; + + /** + * Creates a new BatchTranslateDocumentMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata instance + */ + BatchTranslateDocumentMetadata.create = function create(properties) { + return new BatchTranslateDocumentMetadata(properties); + }; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentMetadata.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.totalPages != null && Object.hasOwnProperty.call(message, "totalPages")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.totalPages); + if (message.translatedPages != null && Object.hasOwnProperty.call(message, "translatedPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.translatedPages); + if (message.failedPages != null && Object.hasOwnProperty.call(message, "failedPages")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failedPages); + if (message.totalBillablePages != null && Object.hasOwnProperty.call(message, "totalBillablePages")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.totalBillablePages); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.failedCharacters); + if (message.totalBillableCharacters != null && Object.hasOwnProperty.call(message, "totalBillableCharacters")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.totalBillableCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3.BatchTranslateDocumentMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3.IBatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.totalPages = reader.int64(); + break; + } + case 3: { + message.translatedPages = reader.int64(); + break; + } + case 4: { + message.failedPages = reader.int64(); + break; + } + case 5: { + message.totalBillablePages = reader.int64(); + break; + } + case 6: { + message.totalCharacters = reader.int64(); + break; + } + case 7: { + message.translatedCharacters = reader.int64(); + break; + } + case 8: { + message.failedCharacters = reader.int64(); + break; + } + case 9: { + message.totalBillableCharacters = reader.int64(); + break; + } + case 10: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateDocumentMetadata message. + * @function verify + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateDocumentMetadata.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.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages) && !(message.totalPages && $util.isInteger(message.totalPages.low) && $util.isInteger(message.totalPages.high))) + return "totalPages: integer|Long expected"; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (!$util.isInteger(message.translatedPages) && !(message.translatedPages && $util.isInteger(message.translatedPages.low) && $util.isInteger(message.translatedPages.high))) + return "translatedPages: integer|Long expected"; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (!$util.isInteger(message.failedPages) && !(message.failedPages && $util.isInteger(message.failedPages.low) && $util.isInteger(message.failedPages.high))) + return "failedPages: integer|Long expected"; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (!$util.isInteger(message.totalBillablePages) && !(message.totalBillablePages && $util.isInteger(message.totalBillablePages.low) && $util.isInteger(message.totalBillablePages.high))) + return "totalBillablePages: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (!$util.isInteger(message.totalBillableCharacters) && !(message.totalBillableCharacters && $util.isInteger(message.totalBillableCharacters.low) && $util.isInteger(message.totalBillableCharacters.high))) + return "totalBillableCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateDocumentMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata + */ + BatchTranslateDocumentMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata) + return object; + var message = new $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata(); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.totalPages != null) + if ($util.Long) + (message.totalPages = $util.Long.fromValue(object.totalPages)).unsigned = false; + else if (typeof object.totalPages === "string") + message.totalPages = parseInt(object.totalPages, 10); + else if (typeof object.totalPages === "number") + message.totalPages = object.totalPages; + else if (typeof object.totalPages === "object") + message.totalPages = new $util.LongBits(object.totalPages.low >>> 0, object.totalPages.high >>> 0).toNumber(); + if (object.translatedPages != null) + if ($util.Long) + (message.translatedPages = $util.Long.fromValue(object.translatedPages)).unsigned = false; + else if (typeof object.translatedPages === "string") + message.translatedPages = parseInt(object.translatedPages, 10); + else if (typeof object.translatedPages === "number") + message.translatedPages = object.translatedPages; + else if (typeof object.translatedPages === "object") + message.translatedPages = new $util.LongBits(object.translatedPages.low >>> 0, object.translatedPages.high >>> 0).toNumber(); + if (object.failedPages != null) + if ($util.Long) + (message.failedPages = $util.Long.fromValue(object.failedPages)).unsigned = false; + else if (typeof object.failedPages === "string") + message.failedPages = parseInt(object.failedPages, 10); + else if (typeof object.failedPages === "number") + message.failedPages = object.failedPages; + else if (typeof object.failedPages === "object") + message.failedPages = new $util.LongBits(object.failedPages.low >>> 0, object.failedPages.high >>> 0).toNumber(); + if (object.totalBillablePages != null) + if ($util.Long) + (message.totalBillablePages = $util.Long.fromValue(object.totalBillablePages)).unsigned = false; + else if (typeof object.totalBillablePages === "string") + message.totalBillablePages = parseInt(object.totalBillablePages, 10); + else if (typeof object.totalBillablePages === "number") + message.totalBillablePages = object.totalBillablePages; + else if (typeof object.totalBillablePages === "object") + message.totalBillablePages = new $util.LongBits(object.totalBillablePages.low >>> 0, object.totalBillablePages.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalBillableCharacters != null) + if ($util.Long) + (message.totalBillableCharacters = $util.Long.fromValue(object.totalBillableCharacters)).unsigned = false; + else if (typeof object.totalBillableCharacters === "string") + message.totalBillableCharacters = parseInt(object.totalBillableCharacters, 10); + else if (typeof object.totalBillableCharacters === "number") + message.totalBillableCharacters = object.totalBillableCharacters; + else if (typeof object.totalBillableCharacters === "object") + message.totalBillableCharacters = new $util.LongBits(object.totalBillableCharacters.low >>> 0, object.totalBillableCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3.BatchTranslateDocumentMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateDocumentMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3.BatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateDocumentMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillablePages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillablePages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillableCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillableCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3.BatchTranslateDocumentMetadata.State[message.state] : message.state; + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (typeof message.totalPages === "number") + object.totalPages = options.longs === String ? String(message.totalPages) : message.totalPages; + else + object.totalPages = options.longs === String ? $util.Long.prototype.toString.call(message.totalPages) : options.longs === Number ? new $util.LongBits(message.totalPages.low >>> 0, message.totalPages.high >>> 0).toNumber() : message.totalPages; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (typeof message.translatedPages === "number") + object.translatedPages = options.longs === String ? String(message.translatedPages) : message.translatedPages; + else + object.translatedPages = options.longs === String ? $util.Long.prototype.toString.call(message.translatedPages) : options.longs === Number ? new $util.LongBits(message.translatedPages.low >>> 0, message.translatedPages.high >>> 0).toNumber() : message.translatedPages; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (typeof message.failedPages === "number") + object.failedPages = options.longs === String ? String(message.failedPages) : message.failedPages; + else + object.failedPages = options.longs === String ? $util.Long.prototype.toString.call(message.failedPages) : options.longs === Number ? new $util.LongBits(message.failedPages.low >>> 0, message.failedPages.high >>> 0).toNumber() : message.failedPages; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (typeof message.totalBillablePages === "number") + object.totalBillablePages = options.longs === String ? String(message.totalBillablePages) : message.totalBillablePages; + else + object.totalBillablePages = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillablePages) : options.longs === Number ? new $util.LongBits(message.totalBillablePages.low >>> 0, message.totalBillablePages.high >>> 0).toNumber() : message.totalBillablePages; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (typeof message.totalBillableCharacters === "number") + object.totalBillableCharacters = options.longs === String ? String(message.totalBillableCharacters) : message.totalBillableCharacters; + else + object.totalBillableCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillableCharacters) : options.longs === Number ? new $util.LongBits(message.totalBillableCharacters.low >>> 0, message.totalBillableCharacters.high >>> 0).toNumber() : message.totalBillableCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this BatchTranslateDocumentMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateDocumentMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateDocumentMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3.BatchTranslateDocumentMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateDocumentMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3.BatchTranslateDocumentMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3.BatchTranslateDocumentMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + BatchTranslateDocumentMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return BatchTranslateDocumentMetadata; + })(); + + return v3; + })(); + + translation.v3beta1 = (function() { + + /** + * Namespace v3beta1. + * @memberof google.cloud.translation + * @namespace + */ + var v3beta1 = {}; + + v3beta1.TranslationService = (function() { + + /** + * Constructs a new TranslationService service. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a TranslationService + * @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 TranslationService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (TranslationService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = TranslationService; + + /** + * Creates new TranslationService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.translation.v3beta1.TranslationService + * @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 {TranslationService} RPC service. Useful where requests and/or responses are streamed. + */ + TranslationService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|translateText}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef TranslateTextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3beta1.TranslateTextResponse} [response] TranslateTextResponse + */ + + /** + * Calls TranslateText. + * @function translateText + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.ITranslateTextRequest} request TranslateTextRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.TranslateTextCallback} callback Node-style callback called with the error, if any, and TranslateTextResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.translateText = function translateText(request, callback) { + return this.rpcCall(translateText, $root.google.cloud.translation.v3beta1.TranslateTextRequest, $root.google.cloud.translation.v3beta1.TranslateTextResponse, request, callback); + }, "name", { value: "TranslateText" }); + + /** + * Calls TranslateText. + * @function translateText + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.ITranslateTextRequest} request TranslateTextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|detectLanguage}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef DetectLanguageCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3beta1.DetectLanguageResponse} [response] DetectLanguageResponse + */ + + /** + * Calls DetectLanguage. + * @function detectLanguage + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IDetectLanguageRequest} request DetectLanguageRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.DetectLanguageCallback} callback Node-style callback called with the error, if any, and DetectLanguageResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.detectLanguage = function detectLanguage(request, callback) { + return this.rpcCall(detectLanguage, $root.google.cloud.translation.v3beta1.DetectLanguageRequest, $root.google.cloud.translation.v3beta1.DetectLanguageResponse, request, callback); + }, "name", { value: "DetectLanguage" }); + + /** + * Calls DetectLanguage. + * @function detectLanguage + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IDetectLanguageRequest} request DetectLanguageRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|getSupportedLanguages}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef GetSupportedLanguagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3beta1.SupportedLanguages} [response] SupportedLanguages + */ + + /** + * Calls GetSupportedLanguages. + * @function getSupportedLanguages + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest} request GetSupportedLanguagesRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguagesCallback} callback Node-style callback called with the error, if any, and SupportedLanguages + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.getSupportedLanguages = function getSupportedLanguages(request, callback) { + return this.rpcCall(getSupportedLanguages, $root.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest, $root.google.cloud.translation.v3beta1.SupportedLanguages, request, callback); + }, "name", { value: "GetSupportedLanguages" }); + + /** + * Calls GetSupportedLanguages. + * @function getSupportedLanguages + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest} request GetSupportedLanguagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|translateDocument}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef TranslateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3beta1.TranslateDocumentResponse} [response] TranslateDocumentResponse + */ + + /** + * Calls TranslateDocument. + * @function translateDocument + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.ITranslateDocumentRequest} request TranslateDocumentRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.TranslateDocumentCallback} callback Node-style callback called with the error, if any, and TranslateDocumentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.translateDocument = function translateDocument(request, callback) { + return this.rpcCall(translateDocument, $root.google.cloud.translation.v3beta1.TranslateDocumentRequest, $root.google.cloud.translation.v3beta1.TranslateDocumentResponse, request, callback); + }, "name", { value: "TranslateDocument" }); + + /** + * Calls TranslateDocument. + * @function translateDocument + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.ITranslateDocumentRequest} request TranslateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|batchTranslateText}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef BatchTranslateTextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchTranslateText. + * @function batchTranslateText + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IBatchTranslateTextRequest} request BatchTranslateTextRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.BatchTranslateTextCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.batchTranslateText = function batchTranslateText(request, callback) { + return this.rpcCall(batchTranslateText, $root.google.cloud.translation.v3beta1.BatchTranslateTextRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchTranslateText" }); + + /** + * Calls BatchTranslateText. + * @function batchTranslateText + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IBatchTranslateTextRequest} request BatchTranslateTextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|batchTranslateDocument}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef BatchTranslateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchTranslateDocument. + * @function batchTranslateDocument + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest} request BatchTranslateDocumentRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.BatchTranslateDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.batchTranslateDocument = function batchTranslateDocument(request, callback) { + return this.rpcCall(batchTranslateDocument, $root.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchTranslateDocument" }); + + /** + * Calls BatchTranslateDocument. + * @function batchTranslateDocument + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest} request BatchTranslateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|createGlossary}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef CreateGlossaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateGlossary. + * @function createGlossary + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.ICreateGlossaryRequest} request CreateGlossaryRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.CreateGlossaryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.createGlossary = function createGlossary(request, callback) { + return this.rpcCall(createGlossary, $root.google.cloud.translation.v3beta1.CreateGlossaryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateGlossary" }); + + /** + * Calls CreateGlossary. + * @function createGlossary + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.ICreateGlossaryRequest} request CreateGlossaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|listGlossaries}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef ListGlossariesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3beta1.ListGlossariesResponse} [response] ListGlossariesResponse + */ + + /** + * Calls ListGlossaries. + * @function listGlossaries + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IListGlossariesRequest} request ListGlossariesRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.ListGlossariesCallback} callback Node-style callback called with the error, if any, and ListGlossariesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.listGlossaries = function listGlossaries(request, callback) { + return this.rpcCall(listGlossaries, $root.google.cloud.translation.v3beta1.ListGlossariesRequest, $root.google.cloud.translation.v3beta1.ListGlossariesResponse, request, callback); + }, "name", { value: "ListGlossaries" }); + + /** + * Calls ListGlossaries. + * @function listGlossaries + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IListGlossariesRequest} request ListGlossariesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|getGlossary}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef GetGlossaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.translation.v3beta1.Glossary} [response] Glossary + */ + + /** + * Calls GetGlossary. + * @function getGlossary + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IGetGlossaryRequest} request GetGlossaryRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.GetGlossaryCallback} callback Node-style callback called with the error, if any, and Glossary + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.getGlossary = function getGlossary(request, callback) { + return this.rpcCall(getGlossary, $root.google.cloud.translation.v3beta1.GetGlossaryRequest, $root.google.cloud.translation.v3beta1.Glossary, request, callback); + }, "name", { value: "GetGlossary" }); + + /** + * Calls GetGlossary. + * @function getGlossary + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IGetGlossaryRequest} request GetGlossaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.translation.v3beta1.TranslationService|deleteGlossary}. + * @memberof google.cloud.translation.v3beta1.TranslationService + * @typedef DeleteGlossaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteGlossary. + * @function deleteGlossary + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryRequest} request DeleteGlossaryRequest message or plain object + * @param {google.cloud.translation.v3beta1.TranslationService.DeleteGlossaryCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TranslationService.prototype.deleteGlossary = function deleteGlossary(request, callback) { + return this.rpcCall(deleteGlossary, $root.google.cloud.translation.v3beta1.DeleteGlossaryRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteGlossary" }); + + /** + * Calls DeleteGlossary. + * @function deleteGlossary + * @memberof google.cloud.translation.v3beta1.TranslationService + * @instance + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryRequest} request DeleteGlossaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return TranslationService; + })(); + + v3beta1.TranslateTextGlossaryConfig = (function() { + + /** + * Properties of a TranslateTextGlossaryConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface ITranslateTextGlossaryConfig + * @property {string|null} [glossary] TranslateTextGlossaryConfig glossary + * @property {boolean|null} [ignoreCase] TranslateTextGlossaryConfig ignoreCase + */ + + /** + * Constructs a new TranslateTextGlossaryConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a TranslateTextGlossaryConfig. + * @implements ITranslateTextGlossaryConfig + * @constructor + * @param {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig=} [properties] Properties to set + */ + function TranslateTextGlossaryConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranslateTextGlossaryConfig glossary. + * @member {string} glossary + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @instance + */ + TranslateTextGlossaryConfig.prototype.glossary = ""; + + /** + * TranslateTextGlossaryConfig ignoreCase. + * @member {boolean} ignoreCase + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @instance + */ + TranslateTextGlossaryConfig.prototype.ignoreCase = false; + + /** + * Creates a new TranslateTextGlossaryConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig instance + */ + TranslateTextGlossaryConfig.create = function create(properties) { + return new TranslateTextGlossaryConfig(properties); + }; + + /** + * Encodes the specified TranslateTextGlossaryConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig} message TranslateTextGlossaryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextGlossaryConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.glossary != null && Object.hasOwnProperty.call(message, "glossary")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.glossary); + if (message.ignoreCase != null && Object.hasOwnProperty.call(message, "ignoreCase")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.ignoreCase); + return writer; + }; + + /** + * Encodes the specified TranslateTextGlossaryConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig} message TranslateTextGlossaryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextGlossaryConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextGlossaryConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.glossary = reader.string(); + break; + } + case 2: { + message.ignoreCase = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateTextGlossaryConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextGlossaryConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateTextGlossaryConfig message. + * @function verify + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateTextGlossaryConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.glossary != null && message.hasOwnProperty("glossary")) + if (!$util.isString(message.glossary)) + return "glossary: string expected"; + if (message.ignoreCase != null && message.hasOwnProperty("ignoreCase")) + if (typeof message.ignoreCase !== "boolean") + return "ignoreCase: boolean expected"; + return null; + }; + + /** + * Creates a TranslateTextGlossaryConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} TranslateTextGlossaryConfig + */ + TranslateTextGlossaryConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig(); + if (object.glossary != null) + message.glossary = String(object.glossary); + if (object.ignoreCase != null) + message.ignoreCase = Boolean(object.ignoreCase); + return message; + }; + + /** + * Creates a plain object from a TranslateTextGlossaryConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} message TranslateTextGlossaryConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateTextGlossaryConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.glossary = ""; + object.ignoreCase = false; + } + if (message.glossary != null && message.hasOwnProperty("glossary")) + object.glossary = message.glossary; + if (message.ignoreCase != null && message.hasOwnProperty("ignoreCase")) + object.ignoreCase = message.ignoreCase; + return object; + }; + + /** + * Converts this TranslateTextGlossaryConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @instance + * @returns {Object.} JSON object + */ + TranslateTextGlossaryConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateTextGlossaryConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.TranslateTextGlossaryConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateTextGlossaryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.TranslateTextGlossaryConfig"; + }; + + return TranslateTextGlossaryConfig; + })(); + + v3beta1.TranslateTextRequest = (function() { + + /** + * Properties of a TranslateTextRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface ITranslateTextRequest + * @property {Array.|null} [contents] TranslateTextRequest contents + * @property {string|null} [mimeType] TranslateTextRequest mimeType + * @property {string|null} [sourceLanguageCode] TranslateTextRequest sourceLanguageCode + * @property {string|null} [targetLanguageCode] TranslateTextRequest targetLanguageCode + * @property {string|null} [parent] TranslateTextRequest parent + * @property {string|null} [model] TranslateTextRequest model + * @property {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateTextRequest glossaryConfig + * @property {Object.|null} [labels] TranslateTextRequest labels + */ + + /** + * Constructs a new TranslateTextRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a TranslateTextRequest. + * @implements ITranslateTextRequest + * @constructor + * @param {google.cloud.translation.v3beta1.ITranslateTextRequest=} [properties] Properties to set + */ + function TranslateTextRequest(properties) { + this.contents = []; + 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]]; + } + + /** + * TranslateTextRequest contents. + * @member {Array.} contents + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.contents = $util.emptyArray; + + /** + * TranslateTextRequest mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.mimeType = ""; + + /** + * TranslateTextRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.sourceLanguageCode = ""; + + /** + * TranslateTextRequest targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.targetLanguageCode = ""; + + /** + * TranslateTextRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.parent = ""; + + /** + * TranslateTextRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.model = ""; + + /** + * TranslateTextRequest glossaryConfig. + * @member {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.glossaryConfig = null; + + /** + * TranslateTextRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + */ + TranslateTextRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new TranslateTextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.TranslateTextRequest} TranslateTextRequest instance + */ + TranslateTextRequest.create = function create(properties) { + return new TranslateTextRequest(properties); + }; + + /** + * Encodes the specified TranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextRequest} message TranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contents != null && message.contents.length) + for (var i = 0; i < message.contents.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.contents[i]); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.targetLanguageCode); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.parent); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextRequest} message TranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.TranslateTextRequest} TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.TranslateTextRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.contents && message.contents.length)) + message.contents = []; + message.contents.push(reader.string()); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 4: { + message.sourceLanguageCode = reader.string(); + break; + } + case 5: { + message.targetLanguageCode = reader.string(); + break; + } + case 8: { + message.parent = reader.string(); + break; + } + case 6: { + message.model = reader.string(); + break; + } + case 7: { + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateTextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.TranslateTextRequest} TranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateTextRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateTextRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contents != null && message.hasOwnProperty("contents")) { + if (!Array.isArray(message.contents)) + return "contents: array expected"; + for (var i = 0; i < message.contents.length; ++i) + if (!$util.isString(message.contents[i])) + return "contents: string[] expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a TranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.TranslateTextRequest} TranslateTextRequest + */ + TranslateTextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.TranslateTextRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.TranslateTextRequest(); + if (object.contents) { + if (!Array.isArray(object.contents)) + throw TypeError(".google.cloud.translation.v3beta1.TranslateTextRequest.contents: array expected"); + message.contents = []; + for (var i = 0; i < object.contents.length; ++i) + message.contents[i] = String(object.contents[i]); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + if (object.parent != null) + message.parent = String(object.parent); + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateTextRequest.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateTextRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a TranslateTextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.TranslateTextRequest} message TranslateTextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateTextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contents = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.mimeType = ""; + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + object.model = ""; + object.glossaryConfig = null; + object.parent = ""; + } + if (message.contents && message.contents.length) { + object.contents = []; + for (var j = 0; j < message.contents.length; ++j) + object.contents[j] = message.contents[j]; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this TranslateTextRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @instance + * @returns {Object.} JSON object + */ + TranslateTextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateTextRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.TranslateTextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.TranslateTextRequest"; + }; + + return TranslateTextRequest; + })(); + + v3beta1.TranslateTextResponse = (function() { + + /** + * Properties of a TranslateTextResponse. + * @memberof google.cloud.translation.v3beta1 + * @interface ITranslateTextResponse + * @property {Array.|null} [translations] TranslateTextResponse translations + * @property {Array.|null} [glossaryTranslations] TranslateTextResponse glossaryTranslations + */ + + /** + * Constructs a new TranslateTextResponse. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a TranslateTextResponse. + * @implements ITranslateTextResponse + * @constructor + * @param {google.cloud.translation.v3beta1.ITranslateTextResponse=} [properties] Properties to set + */ + function TranslateTextResponse(properties) { + this.translations = []; + this.glossaryTranslations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranslateTextResponse translations. + * @member {Array.} translations + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @instance + */ + TranslateTextResponse.prototype.translations = $util.emptyArray; + + /** + * TranslateTextResponse glossaryTranslations. + * @member {Array.} glossaryTranslations + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @instance + */ + TranslateTextResponse.prototype.glossaryTranslations = $util.emptyArray; + + /** + * Creates a new TranslateTextResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.TranslateTextResponse} TranslateTextResponse instance + */ + TranslateTextResponse.create = function create(properties) { + return new TranslateTextResponse(properties); + }; + + /** + * Encodes the specified TranslateTextResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextResponse} message TranslateTextResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.translations != null && message.translations.length) + for (var i = 0; i < message.translations.length; ++i) + $root.google.cloud.translation.v3beta1.Translation.encode(message.translations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.glossaryTranslations != null && message.glossaryTranslations.length) + for (var i = 0; i < message.glossaryTranslations.length; ++i) + $root.google.cloud.translation.v3beta1.Translation.encode(message.glossaryTranslations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateTextResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateTextResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3beta1.ITranslateTextResponse} message TranslateTextResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateTextResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.TranslateTextResponse} TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.TranslateTextResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.translations && message.translations.length)) + message.translations = []; + message.translations.push($root.google.cloud.translation.v3beta1.Translation.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.glossaryTranslations && message.glossaryTranslations.length)) + message.glossaryTranslations = []; + message.glossaryTranslations.push($root.google.cloud.translation.v3beta1.Translation.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateTextResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.TranslateTextResponse} TranslateTextResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateTextResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateTextResponse message. + * @function verify + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateTextResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.translations != null && message.hasOwnProperty("translations")) { + if (!Array.isArray(message.translations)) + return "translations: array expected"; + for (var i = 0; i < message.translations.length; ++i) { + var error = $root.google.cloud.translation.v3beta1.Translation.verify(message.translations[i]); + if (error) + return "translations." + error; + } + } + if (message.glossaryTranslations != null && message.hasOwnProperty("glossaryTranslations")) { + if (!Array.isArray(message.glossaryTranslations)) + return "glossaryTranslations: array expected"; + for (var i = 0; i < message.glossaryTranslations.length; ++i) { + var error = $root.google.cloud.translation.v3beta1.Translation.verify(message.glossaryTranslations[i]); + if (error) + return "glossaryTranslations." + error; + } + } + return null; + }; + + /** + * Creates a TranslateTextResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.TranslateTextResponse} TranslateTextResponse + */ + TranslateTextResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.TranslateTextResponse) + return object; + var message = new $root.google.cloud.translation.v3beta1.TranslateTextResponse(); + if (object.translations) { + if (!Array.isArray(object.translations)) + throw TypeError(".google.cloud.translation.v3beta1.TranslateTextResponse.translations: array expected"); + message.translations = []; + for (var i = 0; i < object.translations.length; ++i) { + if (typeof object.translations[i] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateTextResponse.translations: object expected"); + message.translations[i] = $root.google.cloud.translation.v3beta1.Translation.fromObject(object.translations[i]); + } + } + if (object.glossaryTranslations) { + if (!Array.isArray(object.glossaryTranslations)) + throw TypeError(".google.cloud.translation.v3beta1.TranslateTextResponse.glossaryTranslations: array expected"); + message.glossaryTranslations = []; + for (var i = 0; i < object.glossaryTranslations.length; ++i) { + if (typeof object.glossaryTranslations[i] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateTextResponse.glossaryTranslations: object expected"); + message.glossaryTranslations[i] = $root.google.cloud.translation.v3beta1.Translation.fromObject(object.glossaryTranslations[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TranslateTextResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {google.cloud.translation.v3beta1.TranslateTextResponse} message TranslateTextResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateTextResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.translations = []; + object.glossaryTranslations = []; + } + if (message.translations && message.translations.length) { + object.translations = []; + for (var j = 0; j < message.translations.length; ++j) + object.translations[j] = $root.google.cloud.translation.v3beta1.Translation.toObject(message.translations[j], options); + } + if (message.glossaryTranslations && message.glossaryTranslations.length) { + object.glossaryTranslations = []; + for (var j = 0; j < message.glossaryTranslations.length; ++j) + object.glossaryTranslations[j] = $root.google.cloud.translation.v3beta1.Translation.toObject(message.glossaryTranslations[j], options); + } + return object; + }; + + /** + * Converts this TranslateTextResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @instance + * @returns {Object.} JSON object + */ + TranslateTextResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateTextResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.TranslateTextResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateTextResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.TranslateTextResponse"; + }; + + return TranslateTextResponse; + })(); + + v3beta1.Translation = (function() { + + /** + * Properties of a Translation. + * @memberof google.cloud.translation.v3beta1 + * @interface ITranslation + * @property {string|null} [translatedText] Translation translatedText + * @property {string|null} [model] Translation model + * @property {string|null} [detectedLanguageCode] Translation detectedLanguageCode + * @property {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null} [glossaryConfig] Translation glossaryConfig + */ + + /** + * Constructs a new Translation. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a Translation. + * @implements ITranslation + * @constructor + * @param {google.cloud.translation.v3beta1.ITranslation=} [properties] Properties to set + */ + function Translation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Translation translatedText. + * @member {string} translatedText + * @memberof google.cloud.translation.v3beta1.Translation + * @instance + */ + Translation.prototype.translatedText = ""; + + /** + * Translation model. + * @member {string} model + * @memberof google.cloud.translation.v3beta1.Translation + * @instance + */ + Translation.prototype.model = ""; + + /** + * Translation detectedLanguageCode. + * @member {string} detectedLanguageCode + * @memberof google.cloud.translation.v3beta1.Translation + * @instance + */ + Translation.prototype.detectedLanguageCode = ""; + + /** + * Translation glossaryConfig. + * @member {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3beta1.Translation + * @instance + */ + Translation.prototype.glossaryConfig = null; + + /** + * Creates a new Translation instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {google.cloud.translation.v3beta1.ITranslation=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.Translation} Translation instance + */ + Translation.create = function create(properties) { + return new Translation(properties); + }; + + /** + * Encodes the specified Translation message. Does not implicitly {@link google.cloud.translation.v3beta1.Translation.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {google.cloud.translation.v3beta1.ITranslation} message Translation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Translation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.translatedText != null && Object.hasOwnProperty.call(message, "translatedText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.translatedText); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.detectedLanguageCode != null && Object.hasOwnProperty.call(message, "detectedLanguageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.detectedLanguageCode); + return writer; + }; + + /** + * Encodes the specified Translation message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Translation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {google.cloud.translation.v3beta1.ITranslation} message Translation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Translation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Translation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.Translation} Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Translation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.Translation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.translatedText = reader.string(); + break; + } + case 2: { + message.model = reader.string(); + break; + } + case 4: { + message.detectedLanguageCode = reader.string(); + break; + } + case 3: { + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Translation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.Translation} Translation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Translation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Translation message. + * @function verify + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Translation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.translatedText != null && message.hasOwnProperty("translatedText")) + if (!$util.isString(message.translatedText)) + return "translatedText: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + if (!$util.isString(message.detectedLanguageCode)) + return "detectedLanguageCode: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + return null; + }; + + /** + * Creates a Translation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.Translation} Translation + */ + Translation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.Translation) + return object; + var message = new $root.google.cloud.translation.v3beta1.Translation(); + if (object.translatedText != null) + message.translatedText = String(object.translatedText); + if (object.model != null) + message.model = String(object.model); + if (object.detectedLanguageCode != null) + message.detectedLanguageCode = String(object.detectedLanguageCode); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.Translation.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + return message; + }; + + /** + * Creates a plain object from a Translation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {google.cloud.translation.v3beta1.Translation} message Translation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Translation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.translatedText = ""; + object.model = ""; + object.glossaryConfig = null; + object.detectedLanguageCode = ""; + } + if (message.translatedText != null && message.hasOwnProperty("translatedText")) + object.translatedText = message.translatedText; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + object.detectedLanguageCode = message.detectedLanguageCode; + return object; + }; + + /** + * Converts this Translation to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.Translation + * @instance + * @returns {Object.} JSON object + */ + Translation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Translation + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.Translation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Translation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.Translation"; + }; + + return Translation; + })(); + + v3beta1.DetectLanguageRequest = (function() { + + /** + * Properties of a DetectLanguageRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface IDetectLanguageRequest + * @property {string|null} [parent] DetectLanguageRequest parent + * @property {string|null} [model] DetectLanguageRequest model + * @property {string|null} [content] DetectLanguageRequest content + * @property {string|null} [mimeType] DetectLanguageRequest mimeType + * @property {Object.|null} [labels] DetectLanguageRequest labels + */ + + /** + * Constructs a new DetectLanguageRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DetectLanguageRequest. + * @implements IDetectLanguageRequest + * @constructor + * @param {google.cloud.translation.v3beta1.IDetectLanguageRequest=} [properties] Properties to set + */ + function DetectLanguageRequest(properties) { + 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]]; + } + + /** + * DetectLanguageRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.parent = ""; + + /** + * DetectLanguageRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.model = ""; + + /** + * DetectLanguageRequest content. + * @member {string|null|undefined} content + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.content = null; + + /** + * DetectLanguageRequest mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.mimeType = ""; + + /** + * DetectLanguageRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @instance + */ + DetectLanguageRequest.prototype.labels = $util.emptyObject; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DetectLanguageRequest source. + * @member {"content"|undefined} source + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @instance + */ + Object.defineProperty(DetectLanguageRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["content"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DetectLanguageRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3beta1.IDetectLanguageRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DetectLanguageRequest} DetectLanguageRequest instance + */ + DetectLanguageRequest.create = function create(properties) { + return new DetectLanguageRequest(properties); + }; + + /** + * Encodes the specified DetectLanguageRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3beta1.IDetectLanguageRequest} message DetectLanguageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageRequest.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).string(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.model); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.parent); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectLanguageRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3beta1.IDetectLanguageRequest} message DetectLanguageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.DetectLanguageRequest} DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.DetectLanguageRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.parent = reader.string(); + break; + } + case 4: { + message.model = reader.string(); + break; + } + case 1: { + message.content = reader.string(); + break; + } + case 3: { + message.mimeType = reader.string(); + break; + } + case 6: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectLanguageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.DetectLanguageRequest} DetectLanguageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectLanguageRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectLanguageRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.content != null && message.hasOwnProperty("content")) { + properties.source = 1; + if (!$util.isString(message.content)) + return "content: string expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a DetectLanguageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DetectLanguageRequest} DetectLanguageRequest + */ + DetectLanguageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DetectLanguageRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.DetectLanguageRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.model != null) + message.model = String(object.model); + if (object.content != null) + message.content = String(object.content); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3beta1.DetectLanguageRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a DetectLanguageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {google.cloud.translation.v3beta1.DetectLanguageRequest} message DetectLanguageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectLanguageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.mimeType = ""; + object.model = ""; + object.parent = ""; + } + if (message.content != null && message.hasOwnProperty("content")) { + object.content = message.content; + if (options.oneofs) + object.source = "content"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this DetectLanguageRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @instance + * @returns {Object.} JSON object + */ + DetectLanguageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectLanguageRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.DetectLanguageRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectLanguageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.DetectLanguageRequest"; + }; + + return DetectLanguageRequest; + })(); + + v3beta1.DetectedLanguage = (function() { + + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.translation.v3beta1 + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ + + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; + + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.translation.v3beta1.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DetectedLanguage + * @static + * @param {google.cloud.translation.v3beta1.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.translation.v3beta1.DetectedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DetectedLanguage + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.DetectedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DetectedLanguage + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.DetectedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DetectedLanguage} DetectedLanguage + */ + DetectedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DetectedLanguage) + return object; + var message = new $root.google.cloud.translation.v3beta1.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.translation.v3beta1.DetectedLanguage + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.DetectedLanguage"; + }; + + return DetectedLanguage; + })(); + + v3beta1.DetectLanguageResponse = (function() { + + /** + * Properties of a DetectLanguageResponse. + * @memberof google.cloud.translation.v3beta1 + * @interface IDetectLanguageResponse + * @property {Array.|null} [languages] DetectLanguageResponse languages + */ + + /** + * Constructs a new DetectLanguageResponse. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DetectLanguageResponse. + * @implements IDetectLanguageResponse + * @constructor + * @param {google.cloud.translation.v3beta1.IDetectLanguageResponse=} [properties] Properties to set + */ + function DetectLanguageResponse(properties) { + this.languages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectLanguageResponse languages. + * @member {Array.} languages + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @instance + */ + DetectLanguageResponse.prototype.languages = $util.emptyArray; + + /** + * Creates a new DetectLanguageResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3beta1.IDetectLanguageResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DetectLanguageResponse} DetectLanguageResponse instance + */ + DetectLanguageResponse.create = function create(properties) { + return new DetectLanguageResponse(properties); + }; + + /** + * Encodes the specified DetectLanguageResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3beta1.IDetectLanguageResponse} message DetectLanguageResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languages != null && message.languages.length) + for (var i = 0; i < message.languages.length; ++i) + $root.google.cloud.translation.v3beta1.DetectedLanguage.encode(message.languages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectLanguageResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DetectLanguageResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3beta1.IDetectLanguageResponse} message DetectLanguageResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectLanguageResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.DetectLanguageResponse} DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.DetectLanguageResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.languages && message.languages.length)) + message.languages = []; + message.languages.push($root.google.cloud.translation.v3beta1.DetectedLanguage.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectLanguageResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.DetectLanguageResponse} DetectLanguageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectLanguageResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectLanguageResponse message. + * @function verify + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectLanguageResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languages != null && message.hasOwnProperty("languages")) { + if (!Array.isArray(message.languages)) + return "languages: array expected"; + for (var i = 0; i < message.languages.length; ++i) { + var error = $root.google.cloud.translation.v3beta1.DetectedLanguage.verify(message.languages[i]); + if (error) + return "languages." + error; + } + } + return null; + }; + + /** + * Creates a DetectLanguageResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DetectLanguageResponse} DetectLanguageResponse + */ + DetectLanguageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DetectLanguageResponse) + return object; + var message = new $root.google.cloud.translation.v3beta1.DetectLanguageResponse(); + if (object.languages) { + if (!Array.isArray(object.languages)) + throw TypeError(".google.cloud.translation.v3beta1.DetectLanguageResponse.languages: array expected"); + message.languages = []; + for (var i = 0; i < object.languages.length; ++i) { + if (typeof object.languages[i] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.DetectLanguageResponse.languages: object expected"); + message.languages[i] = $root.google.cloud.translation.v3beta1.DetectedLanguage.fromObject(object.languages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DetectLanguageResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {google.cloud.translation.v3beta1.DetectLanguageResponse} message DetectLanguageResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectLanguageResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languages = []; + if (message.languages && message.languages.length) { + object.languages = []; + for (var j = 0; j < message.languages.length; ++j) + object.languages[j] = $root.google.cloud.translation.v3beta1.DetectedLanguage.toObject(message.languages[j], options); + } + return object; + }; + + /** + * Converts this DetectLanguageResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @instance + * @returns {Object.} JSON object + */ + DetectLanguageResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectLanguageResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.DetectLanguageResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectLanguageResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.DetectLanguageResponse"; + }; + + return DetectLanguageResponse; + })(); + + v3beta1.GetSupportedLanguagesRequest = (function() { + + /** + * Properties of a GetSupportedLanguagesRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface IGetSupportedLanguagesRequest + * @property {string|null} [parent] GetSupportedLanguagesRequest parent + * @property {string|null} [displayLanguageCode] GetSupportedLanguagesRequest displayLanguageCode + * @property {string|null} [model] GetSupportedLanguagesRequest model + */ + + /** + * Constructs a new GetSupportedLanguagesRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a GetSupportedLanguagesRequest. + * @implements IGetSupportedLanguagesRequest + * @constructor + * @param {google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest=} [properties] Properties to set + */ + function GetSupportedLanguagesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSupportedLanguagesRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @instance + */ + GetSupportedLanguagesRequest.prototype.parent = ""; + + /** + * GetSupportedLanguagesRequest displayLanguageCode. + * @member {string} displayLanguageCode + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @instance + */ + GetSupportedLanguagesRequest.prototype.displayLanguageCode = ""; + + /** + * GetSupportedLanguagesRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @instance + */ + GetSupportedLanguagesRequest.prototype.model = ""; + + /** + * Creates a new GetSupportedLanguagesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest instance + */ + GetSupportedLanguagesRequest.create = function create(properties) { + return new GetSupportedLanguagesRequest(properties); + }; + + /** + * Encodes the specified GetSupportedLanguagesRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.GetSupportedLanguagesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest} message GetSupportedLanguagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSupportedLanguagesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayLanguageCode != null && Object.hasOwnProperty.call(message, "displayLanguageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayLanguageCode); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.model); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.parent); + return writer; + }; + + /** + * Encodes the specified GetSupportedLanguagesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GetSupportedLanguagesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest} message GetSupportedLanguagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSupportedLanguagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSupportedLanguagesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.parent = reader.string(); + break; + } + case 1: { + message.displayLanguageCode = reader.string(); + break; + } + case 2: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSupportedLanguagesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSupportedLanguagesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSupportedLanguagesRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSupportedLanguagesRequest.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.displayLanguageCode != null && message.hasOwnProperty("displayLanguageCode")) + if (!$util.isString(message.displayLanguageCode)) + return "displayLanguageCode: string expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a GetSupportedLanguagesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.GetSupportedLanguagesRequest} GetSupportedLanguagesRequest + */ + GetSupportedLanguagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.displayLanguageCode != null) + message.displayLanguageCode = String(object.displayLanguageCode); + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a GetSupportedLanguagesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {google.cloud.translation.v3beta1.GetSupportedLanguagesRequest} message GetSupportedLanguagesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSupportedLanguagesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayLanguageCode = ""; + object.model = ""; + object.parent = ""; + } + if (message.displayLanguageCode != null && message.hasOwnProperty("displayLanguageCode")) + object.displayLanguageCode = message.displayLanguageCode; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GetSupportedLanguagesRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @instance + * @returns {Object.} JSON object + */ + GetSupportedLanguagesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSupportedLanguagesRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.GetSupportedLanguagesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSupportedLanguagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.GetSupportedLanguagesRequest"; + }; + + return GetSupportedLanguagesRequest; + })(); + + v3beta1.SupportedLanguages = (function() { + + /** + * Properties of a SupportedLanguages. + * @memberof google.cloud.translation.v3beta1 + * @interface ISupportedLanguages + * @property {Array.|null} [languages] SupportedLanguages languages + */ + + /** + * Constructs a new SupportedLanguages. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a SupportedLanguages. + * @implements ISupportedLanguages + * @constructor + * @param {google.cloud.translation.v3beta1.ISupportedLanguages=} [properties] Properties to set + */ + function SupportedLanguages(properties) { + this.languages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SupportedLanguages languages. + * @member {Array.} languages + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @instance + */ + SupportedLanguages.prototype.languages = $util.emptyArray; + + /** + * Creates a new SupportedLanguages instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {google.cloud.translation.v3beta1.ISupportedLanguages=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.SupportedLanguages} SupportedLanguages instance + */ + SupportedLanguages.create = function create(properties) { + return new SupportedLanguages(properties); + }; + + /** + * Encodes the specified SupportedLanguages message. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguages.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {google.cloud.translation.v3beta1.ISupportedLanguages} message SupportedLanguages message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguages.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languages != null && message.languages.length) + for (var i = 0; i < message.languages.length; ++i) + $root.google.cloud.translation.v3beta1.SupportedLanguage.encode(message.languages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SupportedLanguages message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguages.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {google.cloud.translation.v3beta1.ISupportedLanguages} message SupportedLanguages message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguages.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.SupportedLanguages} SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguages.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.SupportedLanguages(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.languages && message.languages.length)) + message.languages = []; + message.languages.push($root.google.cloud.translation.v3beta1.SupportedLanguage.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SupportedLanguages message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.SupportedLanguages} SupportedLanguages + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguages.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SupportedLanguages message. + * @function verify + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SupportedLanguages.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languages != null && message.hasOwnProperty("languages")) { + if (!Array.isArray(message.languages)) + return "languages: array expected"; + for (var i = 0; i < message.languages.length; ++i) { + var error = $root.google.cloud.translation.v3beta1.SupportedLanguage.verify(message.languages[i]); + if (error) + return "languages." + error; + } + } + return null; + }; + + /** + * Creates a SupportedLanguages message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.SupportedLanguages} SupportedLanguages + */ + SupportedLanguages.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.SupportedLanguages) + return object; + var message = new $root.google.cloud.translation.v3beta1.SupportedLanguages(); + if (object.languages) { + if (!Array.isArray(object.languages)) + throw TypeError(".google.cloud.translation.v3beta1.SupportedLanguages.languages: array expected"); + message.languages = []; + for (var i = 0; i < object.languages.length; ++i) { + if (typeof object.languages[i] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.SupportedLanguages.languages: object expected"); + message.languages[i] = $root.google.cloud.translation.v3beta1.SupportedLanguage.fromObject(object.languages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SupportedLanguages message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {google.cloud.translation.v3beta1.SupportedLanguages} message SupportedLanguages + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SupportedLanguages.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languages = []; + if (message.languages && message.languages.length) { + object.languages = []; + for (var j = 0; j < message.languages.length; ++j) + object.languages[j] = $root.google.cloud.translation.v3beta1.SupportedLanguage.toObject(message.languages[j], options); + } + return object; + }; + + /** + * Converts this SupportedLanguages to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @instance + * @returns {Object.} JSON object + */ + SupportedLanguages.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SupportedLanguages + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.SupportedLanguages + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SupportedLanguages.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.SupportedLanguages"; + }; + + return SupportedLanguages; + })(); + + v3beta1.SupportedLanguage = (function() { + + /** + * Properties of a SupportedLanguage. + * @memberof google.cloud.translation.v3beta1 + * @interface ISupportedLanguage + * @property {string|null} [languageCode] SupportedLanguage languageCode + * @property {string|null} [displayName] SupportedLanguage displayName + * @property {boolean|null} [supportSource] SupportedLanguage supportSource + * @property {boolean|null} [supportTarget] SupportedLanguage supportTarget + */ + + /** + * Constructs a new SupportedLanguage. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a SupportedLanguage. + * @implements ISupportedLanguage + * @constructor + * @param {google.cloud.translation.v3beta1.ISupportedLanguage=} [properties] Properties to set + */ + function SupportedLanguage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SupportedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.languageCode = ""; + + /** + * SupportedLanguage displayName. + * @member {string} displayName + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.displayName = ""; + + /** + * SupportedLanguage supportSource. + * @member {boolean} supportSource + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.supportSource = false; + + /** + * SupportedLanguage supportTarget. + * @member {boolean} supportTarget + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @instance + */ + SupportedLanguage.prototype.supportTarget = false; + + /** + * Creates a new SupportedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {google.cloud.translation.v3beta1.ISupportedLanguage=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.SupportedLanguage} SupportedLanguage instance + */ + SupportedLanguage.create = function create(properties) { + return new SupportedLanguage(properties); + }; + + /** + * Encodes the specified SupportedLanguage message. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {google.cloud.translation.v3beta1.ISupportedLanguage} message SupportedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguage.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.supportSource != null && Object.hasOwnProperty.call(message, "supportSource")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.supportSource); + if (message.supportTarget != null && Object.hasOwnProperty.call(message, "supportTarget")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.supportTarget); + return writer; + }; + + /** + * Encodes the specified SupportedLanguage message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.SupportedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {google.cloud.translation.v3beta1.ISupportedLanguage} message SupportedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SupportedLanguage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.SupportedLanguage} SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.SupportedLanguage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.supportSource = reader.bool(); + break; + } + case 4: { + message.supportTarget = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SupportedLanguage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.SupportedLanguage} SupportedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SupportedLanguage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SupportedLanguage message. + * @function verify + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SupportedLanguage.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.supportSource != null && message.hasOwnProperty("supportSource")) + if (typeof message.supportSource !== "boolean") + return "supportSource: boolean expected"; + if (message.supportTarget != null && message.hasOwnProperty("supportTarget")) + if (typeof message.supportTarget !== "boolean") + return "supportTarget: boolean expected"; + return null; + }; + + /** + * Creates a SupportedLanguage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.SupportedLanguage} SupportedLanguage + */ + SupportedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.SupportedLanguage) + return object; + var message = new $root.google.cloud.translation.v3beta1.SupportedLanguage(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.supportSource != null) + message.supportSource = Boolean(object.supportSource); + if (object.supportTarget != null) + message.supportTarget = Boolean(object.supportTarget); + return message; + }; + + /** + * Creates a plain object from a SupportedLanguage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {google.cloud.translation.v3beta1.SupportedLanguage} message SupportedLanguage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SupportedLanguage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.languageCode = ""; + object.displayName = ""; + object.supportSource = false; + object.supportTarget = false; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.supportSource != null && message.hasOwnProperty("supportSource")) + object.supportSource = message.supportSource; + if (message.supportTarget != null && message.hasOwnProperty("supportTarget")) + object.supportTarget = message.supportTarget; + return object; + }; + + /** + * Converts this SupportedLanguage to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @instance + * @returns {Object.} JSON object + */ + SupportedLanguage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SupportedLanguage + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.SupportedLanguage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SupportedLanguage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.SupportedLanguage"; + }; + + return SupportedLanguage; + })(); + + v3beta1.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.translation.v3beta1 + * @interface IGcsSource + * @property {string|null} [inputUri] GcsSource inputUri + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.translation.v3beta1.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 inputUri. + * @member {string} inputUri + * @memberof google.cloud.translation.v3beta1.GcsSource + * @instance + */ + GcsSource.prototype.inputUri = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.GcsSource + * @static + * @param {google.cloud.translation.v3beta1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.translation.v3beta1.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.GcsSource + * @static + * @param {google.cloud.translation.v3beta1.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.inputUri != null && Object.hasOwnProperty.call(message, "inputUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inputUri); + return writer; + }; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.GcsSource + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.GcsSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.inputUri = 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.translation.v3beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.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.inputUri != null && message.hasOwnProperty("inputUri")) + if (!$util.isString(message.inputUri)) + return "inputUri: 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.translation.v3beta1.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.GcsSource) + return object; + var message = new $root.google.cloud.translation.v3beta1.GcsSource(); + if (object.inputUri != null) + message.inputUri = String(object.inputUri); + return message; + }; + + /** + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.GcsSource + * @static + * @param {google.cloud.translation.v3beta1.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.inputUri = ""; + if (message.inputUri != null && message.hasOwnProperty("inputUri")) + object.inputUri = message.inputUri; + return object; + }; + + /** + * Converts this GcsSource to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.GcsSource"; + }; + + return GcsSource; + })(); + + v3beta1.InputConfig = (function() { + + /** + * Properties of an InputConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface IInputConfig + * @property {string|null} [mimeType] InputConfig mimeType + * @property {google.cloud.translation.v3beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource + */ + + /** + * Constructs a new InputConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents an InputConfig. + * @implements IInputConfig + * @constructor + * @param {google.cloud.translation.v3beta1.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 mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3beta1.InputConfig + * @instance + */ + InputConfig.prototype.mimeType = ""; + + /** + * InputConfig gcsSource. + * @member {google.cloud.translation.v3beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3beta1.InputConfig + * @instance + */ + InputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3beta1.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.translation.v3beta1.InputConfig + * @static + * @param {google.cloud.translation.v3beta1.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.InputConfig} InputConfig instance + */ + InputConfig.create = function create(properties) { + return new InputConfig(properties); + }; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.InputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.InputConfig + * @static + * @param {google.cloud.translation.v3beta1.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.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mimeType); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.InputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.InputConfig + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.InputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mimeType = reader.string(); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.decode(reader, reader.uint32()); + 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.translation.v3beta1.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.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.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.translation.v3beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.InputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.InputConfig} InputConfig + */ + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.InputConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.InputConfig(); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3beta1.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.InputConfig + * @static + * @param {google.cloud.translation.v3beta1.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.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this InputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.InputConfig"; + }; + + return InputConfig; + })(); + + v3beta1.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.translation.v3beta1 + * @interface IGcsDestination + * @property {string|null} [outputUriPrefix] GcsDestination outputUriPrefix + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.translation.v3beta1.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 outputUriPrefix. + * @member {string} outputUriPrefix + * @memberof google.cloud.translation.v3beta1.GcsDestination + * @instance + */ + GcsDestination.prototype.outputUriPrefix = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.GcsDestination + * @static + * @param {google.cloud.translation.v3beta1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.translation.v3beta1.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.GcsDestination + * @static + * @param {google.cloud.translation.v3beta1.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.outputUriPrefix != null && Object.hasOwnProperty.call(message, "outputUriPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.outputUriPrefix); + return writer; + }; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.GcsDestination + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.outputUriPrefix = 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.translation.v3beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.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.outputUriPrefix != null && message.hasOwnProperty("outputUriPrefix")) + if (!$util.isString(message.outputUriPrefix)) + return "outputUriPrefix: 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.translation.v3beta1.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.GcsDestination) + return object; + var message = new $root.google.cloud.translation.v3beta1.GcsDestination(); + if (object.outputUriPrefix != null) + message.outputUriPrefix = String(object.outputUriPrefix); + return message; + }; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.GcsDestination + * @static + * @param {google.cloud.translation.v3beta1.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.outputUriPrefix = ""; + if (message.outputUriPrefix != null && message.hasOwnProperty("outputUriPrefix")) + object.outputUriPrefix = message.outputUriPrefix; + return object; + }; + + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.GcsDestination"; + }; + + return GcsDestination; + })(); + + v3beta1.OutputConfig = (function() { + + /** + * Properties of an OutputConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface IOutputConfig + * @property {google.cloud.translation.v3beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + */ + + /** + * Constructs a new OutputConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig + * @constructor + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3beta1.OutputConfig + * @instance + */ + OutputConfig.prototype.gcsDestination = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * OutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3beta1.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.translation.v3beta1.OutputConfig + * @static + * @param {google.cloud.translation.v3beta1.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.OutputConfig} OutputConfig instance + */ + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); + }; + + /** + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.OutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.OutputConfig + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.OutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.OutputConfig + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.OutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.decode(reader, reader.uint32()); + 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.translation.v3beta1.OutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + return null; + }; + + /** + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.OutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.OutputConfig} OutputConfig + */ + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.OutputConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3beta1.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.fromObject(object.gcsDestination); + } + return message; + }; + + /** + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.OutputConfig + * @static + * @param {google.cloud.translation.v3beta1.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 (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + return object; + }; + + /** + * Converts this OutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.OutputConfig"; + }; + + return OutputConfig; + })(); + + v3beta1.DocumentInputConfig = (function() { + + /** + * Properties of a DocumentInputConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface IDocumentInputConfig + * @property {Uint8Array|null} [content] DocumentInputConfig content + * @property {google.cloud.translation.v3beta1.IGcsSource|null} [gcsSource] DocumentInputConfig gcsSource + * @property {string|null} [mimeType] DocumentInputConfig mimeType + */ + + /** + * Constructs a new DocumentInputConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DocumentInputConfig. + * @implements IDocumentInputConfig + * @constructor + * @param {google.cloud.translation.v3beta1.IDocumentInputConfig=} [properties] Properties to set + */ + function DocumentInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentInputConfig content. + * @member {Uint8Array|null|undefined} content + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @instance + */ + DocumentInputConfig.prototype.content = null; + + /** + * DocumentInputConfig gcsSource. + * @member {google.cloud.translation.v3beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @instance + */ + DocumentInputConfig.prototype.gcsSource = null; + + /** + * DocumentInputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @instance + */ + DocumentInputConfig.prototype.mimeType = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DocumentInputConfig source. + * @member {"content"|"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @instance + */ + Object.defineProperty(DocumentInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["content", "gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DocumentInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IDocumentInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DocumentInputConfig} DocumentInputConfig instance + */ + DocumentInputConfig.create = function create(properties) { + return new DocumentInputConfig(properties); + }; + + /** + * Encodes the specified DocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IDocumentInputConfig} message DocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentInputConfig.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.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified DocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IDocumentInputConfig} message DocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.DocumentInputConfig} DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.DocumentInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.content = reader.bytes(); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.decode(reader, reader.uint32()); + break; + } + case 4: { + message.mimeType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.DocumentInputConfig} DocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentInputConfig message. + * @function verify + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentInputConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.content != null && message.hasOwnProperty("content")) { + properties.source = 1; + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + { + var error = $root.google.cloud.translation.v3beta1.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 a DocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DocumentInputConfig} DocumentInputConfig + */ + DocumentInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DocumentInputConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.DocumentInputConfig(); + 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.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3beta1.DocumentInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.fromObject(object.gcsSource); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a DocumentInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.DocumentInputConfig} message DocumentInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + 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 (options.oneofs) + object.source = "content"; + } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3beta1.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 DocumentInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @instance + * @returns {Object.} JSON object + */ + DocumentInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentInputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.DocumentInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.DocumentInputConfig"; + }; + + return DocumentInputConfig; + })(); + + v3beta1.DocumentOutputConfig = (function() { + + /** + * Properties of a DocumentOutputConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface IDocumentOutputConfig + * @property {google.cloud.translation.v3beta1.IGcsDestination|null} [gcsDestination] DocumentOutputConfig gcsDestination + * @property {string|null} [mimeType] DocumentOutputConfig mimeType + */ + + /** + * Constructs a new DocumentOutputConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DocumentOutputConfig. + * @implements IDocumentOutputConfig + * @constructor + * @param {google.cloud.translation.v3beta1.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 gcsDestination. + * @member {google.cloud.translation.v3beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @instance + */ + DocumentOutputConfig.prototype.gcsDestination = null; + + /** + * DocumentOutputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @instance + */ + DocumentOutputConfig.prototype.mimeType = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DocumentOutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @instance + */ + Object.defineProperty(DocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DocumentOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.IDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DocumentOutputConfig} DocumentOutputConfig instance + */ + DocumentOutputConfig.create = function create(properties) { + return new DocumentOutputConfig(properties); + }; + + /** + * Encodes the specified DocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.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.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.translation.v3beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified DocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.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.translation.v3beta1.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.DocumentOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.decode(reader, reader.uint32()); + break; + } + case 3: { + message.mimeType = reader.string(); + 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.translation.v3beta1.DocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.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.translation.v3beta1.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.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.translation.v3beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a DocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DocumentOutputConfig} DocumentOutputConfig + */ + DocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DocumentOutputConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.DocumentOutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3beta1.DocumentOutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.fromObject(object.gcsDestination); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a DocumentOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.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 (options.defaults) + object.mimeType = ""; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this DocumentOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.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.translation.v3beta1.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.translation.v3beta1.DocumentOutputConfig"; + }; + + return DocumentOutputConfig; + })(); + + v3beta1.TranslateDocumentRequest = (function() { + + /** + * Properties of a TranslateDocumentRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface ITranslateDocumentRequest + * @property {string|null} [parent] TranslateDocumentRequest parent + * @property {string|null} [sourceLanguageCode] TranslateDocumentRequest sourceLanguageCode + * @property {string|null} [targetLanguageCode] TranslateDocumentRequest targetLanguageCode + * @property {google.cloud.translation.v3beta1.IDocumentInputConfig|null} [documentInputConfig] TranslateDocumentRequest documentInputConfig + * @property {google.cloud.translation.v3beta1.IDocumentOutputConfig|null} [documentOutputConfig] TranslateDocumentRequest documentOutputConfig + * @property {string|null} [model] TranslateDocumentRequest model + * @property {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateDocumentRequest glossaryConfig + * @property {Object.|null} [labels] TranslateDocumentRequest labels + */ + + /** + * Constructs a new TranslateDocumentRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a TranslateDocumentRequest. + * @implements ITranslateDocumentRequest + * @constructor + * @param {google.cloud.translation.v3beta1.ITranslateDocumentRequest=} [properties] Properties to set + */ + function TranslateDocumentRequest(properties) { + 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]]; + } + + /** + * TranslateDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.parent = ""; + + /** + * TranslateDocumentRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.sourceLanguageCode = ""; + + /** + * TranslateDocumentRequest targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.targetLanguageCode = ""; + + /** + * TranslateDocumentRequest documentInputConfig. + * @member {google.cloud.translation.v3beta1.IDocumentInputConfig|null|undefined} documentInputConfig + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.documentInputConfig = null; + + /** + * TranslateDocumentRequest documentOutputConfig. + * @member {google.cloud.translation.v3beta1.IDocumentOutputConfig|null|undefined} documentOutputConfig + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.documentOutputConfig = null; + + /** + * TranslateDocumentRequest model. + * @member {string} model + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.model = ""; + + /** + * TranslateDocumentRequest glossaryConfig. + * @member {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.glossaryConfig = null; + + /** + * TranslateDocumentRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new TranslateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.ITranslateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.TranslateDocumentRequest} TranslateDocumentRequest instance + */ + TranslateDocumentRequest.create = function create(properties) { + return new TranslateDocumentRequest(properties); + }; + + /** + * Encodes the specified TranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.ITranslateDocumentRequest} message TranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentRequest.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.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCode); + if (message.documentInputConfig != null && Object.hasOwnProperty.call(message, "documentInputConfig")) + $root.google.cloud.translation.v3beta1.DocumentInputConfig.encode(message.documentInputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.documentOutputConfig != null && Object.hasOwnProperty.call(message, "documentOutputConfig")) + $root.google.cloud.translation.v3beta1.DocumentOutputConfig.encode(message.documentOutputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.ITranslateDocumentRequest} message TranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.TranslateDocumentRequest} TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.TranslateDocumentRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sourceLanguageCode = reader.string(); + break; + } + case 3: { + message.targetLanguageCode = reader.string(); + break; + } + case 4: { + message.documentInputConfig = $root.google.cloud.translation.v3beta1.DocumentInputConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.documentOutputConfig = $root.google.cloud.translation.v3beta1.DocumentOutputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.model = reader.string(); + break; + } + case 7: { + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.TranslateDocumentRequest} TranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateDocumentRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateDocumentRequest.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.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + if (message.documentInputConfig != null && message.hasOwnProperty("documentInputConfig")) { + var error = $root.google.cloud.translation.v3beta1.DocumentInputConfig.verify(message.documentInputConfig); + if (error) + return "documentInputConfig." + error; + } + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) { + var error = $root.google.cloud.translation.v3beta1.DocumentOutputConfig.verify(message.documentOutputConfig); + if (error) + return "documentOutputConfig." + error; + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a TranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.TranslateDocumentRequest} TranslateDocumentRequest + */ + TranslateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.TranslateDocumentRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.TranslateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + if (object.documentInputConfig != null) { + if (typeof object.documentInputConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateDocumentRequest.documentInputConfig: object expected"); + message.documentInputConfig = $root.google.cloud.translation.v3beta1.DocumentInputConfig.fromObject(object.documentInputConfig); + } + if (object.documentOutputConfig != null) { + if (typeof object.documentOutputConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateDocumentRequest.documentOutputConfig: object expected"); + message.documentOutputConfig = $root.google.cloud.translation.v3beta1.DocumentOutputConfig.fromObject(object.documentOutputConfig); + } + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateDocumentRequest.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateDocumentRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a TranslateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.TranslateDocumentRequest} message TranslateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.parent = ""; + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + object.documentInputConfig = null; + object.documentOutputConfig = null; + object.model = ""; + object.glossaryConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + if (message.documentInputConfig != null && message.hasOwnProperty("documentInputConfig")) + object.documentInputConfig = $root.google.cloud.translation.v3beta1.DocumentInputConfig.toObject(message.documentInputConfig, options); + if (message.documentOutputConfig != null && message.hasOwnProperty("documentOutputConfig")) + object.documentOutputConfig = $root.google.cloud.translation.v3beta1.DocumentOutputConfig.toObject(message.documentOutputConfig, options); + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this TranslateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + TranslateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.TranslateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.TranslateDocumentRequest"; + }; + + return TranslateDocumentRequest; + })(); + + v3beta1.DocumentTranslation = (function() { + + /** + * Properties of a DocumentTranslation. + * @memberof google.cloud.translation.v3beta1 + * @interface IDocumentTranslation + * @property {Array.|null} [byteStreamOutputs] DocumentTranslation byteStreamOutputs + * @property {string|null} [mimeType] DocumentTranslation mimeType + * @property {string|null} [detectedLanguageCode] DocumentTranslation detectedLanguageCode + */ + + /** + * Constructs a new DocumentTranslation. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DocumentTranslation. + * @implements IDocumentTranslation + * @constructor + * @param {google.cloud.translation.v3beta1.IDocumentTranslation=} [properties] Properties to set + */ + function DocumentTranslation(properties) { + this.byteStreamOutputs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentTranslation byteStreamOutputs. + * @member {Array.} byteStreamOutputs + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @instance + */ + DocumentTranslation.prototype.byteStreamOutputs = $util.emptyArray; + + /** + * DocumentTranslation mimeType. + * @member {string} mimeType + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @instance + */ + DocumentTranslation.prototype.mimeType = ""; + + /** + * DocumentTranslation detectedLanguageCode. + * @member {string} detectedLanguageCode + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @instance + */ + DocumentTranslation.prototype.detectedLanguageCode = ""; + + /** + * Creates a new DocumentTranslation instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {google.cloud.translation.v3beta1.IDocumentTranslation=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DocumentTranslation} DocumentTranslation instance + */ + DocumentTranslation.create = function create(properties) { + return new DocumentTranslation(properties); + }; + + /** + * Encodes the specified DocumentTranslation message. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentTranslation.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {google.cloud.translation.v3beta1.IDocumentTranslation} message DocumentTranslation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTranslation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.byteStreamOutputs != null && message.byteStreamOutputs.length) + for (var i = 0; i < message.byteStreamOutputs.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.byteStreamOutputs[i]); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.detectedLanguageCode != null && Object.hasOwnProperty.call(message, "detectedLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.detectedLanguageCode); + return writer; + }; + + /** + * Encodes the specified DocumentTranslation message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DocumentTranslation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {google.cloud.translation.v3beta1.IDocumentTranslation} message DocumentTranslation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentTranslation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.DocumentTranslation} DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTranslation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.DocumentTranslation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.byteStreamOutputs && message.byteStreamOutputs.length)) + message.byteStreamOutputs = []; + message.byteStreamOutputs.push(reader.bytes()); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } + case 3: { + message.detectedLanguageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentTranslation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.DocumentTranslation} DocumentTranslation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentTranslation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentTranslation message. + * @function verify + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentTranslation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.byteStreamOutputs != null && message.hasOwnProperty("byteStreamOutputs")) { + if (!Array.isArray(message.byteStreamOutputs)) + return "byteStreamOutputs: array expected"; + for (var i = 0; i < message.byteStreamOutputs.length; ++i) + if (!(message.byteStreamOutputs[i] && typeof message.byteStreamOutputs[i].length === "number" || $util.isString(message.byteStreamOutputs[i]))) + return "byteStreamOutputs: buffer[] expected"; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + if (!$util.isString(message.detectedLanguageCode)) + return "detectedLanguageCode: string expected"; + return null; + }; + + /** + * Creates a DocumentTranslation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DocumentTranslation} DocumentTranslation + */ + DocumentTranslation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DocumentTranslation) + return object; + var message = new $root.google.cloud.translation.v3beta1.DocumentTranslation(); + if (object.byteStreamOutputs) { + if (!Array.isArray(object.byteStreamOutputs)) + throw TypeError(".google.cloud.translation.v3beta1.DocumentTranslation.byteStreamOutputs: array expected"); + message.byteStreamOutputs = []; + for (var i = 0; i < object.byteStreamOutputs.length; ++i) + if (typeof object.byteStreamOutputs[i] === "string") + $util.base64.decode(object.byteStreamOutputs[i], message.byteStreamOutputs[i] = $util.newBuffer($util.base64.length(object.byteStreamOutputs[i])), 0); + else if (object.byteStreamOutputs[i].length >= 0) + message.byteStreamOutputs[i] = object.byteStreamOutputs[i]; + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.detectedLanguageCode != null) + message.detectedLanguageCode = String(object.detectedLanguageCode); + return message; + }; + + /** + * Creates a plain object from a DocumentTranslation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {google.cloud.translation.v3beta1.DocumentTranslation} message DocumentTranslation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentTranslation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.byteStreamOutputs = []; + if (options.defaults) { + object.mimeType = ""; + object.detectedLanguageCode = ""; + } + if (message.byteStreamOutputs && message.byteStreamOutputs.length) { + object.byteStreamOutputs = []; + for (var j = 0; j < message.byteStreamOutputs.length; ++j) + object.byteStreamOutputs[j] = options.bytes === String ? $util.base64.encode(message.byteStreamOutputs[j], 0, message.byteStreamOutputs[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.byteStreamOutputs[j]) : message.byteStreamOutputs[j]; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.detectedLanguageCode != null && message.hasOwnProperty("detectedLanguageCode")) + object.detectedLanguageCode = message.detectedLanguageCode; + return object; + }; + + /** + * Converts this DocumentTranslation to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @instance + * @returns {Object.} JSON object + */ + DocumentTranslation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentTranslation + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.DocumentTranslation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentTranslation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.DocumentTranslation"; + }; + + return DocumentTranslation; + })(); + + v3beta1.TranslateDocumentResponse = (function() { + + /** + * Properties of a TranslateDocumentResponse. + * @memberof google.cloud.translation.v3beta1 + * @interface ITranslateDocumentResponse + * @property {google.cloud.translation.v3beta1.IDocumentTranslation|null} [documentTranslation] TranslateDocumentResponse documentTranslation + * @property {google.cloud.translation.v3beta1.IDocumentTranslation|null} [glossaryDocumentTranslation] TranslateDocumentResponse glossaryDocumentTranslation + * @property {string|null} [model] TranslateDocumentResponse model + * @property {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateDocumentResponse glossaryConfig + */ + + /** + * Constructs a new TranslateDocumentResponse. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a TranslateDocumentResponse. + * @implements ITranslateDocumentResponse + * @constructor + * @param {google.cloud.translation.v3beta1.ITranslateDocumentResponse=} [properties] Properties to set + */ + function TranslateDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TranslateDocumentResponse documentTranslation. + * @member {google.cloud.translation.v3beta1.IDocumentTranslation|null|undefined} documentTranslation + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.documentTranslation = null; + + /** + * TranslateDocumentResponse glossaryDocumentTranslation. + * @member {google.cloud.translation.v3beta1.IDocumentTranslation|null|undefined} glossaryDocumentTranslation + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.glossaryDocumentTranslation = null; + + /** + * TranslateDocumentResponse model. + * @member {string} model + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.model = ""; + + /** + * TranslateDocumentResponse glossaryConfig. + * @member {google.cloud.translation.v3beta1.ITranslateTextGlossaryConfig|null|undefined} glossaryConfig + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @instance + */ + TranslateDocumentResponse.prototype.glossaryConfig = null; + + /** + * Creates a new TranslateDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.ITranslateDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.TranslateDocumentResponse} TranslateDocumentResponse instance + */ + TranslateDocumentResponse.create = function create(properties) { + return new TranslateDocumentResponse(properties); + }; + + /** + * Encodes the specified TranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.ITranslateDocumentResponse} message TranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentTranslation != null && Object.hasOwnProperty.call(message, "documentTranslation")) + $root.google.cloud.translation.v3beta1.DocumentTranslation.encode(message.documentTranslation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.glossaryDocumentTranslation != null && Object.hasOwnProperty.call(message, "glossaryDocumentTranslation")) + $root.google.cloud.translation.v3beta1.DocumentTranslation.encode(message.glossaryDocumentTranslation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.glossaryConfig != null && Object.hasOwnProperty.call(message, "glossaryConfig")) + $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.encode(message.glossaryConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.TranslateDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.ITranslateDocumentResponse} message TranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TranslateDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.TranslateDocumentResponse} TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.TranslateDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.documentTranslation = $root.google.cloud.translation.v3beta1.DocumentTranslation.decode(reader, reader.uint32()); + break; + } + case 2: { + message.glossaryDocumentTranslation = $root.google.cloud.translation.v3beta1.DocumentTranslation.decode(reader, reader.uint32()); + break; + } + case 3: { + message.model = reader.string(); + break; + } + case 4: { + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.TranslateDocumentResponse} TranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TranslateDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TranslateDocumentResponse message. + * @function verify + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TranslateDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentTranslation != null && message.hasOwnProperty("documentTranslation")) { + var error = $root.google.cloud.translation.v3beta1.DocumentTranslation.verify(message.documentTranslation); + if (error) + return "documentTranslation." + error; + } + if (message.glossaryDocumentTranslation != null && message.hasOwnProperty("glossaryDocumentTranslation")) { + var error = $root.google.cloud.translation.v3beta1.DocumentTranslation.verify(message.glossaryDocumentTranslation); + if (error) + return "glossaryDocumentTranslation." + error; + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) { + var error = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify(message.glossaryConfig); + if (error) + return "glossaryConfig." + error; + } + return null; + }; + + /** + * Creates a TranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.TranslateDocumentResponse} TranslateDocumentResponse + */ + TranslateDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.TranslateDocumentResponse) + return object; + var message = new $root.google.cloud.translation.v3beta1.TranslateDocumentResponse(); + if (object.documentTranslation != null) { + if (typeof object.documentTranslation !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateDocumentResponse.documentTranslation: object expected"); + message.documentTranslation = $root.google.cloud.translation.v3beta1.DocumentTranslation.fromObject(object.documentTranslation); + } + if (object.glossaryDocumentTranslation != null) { + if (typeof object.glossaryDocumentTranslation !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateDocumentResponse.glossaryDocumentTranslation: object expected"); + message.glossaryDocumentTranslation = $root.google.cloud.translation.v3beta1.DocumentTranslation.fromObject(object.glossaryDocumentTranslation); + } + if (object.model != null) + message.model = String(object.model); + if (object.glossaryConfig != null) { + if (typeof object.glossaryConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.TranslateDocumentResponse.glossaryConfig: object expected"); + message.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.fromObject(object.glossaryConfig); + } + return message; + }; + + /** + * Creates a plain object from a TranslateDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.TranslateDocumentResponse} message TranslateDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TranslateDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.documentTranslation = null; + object.glossaryDocumentTranslation = null; + object.model = ""; + object.glossaryConfig = null; + } + if (message.documentTranslation != null && message.hasOwnProperty("documentTranslation")) + object.documentTranslation = $root.google.cloud.translation.v3beta1.DocumentTranslation.toObject(message.documentTranslation, options); + if (message.glossaryDocumentTranslation != null && message.hasOwnProperty("glossaryDocumentTranslation")) + object.glossaryDocumentTranslation = $root.google.cloud.translation.v3beta1.DocumentTranslation.toObject(message.glossaryDocumentTranslation, options); + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.glossaryConfig != null && message.hasOwnProperty("glossaryConfig")) + object.glossaryConfig = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.toObject(message.glossaryConfig, options); + return object; + }; + + /** + * Converts this TranslateDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + TranslateDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TranslateDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.TranslateDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TranslateDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.TranslateDocumentResponse"; + }; + + return TranslateDocumentResponse; + })(); + + v3beta1.BatchTranslateTextRequest = (function() { + + /** + * Properties of a BatchTranslateTextRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchTranslateTextRequest + * @property {string|null} [parent] BatchTranslateTextRequest parent + * @property {string|null} [sourceLanguageCode] BatchTranslateTextRequest sourceLanguageCode + * @property {Array.|null} [targetLanguageCodes] BatchTranslateTextRequest targetLanguageCodes + * @property {Object.|null} [models] BatchTranslateTextRequest models + * @property {Array.|null} [inputConfigs] BatchTranslateTextRequest inputConfigs + * @property {google.cloud.translation.v3beta1.IOutputConfig|null} [outputConfig] BatchTranslateTextRequest outputConfig + * @property {Object.|null} [glossaries] BatchTranslateTextRequest glossaries + * @property {Object.|null} [labels] BatchTranslateTextRequest labels + */ + + /** + * Constructs a new BatchTranslateTextRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchTranslateTextRequest. + * @implements IBatchTranslateTextRequest + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchTranslateTextRequest=} [properties] Properties to set + */ + function BatchTranslateTextRequest(properties) { + this.targetLanguageCodes = []; + this.models = {}; + this.inputConfigs = []; + this.glossaries = {}; + 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]]; + } + + /** + * BatchTranslateTextRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.parent = ""; + + /** + * BatchTranslateTextRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.sourceLanguageCode = ""; + + /** + * BatchTranslateTextRequest targetLanguageCodes. + * @member {Array.} targetLanguageCodes + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.targetLanguageCodes = $util.emptyArray; + + /** + * BatchTranslateTextRequest models. + * @member {Object.} models + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.models = $util.emptyObject; + + /** + * BatchTranslateTextRequest inputConfigs. + * @member {Array.} inputConfigs + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.inputConfigs = $util.emptyArray; + + /** + * BatchTranslateTextRequest outputConfig. + * @member {google.cloud.translation.v3beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.outputConfig = null; + + /** + * BatchTranslateTextRequest glossaries. + * @member {Object.} glossaries + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.glossaries = $util.emptyObject; + + /** + * BatchTranslateTextRequest labels. + * @member {Object.} labels + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + */ + BatchTranslateTextRequest.prototype.labels = $util.emptyObject; + + /** + * Creates a new BatchTranslateTextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateTextRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchTranslateTextRequest} BatchTranslateTextRequest instance + */ + BatchTranslateTextRequest.create = function create(properties) { + return new BatchTranslateTextRequest(properties); + }; + + /** + * Encodes the specified BatchTranslateTextRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateTextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateTextRequest.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.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCodes != null && message.targetLanguageCodes.length) + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCodes[i]); + if (message.models != null && Object.hasOwnProperty.call(message, "models")) + for (var keys = Object.keys(message.models), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.models[keys[i]]).ldelim(); + if (message.inputConfigs != null && message.inputConfigs.length) + for (var i = 0; i < message.inputConfigs.length; ++i) + $root.google.cloud.translation.v3beta1.InputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.translation.v3beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.glossaries != null && Object.hasOwnProperty.call(message, "glossaries")) + for (var keys = Object.keys(message.glossaries), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateTextRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateTextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateTextRequest} message BatchTranslateTextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateTextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchTranslateTextRequest} BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateTextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchTranslateTextRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sourceLanguageCode = reader.string(); + break; + } + case 3: { + if (!(message.targetLanguageCodes && message.targetLanguageCodes.length)) + message.targetLanguageCodes = []; + message.targetLanguageCodes.push(reader.string()); + break; + } + case 4: { + if (message.models === $util.emptyObject) + message.models = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.models[key] = value; + break; + } + case 5: { + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.translation.v3beta1.InputConfig.decode(reader, reader.uint32())); + break; + } + case 6: { + message.outputConfig = $root.google.cloud.translation.v3beta1.OutputConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + if (message.glossaries === $util.emptyObject) + message.glossaries = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.glossaries[key] = value; + break; + } + case 9: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateTextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchTranslateTextRequest} BatchTranslateTextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateTextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateTextRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateTextRequest.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.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCodes != null && message.hasOwnProperty("targetLanguageCodes")) { + if (!Array.isArray(message.targetLanguageCodes)) + return "targetLanguageCodes: array expected"; + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + if (!$util.isString(message.targetLanguageCodes[i])) + return "targetLanguageCodes: string[] expected"; + } + if (message.models != null && message.hasOwnProperty("models")) { + if (!$util.isObject(message.models)) + return "models: object expected"; + var key = Object.keys(message.models); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.models[key[i]])) + return "models: string{k: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.translation.v3beta1.InputConfig.verify(message.inputConfigs[i]); + if (error) + return "inputConfigs." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.translation.v3beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!$util.isObject(message.glossaries)) + return "glossaries: object expected"; + var key = Object.keys(message.glossaries); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify(message.glossaries[key[i]]); + if (error) + return "glossaries." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a BatchTranslateTextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchTranslateTextRequest} BatchTranslateTextRequest + */ + BatchTranslateTextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchTranslateTextRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchTranslateTextRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCodes) { + if (!Array.isArray(object.targetLanguageCodes)) + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.targetLanguageCodes: array expected"); + message.targetLanguageCodes = []; + for (var i = 0; i < object.targetLanguageCodes.length; ++i) + message.targetLanguageCodes[i] = String(object.targetLanguageCodes[i]); + } + if (object.models) { + if (typeof object.models !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.models: object expected"); + message.models = {}; + for (var keys = Object.keys(object.models), i = 0; i < keys.length; ++i) + message.models[keys[i]] = String(object.models[keys[i]]); + } + if (object.inputConfigs) { + if (!Array.isArray(object.inputConfigs)) + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.inputConfigs: array expected"); + message.inputConfigs = []; + for (var i = 0; i < object.inputConfigs.length; ++i) { + if (typeof object.inputConfigs[i] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.inputConfigs: object expected"); + message.inputConfigs[i] = $root.google.cloud.translation.v3beta1.InputConfig.fromObject(object.inputConfigs[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.translation.v3beta1.OutputConfig.fromObject(object.outputConfig); + } + if (object.glossaries) { + if (typeof object.glossaries !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.glossaries: object expected"); + message.glossaries = {}; + for (var keys = Object.keys(object.glossaries), i = 0; i < keys.length; ++i) { + if (typeof object.glossaries[keys[i]] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.glossaries: object expected"); + message.glossaries[keys[i]] = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); + } + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateTextRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateTextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {google.cloud.translation.v3beta1.BatchTranslateTextRequest} message BatchTranslateTextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateTextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.targetLanguageCodes = []; + object.inputConfigs = []; + } + if (options.objects || options.defaults) { + object.models = {}; + object.glossaries = {}; + object.labels = {}; + } + if (options.defaults) { + object.parent = ""; + object.sourceLanguageCode = ""; + object.outputConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCodes && message.targetLanguageCodes.length) { + object.targetLanguageCodes = []; + for (var j = 0; j < message.targetLanguageCodes.length; ++j) + object.targetLanguageCodes[j] = message.targetLanguageCodes[j]; + } + var keys2; + if (message.models && (keys2 = Object.keys(message.models)).length) { + object.models = {}; + for (var j = 0; j < keys2.length; ++j) + object.models[keys2[j]] = message.models[keys2[j]]; + } + if (message.inputConfigs && message.inputConfigs.length) { + object.inputConfigs = []; + for (var j = 0; j < message.inputConfigs.length; ++j) + object.inputConfigs[j] = $root.google.cloud.translation.v3beta1.InputConfig.toObject(message.inputConfigs[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.translation.v3beta1.OutputConfig.toObject(message.outputConfig, options); + if (message.glossaries && (keys2 = Object.keys(message.glossaries)).length) { + object.glossaries = {}; + for (var j = 0; j < keys2.length; ++j) + object.glossaries[keys2[j]] = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); + } + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this BatchTranslateTextRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateTextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateTextRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchTranslateTextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateTextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchTranslateTextRequest"; + }; + + return BatchTranslateTextRequest; + })(); + + v3beta1.BatchTranslateMetadata = (function() { + + /** + * Properties of a BatchTranslateMetadata. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchTranslateMetadata + * @property {google.cloud.translation.v3beta1.BatchTranslateMetadata.State|null} [state] BatchTranslateMetadata state + * @property {number|Long|null} [translatedCharacters] BatchTranslateMetadata translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateMetadata failedCharacters + * @property {number|Long|null} [totalCharacters] BatchTranslateMetadata totalCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateMetadata submitTime + */ + + /** + * Constructs a new BatchTranslateMetadata. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchTranslateMetadata. + * @implements IBatchTranslateMetadata + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchTranslateMetadata=} [properties] Properties to set + */ + function BatchTranslateMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateMetadata state. + * @member {google.cloud.translation.v3beta1.BatchTranslateMetadata.State} state + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.state = 0; + + /** + * BatchTranslateMetadata translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @instance + */ + BatchTranslateMetadata.prototype.submitTime = null; + + /** + * Creates a new BatchTranslateMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchTranslateMetadata} BatchTranslateMetadata instance + */ + BatchTranslateMetadata.create = function create(properties) { + return new BatchTranslateMetadata(properties); + }; + + /** + * Encodes the specified BatchTranslateMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateMetadata.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.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateMetadata} message BatchTranslateMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchTranslateMetadata} BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchTranslateMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.translatedCharacters = reader.int64(); + break; + } + case 3: { + message.failedCharacters = reader.int64(); + break; + } + case 4: { + message.totalCharacters = reader.int64(); + break; + } + case 5: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchTranslateMetadata} BatchTranslateMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateMetadata message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateMetadata.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.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchTranslateMetadata} BatchTranslateMetadata + */ + BatchTranslateMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchTranslateMetadata) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchTranslateMetadata(); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {google.cloud.translation.v3beta1.BatchTranslateMetadata} message BatchTranslateMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3beta1.BatchTranslateMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3beta1.BatchTranslateMetadata.State[message.state] : message.state; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this BatchTranslateMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchTranslateMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchTranslateMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3beta1.BatchTranslateMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + BatchTranslateMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return BatchTranslateMetadata; + })(); + + v3beta1.BatchTranslateResponse = (function() { + + /** + * Properties of a BatchTranslateResponse. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchTranslateResponse + * @property {number|Long|null} [totalCharacters] BatchTranslateResponse totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateResponse translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateResponse failedCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] BatchTranslateResponse endTime + */ + + /** + * Constructs a new BatchTranslateResponse. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchTranslateResponse. + * @implements IBatchTranslateResponse + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchTranslateResponse=} [properties] Properties to set + */ + function BatchTranslateResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateResponse totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.submitTime = null; + + /** + * BatchTranslateResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @instance + */ + BatchTranslateResponse.prototype.endTime = null; + + /** + * Creates a new BatchTranslateResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchTranslateResponse} BatchTranslateResponse instance + */ + BatchTranslateResponse.create = function create(properties) { + return new BatchTranslateResponse(properties); + }; + + /** + * Encodes the specified BatchTranslateResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateResponse} message BatchTranslateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchTranslateResponse} BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchTranslateResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.totalCharacters = reader.int64(); + break; + } + case 2: { + message.translatedCharacters = reader.int64(); + break; + } + case 3: { + message.failedCharacters = reader.int64(); + break; + } + case 4: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchTranslateResponse} BatchTranslateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateResponse message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchTranslateResponse} BatchTranslateResponse + */ + BatchTranslateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchTranslateResponse) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchTranslateResponse(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {google.cloud.translation.v3beta1.BatchTranslateResponse} message BatchTranslateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateResponse.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.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + object.endTime = null; + } + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this BatchTranslateResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchTranslateResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchTranslateResponse"; + }; + + return BatchTranslateResponse; + })(); + + v3beta1.GlossaryInputConfig = (function() { + + /** + * Properties of a GlossaryInputConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface IGlossaryInputConfig + * @property {google.cloud.translation.v3beta1.IGcsSource|null} [gcsSource] GlossaryInputConfig gcsSource + */ + + /** + * Constructs a new GlossaryInputConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a GlossaryInputConfig. + * @implements IGlossaryInputConfig + * @constructor + * @param {google.cloud.translation.v3beta1.IGlossaryInputConfig=} [properties] Properties to set + */ + function GlossaryInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GlossaryInputConfig gcsSource. + * @member {google.cloud.translation.v3beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @instance + */ + GlossaryInputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GlossaryInputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @instance + */ + Object.defineProperty(GlossaryInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GlossaryInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IGlossaryInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.GlossaryInputConfig} GlossaryInputConfig instance + */ + GlossaryInputConfig.create = function create(properties) { + return new GlossaryInputConfig(properties); + }; + + /** + * Encodes the specified GlossaryInputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.GlossaryInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlossaryInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GlossaryInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GlossaryInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IGlossaryInputConfig} message GlossaryInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlossaryInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.GlossaryInputConfig} GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlossaryInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.GlossaryInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GlossaryInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.GlossaryInputConfig} GlossaryInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlossaryInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GlossaryInputConfig message. + * @function verify + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GlossaryInputConfig.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.translation.v3beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates a GlossaryInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.GlossaryInputConfig} GlossaryInputConfig + */ + GlossaryInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.GlossaryInputConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.GlossaryInputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3beta1.GlossaryInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from a GlossaryInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {google.cloud.translation.v3beta1.GlossaryInputConfig} message GlossaryInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GlossaryInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this GlossaryInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @instance + * @returns {Object.} JSON object + */ + GlossaryInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GlossaryInputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.GlossaryInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GlossaryInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.GlossaryInputConfig"; + }; + + return GlossaryInputConfig; + })(); + + v3beta1.Glossary = (function() { + + /** + * Properties of a Glossary. + * @memberof google.cloud.translation.v3beta1 + * @interface IGlossary + * @property {string|null} [name] Glossary name + * @property {google.cloud.translation.v3beta1.Glossary.ILanguageCodePair|null} [languagePair] Glossary languagePair + * @property {google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet|null} [languageCodesSet] Glossary languageCodesSet + * @property {google.cloud.translation.v3beta1.IGlossaryInputConfig|null} [inputConfig] Glossary inputConfig + * @property {number|null} [entryCount] Glossary entryCount + * @property {google.protobuf.ITimestamp|null} [submitTime] Glossary submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] Glossary endTime + */ + + /** + * Constructs a new Glossary. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a Glossary. + * @implements IGlossary + * @constructor + * @param {google.cloud.translation.v3beta1.IGlossary=} [properties] Properties to set + */ + function Glossary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Glossary name. + * @member {string} name + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Glossary.prototype.name = ""; + + /** + * Glossary languagePair. + * @member {google.cloud.translation.v3beta1.Glossary.ILanguageCodePair|null|undefined} languagePair + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Glossary.prototype.languagePair = null; + + /** + * Glossary languageCodesSet. + * @member {google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet|null|undefined} languageCodesSet + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Glossary.prototype.languageCodesSet = null; + + /** + * Glossary inputConfig. + * @member {google.cloud.translation.v3beta1.IGlossaryInputConfig|null|undefined} inputConfig + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Glossary.prototype.inputConfig = null; + + /** + * Glossary entryCount. + * @member {number} entryCount + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Glossary.prototype.entryCount = 0; + + /** + * Glossary submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Glossary.prototype.submitTime = null; + + /** + * Glossary endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Glossary.prototype.endTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Glossary languages. + * @member {"languagePair"|"languageCodesSet"|undefined} languages + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + */ + Object.defineProperty(Glossary.prototype, "languages", { + get: $util.oneOfGetter($oneOfFields = ["languagePair", "languageCodesSet"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Glossary instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {google.cloud.translation.v3beta1.IGlossary=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.Glossary} Glossary instance + */ + Glossary.create = function create(properties) { + return new Glossary(properties); + }; + + /** + * Encodes the specified Glossary message. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {google.cloud.translation.v3beta1.IGlossary} message Glossary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Glossary.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.languagePair != null && Object.hasOwnProperty.call(message, "languagePair")) + $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair.encode(message.languagePair, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCodesSet != null && Object.hasOwnProperty.call(message, "languageCodesSet")) + $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.encode(message.languageCodesSet, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.translation.v3beta1.GlossaryInputConfig.encode(message.inputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.entryCount != null && Object.hasOwnProperty.call(message, "entryCount")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.entryCount); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Glossary message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {google.cloud.translation.v3beta1.IGlossary} message Glossary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Glossary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Glossary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.Glossary} Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Glossary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.Glossary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.languagePair = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair.decode(reader, reader.uint32()); + break; + } + case 4: { + message.languageCodesSet = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputConfig = $root.google.cloud.translation.v3beta1.GlossaryInputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.entryCount = reader.int32(); + break; + } + case 7: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Glossary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.Glossary} Glossary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Glossary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Glossary message. + * @function verify + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Glossary.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.languagePair != null && message.hasOwnProperty("languagePair")) { + properties.languages = 1; + { + var error = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair.verify(message.languagePair); + if (error) + return "languagePair." + error; + } + } + if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { + if (properties.languages === 1) + return "languages: multiple values"; + properties.languages = 1; + { + var error = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.verify(message.languageCodesSet); + if (error) + return "languageCodesSet." + error; + } + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.translation.v3beta1.GlossaryInputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.entryCount != null && message.hasOwnProperty("entryCount")) + if (!$util.isInteger(message.entryCount)) + return "entryCount: integer expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a Glossary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.Glossary} Glossary + */ + Glossary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.Glossary) + return object; + var message = new $root.google.cloud.translation.v3beta1.Glossary(); + if (object.name != null) + message.name = String(object.name); + if (object.languagePair != null) { + if (typeof object.languagePair !== "object") + throw TypeError(".google.cloud.translation.v3beta1.Glossary.languagePair: object expected"); + message.languagePair = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair.fromObject(object.languagePair); + } + if (object.languageCodesSet != null) { + if (typeof object.languageCodesSet !== "object") + throw TypeError(".google.cloud.translation.v3beta1.Glossary.languageCodesSet: object expected"); + message.languageCodesSet = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.fromObject(object.languageCodesSet); + } + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.Glossary.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.translation.v3beta1.GlossaryInputConfig.fromObject(object.inputConfig); + } + if (object.entryCount != null) + message.entryCount = object.entryCount | 0; + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.Glossary.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.Glossary.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a Glossary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {google.cloud.translation.v3beta1.Glossary} message Glossary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Glossary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputConfig = null; + object.entryCount = 0; + object.submitTime = null; + object.endTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languagePair != null && message.hasOwnProperty("languagePair")) { + object.languagePair = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair.toObject(message.languagePair, options); + if (options.oneofs) + object.languages = "languagePair"; + } + if (message.languageCodesSet != null && message.hasOwnProperty("languageCodesSet")) { + object.languageCodesSet = $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.toObject(message.languageCodesSet, options); + if (options.oneofs) + object.languages = "languageCodesSet"; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.translation.v3beta1.GlossaryInputConfig.toObject(message.inputConfig, options); + if (message.entryCount != null && message.hasOwnProperty("entryCount")) + object.entryCount = message.entryCount; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this Glossary to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.Glossary + * @instance + * @returns {Object.} JSON object + */ + Glossary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Glossary + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.Glossary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Glossary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.Glossary"; + }; + + Glossary.LanguageCodePair = (function() { + + /** + * Properties of a LanguageCodePair. + * @memberof google.cloud.translation.v3beta1.Glossary + * @interface ILanguageCodePair + * @property {string|null} [sourceLanguageCode] LanguageCodePair sourceLanguageCode + * @property {string|null} [targetLanguageCode] LanguageCodePair targetLanguageCode + */ + + /** + * Constructs a new LanguageCodePair. + * @memberof google.cloud.translation.v3beta1.Glossary + * @classdesc Represents a LanguageCodePair. + * @implements ILanguageCodePair + * @constructor + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodePair=} [properties] Properties to set + */ + function LanguageCodePair(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LanguageCodePair sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @instance + */ + LanguageCodePair.prototype.sourceLanguageCode = ""; + + /** + * LanguageCodePair targetLanguageCode. + * @member {string} targetLanguageCode + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @instance + */ + LanguageCodePair.prototype.targetLanguageCode = ""; + + /** + * Creates a new LanguageCodePair instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodePair=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodePair} LanguageCodePair instance + */ + LanguageCodePair.create = function create(properties) { + return new LanguageCodePair(properties); + }; + + /** + * Encodes the specified LanguageCodePair message. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodePair.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodePair.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.sourceLanguageCode); + if (message.targetLanguageCode != null && Object.hasOwnProperty.call(message, "targetLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLanguageCode); + return writer; + }; + + /** + * Encodes the specified LanguageCodePair message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodePair.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodePair} message LanguageCodePair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodePair.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodePair} LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodePair.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.sourceLanguageCode = reader.string(); + break; + } + case 2: { + message.targetLanguageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LanguageCodePair message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodePair} LanguageCodePair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodePair.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LanguageCodePair message. + * @function verify + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LanguageCodePair.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + if (!$util.isString(message.targetLanguageCode)) + return "targetLanguageCode: string expected"; + return null; + }; + + /** + * Creates a LanguageCodePair message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodePair} LanguageCodePair + */ + LanguageCodePair.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair) + return object; + var message = new $root.google.cloud.translation.v3beta1.Glossary.LanguageCodePair(); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCode != null) + message.targetLanguageCode = String(object.targetLanguageCode); + return message; + }; + + /** + * Creates a plain object from a LanguageCodePair message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {google.cloud.translation.v3beta1.Glossary.LanguageCodePair} message LanguageCodePair + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LanguageCodePair.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sourceLanguageCode = ""; + object.targetLanguageCode = ""; + } + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCode != null && message.hasOwnProperty("targetLanguageCode")) + object.targetLanguageCode = message.targetLanguageCode; + return object; + }; + + /** + * Converts this LanguageCodePair to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @instance + * @returns {Object.} JSON object + */ + LanguageCodePair.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LanguageCodePair + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodePair + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LanguageCodePair.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.Glossary.LanguageCodePair"; + }; + + return LanguageCodePair; + })(); + + Glossary.LanguageCodesSet = (function() { + + /** + * Properties of a LanguageCodesSet. + * @memberof google.cloud.translation.v3beta1.Glossary + * @interface ILanguageCodesSet + * @property {Array.|null} [languageCodes] LanguageCodesSet languageCodes + */ + + /** + * Constructs a new LanguageCodesSet. + * @memberof google.cloud.translation.v3beta1.Glossary + * @classdesc Represents a LanguageCodesSet. + * @implements ILanguageCodesSet + * @constructor + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet=} [properties] Properties to set + */ + function LanguageCodesSet(properties) { + this.languageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LanguageCodesSet languageCodes. + * @member {Array.} languageCodes + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @instance + */ + LanguageCodesSet.prototype.languageCodes = $util.emptyArray; + + /** + * Creates a new LanguageCodesSet instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodesSet} LanguageCodesSet instance + */ + LanguageCodesSet.create = function create(properties) { + return new LanguageCodesSet(properties); + }; + + /** + * Encodes the specified LanguageCodesSet message. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodesSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCodes != null && message.languageCodes.length) + for (var i = 0; i < message.languageCodes.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCodes[i]); + return writer; + }; + + /** + * Encodes the specified LanguageCodesSet message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3beta1.Glossary.ILanguageCodesSet} message LanguageCodesSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LanguageCodesSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodesSet} LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodesSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.languageCodes && message.languageCodes.length)) + message.languageCodes = []; + message.languageCodes.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LanguageCodesSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodesSet} LanguageCodesSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LanguageCodesSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LanguageCodesSet message. + * @function verify + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LanguageCodesSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCodes != null && message.hasOwnProperty("languageCodes")) { + if (!Array.isArray(message.languageCodes)) + return "languageCodes: array expected"; + for (var i = 0; i < message.languageCodes.length; ++i) + if (!$util.isString(message.languageCodes[i])) + return "languageCodes: string[] expected"; + } + return null; + }; + + /** + * Creates a LanguageCodesSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.Glossary.LanguageCodesSet} LanguageCodesSet + */ + LanguageCodesSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet) + return object; + var message = new $root.google.cloud.translation.v3beta1.Glossary.LanguageCodesSet(); + if (object.languageCodes) { + if (!Array.isArray(object.languageCodes)) + throw TypeError(".google.cloud.translation.v3beta1.Glossary.LanguageCodesSet.languageCodes: array expected"); + message.languageCodes = []; + for (var i = 0; i < object.languageCodes.length; ++i) + message.languageCodes[i] = String(object.languageCodes[i]); + } + return message; + }; + + /** + * Creates a plain object from a LanguageCodesSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {google.cloud.translation.v3beta1.Glossary.LanguageCodesSet} message LanguageCodesSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LanguageCodesSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.languageCodes = []; + if (message.languageCodes && message.languageCodes.length) { + object.languageCodes = []; + for (var j = 0; j < message.languageCodes.length; ++j) + object.languageCodes[j] = message.languageCodes[j]; + } + return object; + }; + + /** + * Converts this LanguageCodesSet to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @instance + * @returns {Object.} JSON object + */ + LanguageCodesSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LanguageCodesSet + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.Glossary.LanguageCodesSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LanguageCodesSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.Glossary.LanguageCodesSet"; + }; + + return LanguageCodesSet; + })(); + + return Glossary; + })(); + + v3beta1.CreateGlossaryRequest = (function() { + + /** + * Properties of a CreateGlossaryRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface ICreateGlossaryRequest + * @property {string|null} [parent] CreateGlossaryRequest parent + * @property {google.cloud.translation.v3beta1.IGlossary|null} [glossary] CreateGlossaryRequest glossary + */ + + /** + * Constructs a new CreateGlossaryRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a CreateGlossaryRequest. + * @implements ICreateGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3beta1.ICreateGlossaryRequest=} [properties] Properties to set + */ + function CreateGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateGlossaryRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @instance + */ + CreateGlossaryRequest.prototype.parent = ""; + + /** + * CreateGlossaryRequest glossary. + * @member {google.cloud.translation.v3beta1.IGlossary|null|undefined} glossary + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @instance + */ + CreateGlossaryRequest.prototype.glossary = null; + + /** + * Creates a new CreateGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.ICreateGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.CreateGlossaryRequest} CreateGlossaryRequest instance + */ + CreateGlossaryRequest.create = function create(properties) { + return new CreateGlossaryRequest(properties); + }; + + /** + * Encodes the specified CreateGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryRequest.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.glossary != null && Object.hasOwnProperty.call(message, "glossary")) + $root.google.cloud.translation.v3beta1.Glossary.encode(message.glossary, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.ICreateGlossaryRequest} message CreateGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.CreateGlossaryRequest} CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.CreateGlossaryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.glossary = $root.google.cloud.translation.v3beta1.Glossary.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.CreateGlossaryRequest} CreateGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateGlossaryRequest.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.glossary != null && message.hasOwnProperty("glossary")) { + var error = $root.google.cloud.translation.v3beta1.Glossary.verify(message.glossary); + if (error) + return "glossary." + error; + } + return null; + }; + + /** + * Creates a CreateGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.CreateGlossaryRequest} CreateGlossaryRequest + */ + CreateGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.CreateGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.CreateGlossaryRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.glossary != null) { + if (typeof object.glossary !== "object") + throw TypeError(".google.cloud.translation.v3beta1.CreateGlossaryRequest.glossary: object expected"); + message.glossary = $root.google.cloud.translation.v3beta1.Glossary.fromObject(object.glossary); + } + return message; + }; + + /** + * Creates a plain object from a CreateGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.CreateGlossaryRequest} message CreateGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateGlossaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.glossary = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.glossary != null && message.hasOwnProperty("glossary")) + object.glossary = $root.google.cloud.translation.v3beta1.Glossary.toObject(message.glossary, options); + return object; + }; + + /** + * Converts this CreateGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + CreateGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateGlossaryRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.CreateGlossaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateGlossaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.CreateGlossaryRequest"; + }; + + return CreateGlossaryRequest; + })(); + + v3beta1.GetGlossaryRequest = (function() { + + /** + * Properties of a GetGlossaryRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface IGetGlossaryRequest + * @property {string|null} [name] GetGlossaryRequest name + */ + + /** + * Constructs a new GetGlossaryRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a GetGlossaryRequest. + * @implements IGetGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3beta1.IGetGlossaryRequest=} [properties] Properties to set + */ + function GetGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetGlossaryRequest name. + * @member {string} name + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @instance + */ + GetGlossaryRequest.prototype.name = ""; + + /** + * Creates a new GetGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.IGetGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.GetGlossaryRequest} GetGlossaryRequest instance + */ + GetGlossaryRequest.create = function create(properties) { + return new GetGlossaryRequest(properties); + }; + + /** + * Encodes the specified GetGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.GetGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGlossaryRequest.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 GetGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.GetGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.IGetGlossaryRequest} message GetGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.GetGlossaryRequest} GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.GetGlossaryRequest(); + 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 GetGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.GetGlossaryRequest} GetGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGlossaryRequest.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 GetGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.GetGlossaryRequest} GetGlossaryRequest + */ + GetGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.GetGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.GetGlossaryRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.GetGlossaryRequest} message GetGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGlossaryRequest.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 GetGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + GetGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetGlossaryRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.GetGlossaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetGlossaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.GetGlossaryRequest"; + }; + + return GetGlossaryRequest; + })(); + + v3beta1.DeleteGlossaryRequest = (function() { + + /** + * Properties of a DeleteGlossaryRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface IDeleteGlossaryRequest + * @property {string|null} [name] DeleteGlossaryRequest name + */ + + /** + * Constructs a new DeleteGlossaryRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DeleteGlossaryRequest. + * @implements IDeleteGlossaryRequest + * @constructor + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryRequest=} [properties] Properties to set + */ + function DeleteGlossaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteGlossaryRequest name. + * @member {string} name + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @instance + */ + DeleteGlossaryRequest.prototype.name = ""; + + /** + * Creates a new DeleteGlossaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryRequest} DeleteGlossaryRequest instance + */ + DeleteGlossaryRequest.create = function create(properties) { + return new DeleteGlossaryRequest(properties); + }; + + /** + * Encodes the specified DeleteGlossaryRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryRequest.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 DeleteGlossaryRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryRequest} message DeleteGlossaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGlossaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryRequest} DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.DeleteGlossaryRequest(); + 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 DeleteGlossaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryRequest} DeleteGlossaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGlossaryRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGlossaryRequest.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 DeleteGlossaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryRequest} DeleteGlossaryRequest + */ + DeleteGlossaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DeleteGlossaryRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.DeleteGlossaryRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteGlossaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {google.cloud.translation.v3beta1.DeleteGlossaryRequest} message DeleteGlossaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGlossaryRequest.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 DeleteGlossaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteGlossaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteGlossaryRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteGlossaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.DeleteGlossaryRequest"; + }; + + return DeleteGlossaryRequest; + })(); + + v3beta1.ListGlossariesRequest = (function() { + + /** + * Properties of a ListGlossariesRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface IListGlossariesRequest + * @property {string|null} [parent] ListGlossariesRequest parent + * @property {number|null} [pageSize] ListGlossariesRequest pageSize + * @property {string|null} [pageToken] ListGlossariesRequest pageToken + * @property {string|null} [filter] ListGlossariesRequest filter + */ + + /** + * Constructs a new ListGlossariesRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a ListGlossariesRequest. + * @implements IListGlossariesRequest + * @constructor + * @param {google.cloud.translation.v3beta1.IListGlossariesRequest=} [properties] Properties to set + */ + function ListGlossariesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListGlossariesRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.parent = ""; + + /** + * ListGlossariesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.pageSize = 0; + + /** + * ListGlossariesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.pageToken = ""; + + /** + * ListGlossariesRequest filter. + * @member {string} filter + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @instance + */ + ListGlossariesRequest.prototype.filter = ""; + + /** + * Creates a new ListGlossariesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3beta1.IListGlossariesRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.ListGlossariesRequest} ListGlossariesRequest instance + */ + ListGlossariesRequest.create = function create(properties) { + return new ListGlossariesRequest(properties); + }; + + /** + * Encodes the specified ListGlossariesRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3beta1.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListGlossariesRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3beta1.IListGlossariesRequest} message ListGlossariesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.ListGlossariesRequest} ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.ListGlossariesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGlossariesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.ListGlossariesRequest} ListGlossariesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGlossariesRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGlossariesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListGlossariesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.ListGlossariesRequest} ListGlossariesRequest + */ + ListGlossariesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.ListGlossariesRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.ListGlossariesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListGlossariesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {google.cloud.translation.v3beta1.ListGlossariesRequest} message ListGlossariesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGlossariesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListGlossariesRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @instance + * @returns {Object.} JSON object + */ + ListGlossariesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGlossariesRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.ListGlossariesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGlossariesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.ListGlossariesRequest"; + }; + + return ListGlossariesRequest; + })(); + + v3beta1.ListGlossariesResponse = (function() { + + /** + * Properties of a ListGlossariesResponse. + * @memberof google.cloud.translation.v3beta1 + * @interface IListGlossariesResponse + * @property {Array.|null} [glossaries] ListGlossariesResponse glossaries + * @property {string|null} [nextPageToken] ListGlossariesResponse nextPageToken + */ + + /** + * Constructs a new ListGlossariesResponse. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a ListGlossariesResponse. + * @implements IListGlossariesResponse + * @constructor + * @param {google.cloud.translation.v3beta1.IListGlossariesResponse=} [properties] Properties to set + */ + function ListGlossariesResponse(properties) { + this.glossaries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListGlossariesResponse glossaries. + * @member {Array.} glossaries + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @instance + */ + ListGlossariesResponse.prototype.glossaries = $util.emptyArray; + + /** + * ListGlossariesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @instance + */ + ListGlossariesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListGlossariesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3beta1.IListGlossariesResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.ListGlossariesResponse} ListGlossariesResponse instance + */ + ListGlossariesResponse.create = function create(properties) { + return new ListGlossariesResponse(properties); + }; + + /** + * Encodes the specified ListGlossariesResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3beta1.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.glossaries != null && message.glossaries.length) + for (var i = 0; i < message.glossaries.length; ++i) + $root.google.cloud.translation.v3beta1.Glossary.encode(message.glossaries[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 ListGlossariesResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.ListGlossariesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3beta1.IListGlossariesResponse} message ListGlossariesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGlossariesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.ListGlossariesResponse} ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.ListGlossariesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.glossaries && message.glossaries.length)) + message.glossaries = []; + message.glossaries.push($root.google.cloud.translation.v3beta1.Glossary.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGlossariesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.ListGlossariesResponse} ListGlossariesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGlossariesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGlossariesResponse message. + * @function verify + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGlossariesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!Array.isArray(message.glossaries)) + return "glossaries: array expected"; + for (var i = 0; i < message.glossaries.length; ++i) { + var error = $root.google.cloud.translation.v3beta1.Glossary.verify(message.glossaries[i]); + if (error) + return "glossaries." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListGlossariesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.ListGlossariesResponse} ListGlossariesResponse + */ + ListGlossariesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.ListGlossariesResponse) + return object; + var message = new $root.google.cloud.translation.v3beta1.ListGlossariesResponse(); + if (object.glossaries) { + if (!Array.isArray(object.glossaries)) + throw TypeError(".google.cloud.translation.v3beta1.ListGlossariesResponse.glossaries: array expected"); + message.glossaries = []; + for (var i = 0; i < object.glossaries.length; ++i) { + if (typeof object.glossaries[i] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.ListGlossariesResponse.glossaries: object expected"); + message.glossaries[i] = $root.google.cloud.translation.v3beta1.Glossary.fromObject(object.glossaries[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListGlossariesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {google.cloud.translation.v3beta1.ListGlossariesResponse} message ListGlossariesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGlossariesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.glossaries = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.glossaries && message.glossaries.length) { + object.glossaries = []; + for (var j = 0; j < message.glossaries.length; ++j) + object.glossaries[j] = $root.google.cloud.translation.v3beta1.Glossary.toObject(message.glossaries[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListGlossariesResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @instance + * @returns {Object.} JSON object + */ + ListGlossariesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGlossariesResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.ListGlossariesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGlossariesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.ListGlossariesResponse"; + }; + + return ListGlossariesResponse; + })(); + + v3beta1.CreateGlossaryMetadata = (function() { + + /** + * Properties of a CreateGlossaryMetadata. + * @memberof google.cloud.translation.v3beta1 + * @interface ICreateGlossaryMetadata + * @property {string|null} [name] CreateGlossaryMetadata name + * @property {google.cloud.translation.v3beta1.CreateGlossaryMetadata.State|null} [state] CreateGlossaryMetadata state + * @property {google.protobuf.ITimestamp|null} [submitTime] CreateGlossaryMetadata submitTime + */ + + /** + * Constructs a new CreateGlossaryMetadata. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a CreateGlossaryMetadata. + * @implements ICreateGlossaryMetadata + * @constructor + * @param {google.cloud.translation.v3beta1.ICreateGlossaryMetadata=} [properties] Properties to set + */ + function CreateGlossaryMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateGlossaryMetadata name. + * @member {string} name + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @instance + */ + CreateGlossaryMetadata.prototype.name = ""; + + /** + * CreateGlossaryMetadata state. + * @member {google.cloud.translation.v3beta1.CreateGlossaryMetadata.State} state + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @instance + */ + CreateGlossaryMetadata.prototype.state = 0; + + /** + * CreateGlossaryMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @instance + */ + CreateGlossaryMetadata.prototype.submitTime = null; + + /** + * Creates a new CreateGlossaryMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.ICreateGlossaryMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.CreateGlossaryMetadata} CreateGlossaryMetadata instance + */ + CreateGlossaryMetadata.create = function create(properties) { + return new CreateGlossaryMetadata(properties); + }; + + /** + * Encodes the specified CreateGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryMetadata.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.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.CreateGlossaryMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.ICreateGlossaryMetadata} message CreateGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.CreateGlossaryMetadata} CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.CreateGlossaryMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateGlossaryMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.CreateGlossaryMetadata} CreateGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateGlossaryMetadata message. + * @function verify + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateGlossaryMetadata.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.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.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a CreateGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.CreateGlossaryMetadata} CreateGlossaryMetadata + */ + CreateGlossaryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.CreateGlossaryMetadata) + return object; + var message = new $root.google.cloud.translation.v3beta1.CreateGlossaryMetadata(); + if (object.name != null) + message.name = String(object.name); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.CreateGlossaryMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a CreateGlossaryMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.CreateGlossaryMetadata} message CreateGlossaryMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateGlossaryMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.submitTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3beta1.CreateGlossaryMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3beta1.CreateGlossaryMetadata.State[message.state] : message.state; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this CreateGlossaryMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateGlossaryMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateGlossaryMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.CreateGlossaryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateGlossaryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.CreateGlossaryMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3beta1.CreateGlossaryMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + CreateGlossaryMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return CreateGlossaryMetadata; + })(); + + v3beta1.DeleteGlossaryMetadata = (function() { + + /** + * Properties of a DeleteGlossaryMetadata. + * @memberof google.cloud.translation.v3beta1 + * @interface IDeleteGlossaryMetadata + * @property {string|null} [name] DeleteGlossaryMetadata name + * @property {google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State|null} [state] DeleteGlossaryMetadata state + * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryMetadata submitTime + */ + + /** + * Constructs a new DeleteGlossaryMetadata. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DeleteGlossaryMetadata. + * @implements IDeleteGlossaryMetadata + * @constructor + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryMetadata=} [properties] Properties to set + */ + function DeleteGlossaryMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteGlossaryMetadata name. + * @member {string} name + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.name = ""; + + /** + * DeleteGlossaryMetadata state. + * @member {google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State} state + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.state = 0; + + /** + * DeleteGlossaryMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @instance + */ + DeleteGlossaryMetadata.prototype.submitTime = null; + + /** + * Creates a new DeleteGlossaryMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryMetadata} DeleteGlossaryMetadata instance + */ + DeleteGlossaryMetadata.create = function create(properties) { + return new DeleteGlossaryMetadata(properties); + }; + + /** + * Encodes the specified DeleteGlossaryMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryMetadata.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.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteGlossaryMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryMetadata} message DeleteGlossaryMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryMetadata} DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.DeleteGlossaryMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteGlossaryMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryMetadata} DeleteGlossaryMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGlossaryMetadata message. + * @function verify + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGlossaryMetadata.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.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.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a DeleteGlossaryMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryMetadata} DeleteGlossaryMetadata + */ + DeleteGlossaryMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DeleteGlossaryMetadata) + return object; + var message = new $root.google.cloud.translation.v3beta1.DeleteGlossaryMetadata(); + if (object.name != null) + message.name = String(object.name); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.DeleteGlossaryMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a DeleteGlossaryMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {google.cloud.translation.v3beta1.DeleteGlossaryMetadata} message DeleteGlossaryMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGlossaryMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.submitTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State[message.state] : message.state; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this DeleteGlossaryMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteGlossaryMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteGlossaryMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteGlossaryMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.DeleteGlossaryMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3beta1.DeleteGlossaryMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + DeleteGlossaryMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return DeleteGlossaryMetadata; + })(); + + v3beta1.DeleteGlossaryResponse = (function() { + + /** + * Properties of a DeleteGlossaryResponse. + * @memberof google.cloud.translation.v3beta1 + * @interface IDeleteGlossaryResponse + * @property {string|null} [name] DeleteGlossaryResponse name + * @property {google.protobuf.ITimestamp|null} [submitTime] DeleteGlossaryResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] DeleteGlossaryResponse endTime + */ + + /** + * Constructs a new DeleteGlossaryResponse. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a DeleteGlossaryResponse. + * @implements IDeleteGlossaryResponse + * @constructor + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryResponse=} [properties] Properties to set + */ + function DeleteGlossaryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteGlossaryResponse name. + * @member {string} name + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.name = ""; + + /** + * DeleteGlossaryResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.submitTime = null; + + /** + * DeleteGlossaryResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @instance + */ + DeleteGlossaryResponse.prototype.endTime = null; + + /** + * Creates a new DeleteGlossaryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryResponse} DeleteGlossaryResponse instance + */ + DeleteGlossaryResponse.create = function create(properties) { + return new DeleteGlossaryResponse(properties); + }; + + /** + * Encodes the specified DeleteGlossaryResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryResponse.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.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteGlossaryResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.DeleteGlossaryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3beta1.IDeleteGlossaryResponse} message DeleteGlossaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGlossaryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryResponse} DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.DeleteGlossaryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteGlossaryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryResponse} DeleteGlossaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGlossaryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGlossaryResponse message. + * @function verify + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGlossaryResponse.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.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a DeleteGlossaryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.DeleteGlossaryResponse} DeleteGlossaryResponse + */ + DeleteGlossaryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.DeleteGlossaryResponse) + return object; + var message = new $root.google.cloud.translation.v3beta1.DeleteGlossaryResponse(); + if (object.name != null) + message.name = String(object.name); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.DeleteGlossaryResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.DeleteGlossaryResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a DeleteGlossaryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {google.cloud.translation.v3beta1.DeleteGlossaryResponse} message DeleteGlossaryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGlossaryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.submitTime = null; + object.endTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this DeleteGlossaryResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @instance + * @returns {Object.} JSON object + */ + DeleteGlossaryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteGlossaryResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.DeleteGlossaryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteGlossaryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.DeleteGlossaryResponse"; + }; + + return DeleteGlossaryResponse; + })(); + + v3beta1.BatchTranslateDocumentRequest = (function() { + + /** + * Properties of a BatchTranslateDocumentRequest. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchTranslateDocumentRequest + * @property {string|null} [parent] BatchTranslateDocumentRequest parent + * @property {string|null} [sourceLanguageCode] BatchTranslateDocumentRequest sourceLanguageCode + * @property {Array.|null} [targetLanguageCodes] BatchTranslateDocumentRequest targetLanguageCodes + * @property {Array.|null} [inputConfigs] BatchTranslateDocumentRequest inputConfigs + * @property {google.cloud.translation.v3beta1.IBatchDocumentOutputConfig|null} [outputConfig] BatchTranslateDocumentRequest outputConfig + * @property {Object.|null} [models] BatchTranslateDocumentRequest models + * @property {Object.|null} [glossaries] BatchTranslateDocumentRequest glossaries + * @property {Object.|null} [formatConversions] BatchTranslateDocumentRequest formatConversions + */ + + /** + * Constructs a new BatchTranslateDocumentRequest. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchTranslateDocumentRequest. + * @implements IBatchTranslateDocumentRequest + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest=} [properties] Properties to set + */ + function BatchTranslateDocumentRequest(properties) { + this.targetLanguageCodes = []; + this.inputConfigs = []; + this.models = {}; + this.glossaries = {}; + this.formatConversions = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.parent = ""; + + /** + * BatchTranslateDocumentRequest sourceLanguageCode. + * @member {string} sourceLanguageCode + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.sourceLanguageCode = ""; + + /** + * BatchTranslateDocumentRequest targetLanguageCodes. + * @member {Array.} targetLanguageCodes + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.targetLanguageCodes = $util.emptyArray; + + /** + * BatchTranslateDocumentRequest inputConfigs. + * @member {Array.} inputConfigs + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.inputConfigs = $util.emptyArray; + + /** + * BatchTranslateDocumentRequest outputConfig. + * @member {google.cloud.translation.v3beta1.IBatchDocumentOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.outputConfig = null; + + /** + * BatchTranslateDocumentRequest models. + * @member {Object.} models + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.models = $util.emptyObject; + + /** + * BatchTranslateDocumentRequest glossaries. + * @member {Object.} glossaries + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.glossaries = $util.emptyObject; + + /** + * BatchTranslateDocumentRequest formatConversions. + * @member {Object.} formatConversions + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.formatConversions = $util.emptyObject; + + /** + * Creates a new BatchTranslateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest instance + */ + BatchTranslateDocumentRequest.create = function create(properties) { + return new BatchTranslateDocumentRequest(properties); + }; + + /** + * Encodes the specified BatchTranslateDocumentRequest message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest} message BatchTranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentRequest.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.sourceLanguageCode != null && Object.hasOwnProperty.call(message, "sourceLanguageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceLanguageCode); + if (message.targetLanguageCodes != null && message.targetLanguageCodes.length) + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetLanguageCodes[i]); + if (message.inputConfigs != null && message.inputConfigs.length) + for (var i = 0; i < message.inputConfigs.length; ++i) + $root.google.cloud.translation.v3beta1.BatchDocumentInputConfig.encode(message.inputConfigs[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig.encode(message.outputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.models != null && Object.hasOwnProperty.call(message, "models")) + for (var keys = Object.keys(message.models), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.models[keys[i]]).ldelim(); + if (message.glossaries != null && Object.hasOwnProperty.call(message, "glossaries")) + for (var keys = Object.keys(message.glossaries), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.encode(message.glossaries[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.formatConversions != null && Object.hasOwnProperty.call(message, "formatConversions")) + for (var keys = Object.keys(message.formatConversions), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.formatConversions[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest} message BatchTranslateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sourceLanguageCode = reader.string(); + break; + } + case 3: { + if (!(message.targetLanguageCodes && message.targetLanguageCodes.length)) + message.targetLanguageCodes = []; + message.targetLanguageCodes.push(reader.string()); + break; + } + case 4: { + if (!(message.inputConfigs && message.inputConfigs.length)) + message.inputConfigs = []; + message.inputConfigs.push($root.google.cloud.translation.v3beta1.BatchDocumentInputConfig.decode(reader, reader.uint32())); + break; + } + case 5: { + message.outputConfig = $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + if (message.models === $util.emptyObject) + message.models = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.models[key] = value; + break; + } + case 7: { + if (message.glossaries === $util.emptyObject) + message.glossaries = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.glossaries[key] = value; + break; + } + case 8: { + if (message.formatConversions === $util.emptyObject) + message.formatConversions = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.formatConversions[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateDocumentRequest message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateDocumentRequest.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.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + if (!$util.isString(message.sourceLanguageCode)) + return "sourceLanguageCode: string expected"; + if (message.targetLanguageCodes != null && message.hasOwnProperty("targetLanguageCodes")) { + if (!Array.isArray(message.targetLanguageCodes)) + return "targetLanguageCodes: array expected"; + for (var i = 0; i < message.targetLanguageCodes.length; ++i) + if (!$util.isString(message.targetLanguageCodes[i])) + return "targetLanguageCodes: 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.translation.v3beta1.BatchDocumentInputConfig.verify(message.inputConfigs[i]); + if (error) + return "inputConfigs." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + if (message.models != null && message.hasOwnProperty("models")) { + if (!$util.isObject(message.models)) + return "models: object expected"; + var key = Object.keys(message.models); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.models[key[i]])) + return "models: string{k:string} expected"; + } + if (message.glossaries != null && message.hasOwnProperty("glossaries")) { + if (!$util.isObject(message.glossaries)) + return "glossaries: object expected"; + var key = Object.keys(message.glossaries); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.verify(message.glossaries[key[i]]); + if (error) + return "glossaries." + error; + } + } + if (message.formatConversions != null && message.hasOwnProperty("formatConversions")) { + if (!$util.isObject(message.formatConversions)) + return "formatConversions: object expected"; + var key = Object.keys(message.formatConversions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.formatConversions[key[i]])) + return "formatConversions: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a BatchTranslateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentRequest} BatchTranslateDocumentRequest + */ + BatchTranslateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sourceLanguageCode != null) + message.sourceLanguageCode = String(object.sourceLanguageCode); + if (object.targetLanguageCodes) { + if (!Array.isArray(object.targetLanguageCodes)) + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.targetLanguageCodes: array expected"); + message.targetLanguageCodes = []; + for (var i = 0; i < object.targetLanguageCodes.length; ++i) + message.targetLanguageCodes[i] = String(object.targetLanguageCodes[i]); + } + if (object.inputConfigs) { + if (!Array.isArray(object.inputConfigs)) + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.inputConfigs: array expected"); + message.inputConfigs = []; + for (var i = 0; i < object.inputConfigs.length; ++i) { + if (typeof object.inputConfigs[i] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.inputConfigs: object expected"); + message.inputConfigs[i] = $root.google.cloud.translation.v3beta1.BatchDocumentInputConfig.fromObject(object.inputConfigs[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig.fromObject(object.outputConfig); + } + if (object.models) { + if (typeof object.models !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.models: object expected"); + message.models = {}; + for (var keys = Object.keys(object.models), i = 0; i < keys.length; ++i) + message.models[keys[i]] = String(object.models[keys[i]]); + } + if (object.glossaries) { + if (typeof object.glossaries !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.glossaries: object expected"); + message.glossaries = {}; + for (var keys = Object.keys(object.glossaries), i = 0; i < keys.length; ++i) { + if (typeof object.glossaries[keys[i]] !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.glossaries: object expected"); + message.glossaries[keys[i]] = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.fromObject(object.glossaries[keys[i]]); + } + } + if (object.formatConversions) { + if (typeof object.formatConversions !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentRequest.formatConversions: object expected"); + message.formatConversions = {}; + for (var keys = Object.keys(object.formatConversions), i = 0; i < keys.length; ++i) + message.formatConversions[keys[i]] = String(object.formatConversions[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {google.cloud.translation.v3beta1.BatchTranslateDocumentRequest} message BatchTranslateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.targetLanguageCodes = []; + object.inputConfigs = []; + } + if (options.objects || options.defaults) { + object.models = {}; + object.glossaries = {}; + object.formatConversions = {}; + } + if (options.defaults) { + object.parent = ""; + object.sourceLanguageCode = ""; + object.outputConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sourceLanguageCode != null && message.hasOwnProperty("sourceLanguageCode")) + object.sourceLanguageCode = message.sourceLanguageCode; + if (message.targetLanguageCodes && message.targetLanguageCodes.length) { + object.targetLanguageCodes = []; + for (var j = 0; j < message.targetLanguageCodes.length; ++j) + object.targetLanguageCodes[j] = message.targetLanguageCodes[j]; + } + if (message.inputConfigs && message.inputConfigs.length) { + object.inputConfigs = []; + for (var j = 0; j < message.inputConfigs.length; ++j) + object.inputConfigs[j] = $root.google.cloud.translation.v3beta1.BatchDocumentInputConfig.toObject(message.inputConfigs[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig.toObject(message.outputConfig, options); + var keys2; + if (message.models && (keys2 = Object.keys(message.models)).length) { + object.models = {}; + for (var j = 0; j < keys2.length; ++j) + object.models[keys2[j]] = message.models[keys2[j]]; + } + if (message.glossaries && (keys2 = Object.keys(message.glossaries)).length) { + object.glossaries = {}; + for (var j = 0; j < keys2.length; ++j) + object.glossaries[keys2[j]] = $root.google.cloud.translation.v3beta1.TranslateTextGlossaryConfig.toObject(message.glossaries[keys2[j]], options); + } + if (message.formatConversions && (keys2 = Object.keys(message.formatConversions)).length) { + object.formatConversions = {}; + for (var j = 0; j < keys2.length; ++j) + object.formatConversions[keys2[j]] = message.formatConversions[keys2[j]]; + } + return object; + }; + + /** + * Converts this BatchTranslateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchTranslateDocumentRequest"; + }; + + return BatchTranslateDocumentRequest; + })(); + + v3beta1.BatchDocumentInputConfig = (function() { + + /** + * Properties of a BatchDocumentInputConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchDocumentInputConfig + * @property {google.cloud.translation.v3beta1.IGcsSource|null} [gcsSource] BatchDocumentInputConfig gcsSource + */ + + /** + * Constructs a new BatchDocumentInputConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchDocumentInputConfig. + * @implements IBatchDocumentInputConfig + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchDocumentInputConfig=} [properties] Properties to set + */ + function BatchDocumentInputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDocumentInputConfig gcsSource. + * @member {google.cloud.translation.v3beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @instance + */ + BatchDocumentInputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchDocumentInputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @instance + */ + Object.defineProperty(BatchDocumentInputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchDocumentInputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IBatchDocumentInputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchDocumentInputConfig} BatchDocumentInputConfig instance + */ + BatchDocumentInputConfig.create = function create(properties) { + return new BatchDocumentInputConfig(properties); + }; + + /** + * Encodes the specified BatchDocumentInputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentInputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IBatchDocumentInputConfig} message BatchDocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentInputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.translation.v3beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDocumentInputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentInputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.IBatchDocumentInputConfig} message BatchDocumentInputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentInputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchDocumentInputConfig} BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentInputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchDocumentInputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDocumentInputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchDocumentInputConfig} BatchDocumentInputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentInputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDocumentInputConfig message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDocumentInputConfig.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.translation.v3beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates a BatchDocumentInputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchDocumentInputConfig} BatchDocumentInputConfig + */ + BatchDocumentInputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchDocumentInputConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchDocumentInputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchDocumentInputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from a BatchDocumentInputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {google.cloud.translation.v3beta1.BatchDocumentInputConfig} message BatchDocumentInputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDocumentInputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.translation.v3beta1.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this BatchDocumentInputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchDocumentInputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDocumentInputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchDocumentInputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDocumentInputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchDocumentInputConfig"; + }; + + return BatchDocumentInputConfig; + })(); + + v3beta1.BatchDocumentOutputConfig = (function() { + + /** + * Properties of a BatchDocumentOutputConfig. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchDocumentOutputConfig + * @property {google.cloud.translation.v3beta1.IGcsDestination|null} [gcsDestination] BatchDocumentOutputConfig gcsDestination + */ + + /** + * Constructs a new BatchDocumentOutputConfig. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchDocumentOutputConfig. + * @implements IBatchDocumentOutputConfig + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchDocumentOutputConfig=} [properties] Properties to set + */ + function BatchDocumentOutputConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDocumentOutputConfig gcsDestination. + * @member {google.cloud.translation.v3beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @instance + */ + BatchDocumentOutputConfig.prototype.gcsDestination = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchDocumentOutputConfig destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @instance + */ + Object.defineProperty(BatchDocumentOutputConfig.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchDocumentOutputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.IBatchDocumentOutputConfig=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchDocumentOutputConfig} BatchDocumentOutputConfig instance + */ + BatchDocumentOutputConfig.create = function create(properties) { + return new BatchDocumentOutputConfig(properties); + }; + + /** + * Encodes the specified BatchDocumentOutputConfig message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentOutputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.IBatchDocumentOutputConfig} message BatchDocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentOutputConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.translation.v3beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDocumentOutputConfig message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchDocumentOutputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.IBatchDocumentOutputConfig} message BatchDocumentOutputConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDocumentOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchDocumentOutputConfig} BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentOutputConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDocumentOutputConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchDocumentOutputConfig} BatchDocumentOutputConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDocumentOutputConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDocumentOutputConfig message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDocumentOutputConfig.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.translation.v3beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + return null; + }; + + /** + * Creates a BatchDocumentOutputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchDocumentOutputConfig} BatchDocumentOutputConfig + */ + BatchDocumentOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchDocumentOutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchDocumentOutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.fromObject(object.gcsDestination); + } + return message; + }; + + /** + * Creates a plain object from a BatchDocumentOutputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {google.cloud.translation.v3beta1.BatchDocumentOutputConfig} message BatchDocumentOutputConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDocumentOutputConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.translation.v3beta1.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + return object; + }; + + /** + * Converts this BatchDocumentOutputConfig to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @instance + * @returns {Object.} JSON object + */ + BatchDocumentOutputConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDocumentOutputConfig + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchDocumentOutputConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDocumentOutputConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchDocumentOutputConfig"; + }; + + return BatchDocumentOutputConfig; + })(); + + v3beta1.BatchTranslateDocumentResponse = (function() { + + /** + * Properties of a BatchTranslateDocumentResponse. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchTranslateDocumentResponse + * @property {number|Long|null} [totalPages] BatchTranslateDocumentResponse totalPages + * @property {number|Long|null} [translatedPages] BatchTranslateDocumentResponse translatedPages + * @property {number|Long|null} [failedPages] BatchTranslateDocumentResponse failedPages + * @property {number|Long|null} [totalBillablePages] BatchTranslateDocumentResponse totalBillablePages + * @property {number|Long|null} [totalCharacters] BatchTranslateDocumentResponse totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateDocumentResponse translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateDocumentResponse failedCharacters + * @property {number|Long|null} [totalBillableCharacters] BatchTranslateDocumentResponse totalBillableCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateDocumentResponse submitTime + * @property {google.protobuf.ITimestamp|null} [endTime] BatchTranslateDocumentResponse endTime + */ + + /** + * Constructs a new BatchTranslateDocumentResponse. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchTranslateDocumentResponse. + * @implements IBatchTranslateDocumentResponse + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse=} [properties] Properties to set + */ + function BatchTranslateDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateDocumentResponse totalPages. + * @member {number|Long} totalPages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse translatedPages. + * @member {number|Long} translatedPages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.translatedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse failedPages. + * @member {number|Long} failedPages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.failedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalBillablePages. + * @member {number|Long} totalBillablePages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalBillablePages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse totalBillableCharacters. + * @member {number|Long} totalBillableCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.totalBillableCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentResponse submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.submitTime = null; + + /** + * BatchTranslateDocumentResponse endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + */ + BatchTranslateDocumentResponse.prototype.endTime = null; + + /** + * Creates a new BatchTranslateDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse instance + */ + BatchTranslateDocumentResponse.create = function create(properties) { + return new BatchTranslateDocumentResponse(properties); + }; + + /** + * Encodes the specified BatchTranslateDocumentResponse message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse} message BatchTranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.totalPages != null && Object.hasOwnProperty.call(message, "totalPages")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.totalPages); + if (message.translatedPages != null && Object.hasOwnProperty.call(message, "translatedPages")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.translatedPages); + if (message.failedPages != null && Object.hasOwnProperty.call(message, "failedPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedPages); + if (message.totalBillablePages != null && Object.hasOwnProperty.call(message, "totalBillablePages")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalBillablePages); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.failedCharacters); + if (message.totalBillableCharacters != null && Object.hasOwnProperty.call(message, "totalBillableCharacters")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.totalBillableCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse} message BatchTranslateDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchTranslateDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.totalPages = reader.int64(); + break; + } + case 2: { + message.translatedPages = reader.int64(); + break; + } + case 3: { + message.failedPages = reader.int64(); + break; + } + case 4: { + message.totalBillablePages = reader.int64(); + break; + } + case 5: { + message.totalCharacters = reader.int64(); + break; + } + case 6: { + message.translatedCharacters = reader.int64(); + break; + } + case 7: { + message.failedCharacters = reader.int64(); + break; + } + case 8: { + message.totalBillableCharacters = reader.int64(); + break; + } + case 9: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 10: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateDocumentResponse message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages) && !(message.totalPages && $util.isInteger(message.totalPages.low) && $util.isInteger(message.totalPages.high))) + return "totalPages: integer|Long expected"; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (!$util.isInteger(message.translatedPages) && !(message.translatedPages && $util.isInteger(message.translatedPages.low) && $util.isInteger(message.translatedPages.high))) + return "translatedPages: integer|Long expected"; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (!$util.isInteger(message.failedPages) && !(message.failedPages && $util.isInteger(message.failedPages.low) && $util.isInteger(message.failedPages.high))) + return "failedPages: integer|Long expected"; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (!$util.isInteger(message.totalBillablePages) && !(message.totalBillablePages && $util.isInteger(message.totalBillablePages.low) && $util.isInteger(message.totalBillablePages.high))) + return "totalBillablePages: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (!$util.isInteger(message.totalBillableCharacters) && !(message.totalBillableCharacters && $util.isInteger(message.totalBillableCharacters.low) && $util.isInteger(message.totalBillableCharacters.high))) + return "totalBillableCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentResponse} BatchTranslateDocumentResponse + */ + BatchTranslateDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchTranslateDocumentResponse) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchTranslateDocumentResponse(); + if (object.totalPages != null) + if ($util.Long) + (message.totalPages = $util.Long.fromValue(object.totalPages)).unsigned = false; + else if (typeof object.totalPages === "string") + message.totalPages = parseInt(object.totalPages, 10); + else if (typeof object.totalPages === "number") + message.totalPages = object.totalPages; + else if (typeof object.totalPages === "object") + message.totalPages = new $util.LongBits(object.totalPages.low >>> 0, object.totalPages.high >>> 0).toNumber(); + if (object.translatedPages != null) + if ($util.Long) + (message.translatedPages = $util.Long.fromValue(object.translatedPages)).unsigned = false; + else if (typeof object.translatedPages === "string") + message.translatedPages = parseInt(object.translatedPages, 10); + else if (typeof object.translatedPages === "number") + message.translatedPages = object.translatedPages; + else if (typeof object.translatedPages === "object") + message.translatedPages = new $util.LongBits(object.translatedPages.low >>> 0, object.translatedPages.high >>> 0).toNumber(); + if (object.failedPages != null) + if ($util.Long) + (message.failedPages = $util.Long.fromValue(object.failedPages)).unsigned = false; + else if (typeof object.failedPages === "string") + message.failedPages = parseInt(object.failedPages, 10); + else if (typeof object.failedPages === "number") + message.failedPages = object.failedPages; + else if (typeof object.failedPages === "object") + message.failedPages = new $util.LongBits(object.failedPages.low >>> 0, object.failedPages.high >>> 0).toNumber(); + if (object.totalBillablePages != null) + if ($util.Long) + (message.totalBillablePages = $util.Long.fromValue(object.totalBillablePages)).unsigned = false; + else if (typeof object.totalBillablePages === "string") + message.totalBillablePages = parseInt(object.totalBillablePages, 10); + else if (typeof object.totalBillablePages === "number") + message.totalBillablePages = object.totalBillablePages; + else if (typeof object.totalBillablePages === "object") + message.totalBillablePages = new $util.LongBits(object.totalBillablePages.low >>> 0, object.totalBillablePages.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalBillableCharacters != null) + if ($util.Long) + (message.totalBillableCharacters = $util.Long.fromValue(object.totalBillableCharacters)).unsigned = false; + else if (typeof object.totalBillableCharacters === "string") + message.totalBillableCharacters = parseInt(object.totalBillableCharacters, 10); + else if (typeof object.totalBillableCharacters === "number") + message.totalBillableCharacters = object.totalBillableCharacters; + else if (typeof object.totalBillableCharacters === "object") + message.totalBillableCharacters = new $util.LongBits(object.totalBillableCharacters.low >>> 0, object.totalBillableCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentResponse.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentResponse.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {google.cloud.translation.v3beta1.BatchTranslateDocumentResponse} message BatchTranslateDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateDocumentResponse.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.totalPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillablePages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillablePages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillableCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillableCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + object.endTime = null; + } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (typeof message.totalPages === "number") + object.totalPages = options.longs === String ? String(message.totalPages) : message.totalPages; + else + object.totalPages = options.longs === String ? $util.Long.prototype.toString.call(message.totalPages) : options.longs === Number ? new $util.LongBits(message.totalPages.low >>> 0, message.totalPages.high >>> 0).toNumber() : message.totalPages; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (typeof message.translatedPages === "number") + object.translatedPages = options.longs === String ? String(message.translatedPages) : message.translatedPages; + else + object.translatedPages = options.longs === String ? $util.Long.prototype.toString.call(message.translatedPages) : options.longs === Number ? new $util.LongBits(message.translatedPages.low >>> 0, message.translatedPages.high >>> 0).toNumber() : message.translatedPages; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (typeof message.failedPages === "number") + object.failedPages = options.longs === String ? String(message.failedPages) : message.failedPages; + else + object.failedPages = options.longs === String ? $util.Long.prototype.toString.call(message.failedPages) : options.longs === Number ? new $util.LongBits(message.failedPages.low >>> 0, message.failedPages.high >>> 0).toNumber() : message.failedPages; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (typeof message.totalBillablePages === "number") + object.totalBillablePages = options.longs === String ? String(message.totalBillablePages) : message.totalBillablePages; + else + object.totalBillablePages = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillablePages) : options.longs === Number ? new $util.LongBits(message.totalBillablePages.low >>> 0, message.totalBillablePages.high >>> 0).toNumber() : message.totalBillablePages; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (typeof message.totalBillableCharacters === "number") + object.totalBillableCharacters = options.longs === String ? String(message.totalBillableCharacters) : message.totalBillableCharacters; + else + object.totalBillableCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillableCharacters) : options.longs === Number ? new $util.LongBits(message.totalBillableCharacters.low >>> 0, message.totalBillableCharacters.high >>> 0).toNumber() : message.totalBillableCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this BatchTranslateDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchTranslateDocumentResponse"; + }; + + return BatchTranslateDocumentResponse; + })(); + + v3beta1.BatchTranslateDocumentMetadata = (function() { + + /** + * Properties of a BatchTranslateDocumentMetadata. + * @memberof google.cloud.translation.v3beta1 + * @interface IBatchTranslateDocumentMetadata + * @property {google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State|null} [state] BatchTranslateDocumentMetadata state + * @property {number|Long|null} [totalPages] BatchTranslateDocumentMetadata totalPages + * @property {number|Long|null} [translatedPages] BatchTranslateDocumentMetadata translatedPages + * @property {number|Long|null} [failedPages] BatchTranslateDocumentMetadata failedPages + * @property {number|Long|null} [totalBillablePages] BatchTranslateDocumentMetadata totalBillablePages + * @property {number|Long|null} [totalCharacters] BatchTranslateDocumentMetadata totalCharacters + * @property {number|Long|null} [translatedCharacters] BatchTranslateDocumentMetadata translatedCharacters + * @property {number|Long|null} [failedCharacters] BatchTranslateDocumentMetadata failedCharacters + * @property {number|Long|null} [totalBillableCharacters] BatchTranslateDocumentMetadata totalBillableCharacters + * @property {google.protobuf.ITimestamp|null} [submitTime] BatchTranslateDocumentMetadata submitTime + */ + + /** + * Constructs a new BatchTranslateDocumentMetadata. + * @memberof google.cloud.translation.v3beta1 + * @classdesc Represents a BatchTranslateDocumentMetadata. + * @implements IBatchTranslateDocumentMetadata + * @constructor + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata=} [properties] Properties to set + */ + function BatchTranslateDocumentMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchTranslateDocumentMetadata state. + * @member {google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State} state + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.state = 0; + + /** + * BatchTranslateDocumentMetadata totalPages. + * @member {number|Long} totalPages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata translatedPages. + * @member {number|Long} translatedPages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.translatedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata failedPages. + * @member {number|Long} failedPages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.failedPages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalBillablePages. + * @member {number|Long} totalBillablePages + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalBillablePages = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalCharacters. + * @member {number|Long} totalCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata translatedCharacters. + * @member {number|Long} translatedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.translatedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata failedCharacters. + * @member {number|Long} failedCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.failedCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata totalBillableCharacters. + * @member {number|Long} totalBillableCharacters + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.totalBillableCharacters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BatchTranslateDocumentMetadata submitTime. + * @member {google.protobuf.ITimestamp|null|undefined} submitTime + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + */ + BatchTranslateDocumentMetadata.prototype.submitTime = null; + + /** + * Creates a new BatchTranslateDocumentMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata=} [properties] Properties to set + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata instance + */ + BatchTranslateDocumentMetadata.create = function create(properties) { + return new BatchTranslateDocumentMetadata(properties); + }; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentMetadata.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.totalPages != null && Object.hasOwnProperty.call(message, "totalPages")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.totalPages); + if (message.translatedPages != null && Object.hasOwnProperty.call(message, "translatedPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.translatedPages); + if (message.failedPages != null && Object.hasOwnProperty.call(message, "failedPages")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.failedPages); + if (message.totalBillablePages != null && Object.hasOwnProperty.call(message, "totalBillablePages")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.totalBillablePages); + if (message.totalCharacters != null && Object.hasOwnProperty.call(message, "totalCharacters")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.totalCharacters); + if (message.translatedCharacters != null && Object.hasOwnProperty.call(message, "translatedCharacters")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.translatedCharacters); + if (message.failedCharacters != null && Object.hasOwnProperty.call(message, "failedCharacters")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.failedCharacters); + if (message.totalBillableCharacters != null && Object.hasOwnProperty.call(message, "totalBillableCharacters")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.totalBillableCharacters); + if (message.submitTime != null && Object.hasOwnProperty.call(message, "submitTime")) + $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchTranslateDocumentMetadata message, length delimited. Does not implicitly {@link google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchTranslateDocumentMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.totalPages = reader.int64(); + break; + } + case 3: { + message.translatedPages = reader.int64(); + break; + } + case 4: { + message.failedPages = reader.int64(); + break; + } + case 5: { + message.totalBillablePages = reader.int64(); + break; + } + case 6: { + message.totalCharacters = reader.int64(); + break; + } + case 7: { + message.translatedCharacters = reader.int64(); + break; + } + case 8: { + message.failedCharacters = reader.int64(); + break; + } + case 9: { + message.totalBillableCharacters = reader.int64(); + break; + } + case 10: { + message.submitTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchTranslateDocumentMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchTranslateDocumentMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchTranslateDocumentMetadata message. + * @function verify + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchTranslateDocumentMetadata.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.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages) && !(message.totalPages && $util.isInteger(message.totalPages.low) && $util.isInteger(message.totalPages.high))) + return "totalPages: integer|Long expected"; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (!$util.isInteger(message.translatedPages) && !(message.translatedPages && $util.isInteger(message.translatedPages.low) && $util.isInteger(message.translatedPages.high))) + return "translatedPages: integer|Long expected"; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (!$util.isInteger(message.failedPages) && !(message.failedPages && $util.isInteger(message.failedPages.low) && $util.isInteger(message.failedPages.high))) + return "failedPages: integer|Long expected"; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (!$util.isInteger(message.totalBillablePages) && !(message.totalBillablePages && $util.isInteger(message.totalBillablePages.low) && $util.isInteger(message.totalBillablePages.high))) + return "totalBillablePages: integer|Long expected"; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (!$util.isInteger(message.totalCharacters) && !(message.totalCharacters && $util.isInteger(message.totalCharacters.low) && $util.isInteger(message.totalCharacters.high))) + return "totalCharacters: integer|Long expected"; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (!$util.isInteger(message.translatedCharacters) && !(message.translatedCharacters && $util.isInteger(message.translatedCharacters.low) && $util.isInteger(message.translatedCharacters.high))) + return "translatedCharacters: integer|Long expected"; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (!$util.isInteger(message.failedCharacters) && !(message.failedCharacters && $util.isInteger(message.failedCharacters.low) && $util.isInteger(message.failedCharacters.high))) + return "failedCharacters: integer|Long expected"; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (!$util.isInteger(message.totalBillableCharacters) && !(message.totalBillableCharacters && $util.isInteger(message.totalBillableCharacters.low) && $util.isInteger(message.totalBillableCharacters.high))) + return "totalBillableCharacters: integer|Long expected"; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTime); + if (error) + return "submitTime." + error; + } + return null; + }; + + /** + * Creates a BatchTranslateDocumentMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata} BatchTranslateDocumentMetadata + */ + BatchTranslateDocumentMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata) + return object; + var message = new $root.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata(); + 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 "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLING": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.totalPages != null) + if ($util.Long) + (message.totalPages = $util.Long.fromValue(object.totalPages)).unsigned = false; + else if (typeof object.totalPages === "string") + message.totalPages = parseInt(object.totalPages, 10); + else if (typeof object.totalPages === "number") + message.totalPages = object.totalPages; + else if (typeof object.totalPages === "object") + message.totalPages = new $util.LongBits(object.totalPages.low >>> 0, object.totalPages.high >>> 0).toNumber(); + if (object.translatedPages != null) + if ($util.Long) + (message.translatedPages = $util.Long.fromValue(object.translatedPages)).unsigned = false; + else if (typeof object.translatedPages === "string") + message.translatedPages = parseInt(object.translatedPages, 10); + else if (typeof object.translatedPages === "number") + message.translatedPages = object.translatedPages; + else if (typeof object.translatedPages === "object") + message.translatedPages = new $util.LongBits(object.translatedPages.low >>> 0, object.translatedPages.high >>> 0).toNumber(); + if (object.failedPages != null) + if ($util.Long) + (message.failedPages = $util.Long.fromValue(object.failedPages)).unsigned = false; + else if (typeof object.failedPages === "string") + message.failedPages = parseInt(object.failedPages, 10); + else if (typeof object.failedPages === "number") + message.failedPages = object.failedPages; + else if (typeof object.failedPages === "object") + message.failedPages = new $util.LongBits(object.failedPages.low >>> 0, object.failedPages.high >>> 0).toNumber(); + if (object.totalBillablePages != null) + if ($util.Long) + (message.totalBillablePages = $util.Long.fromValue(object.totalBillablePages)).unsigned = false; + else if (typeof object.totalBillablePages === "string") + message.totalBillablePages = parseInt(object.totalBillablePages, 10); + else if (typeof object.totalBillablePages === "number") + message.totalBillablePages = object.totalBillablePages; + else if (typeof object.totalBillablePages === "object") + message.totalBillablePages = new $util.LongBits(object.totalBillablePages.low >>> 0, object.totalBillablePages.high >>> 0).toNumber(); + if (object.totalCharacters != null) + if ($util.Long) + (message.totalCharacters = $util.Long.fromValue(object.totalCharacters)).unsigned = false; + else if (typeof object.totalCharacters === "string") + message.totalCharacters = parseInt(object.totalCharacters, 10); + else if (typeof object.totalCharacters === "number") + message.totalCharacters = object.totalCharacters; + else if (typeof object.totalCharacters === "object") + message.totalCharacters = new $util.LongBits(object.totalCharacters.low >>> 0, object.totalCharacters.high >>> 0).toNumber(); + if (object.translatedCharacters != null) + if ($util.Long) + (message.translatedCharacters = $util.Long.fromValue(object.translatedCharacters)).unsigned = false; + else if (typeof object.translatedCharacters === "string") + message.translatedCharacters = parseInt(object.translatedCharacters, 10); + else if (typeof object.translatedCharacters === "number") + message.translatedCharacters = object.translatedCharacters; + else if (typeof object.translatedCharacters === "object") + message.translatedCharacters = new $util.LongBits(object.translatedCharacters.low >>> 0, object.translatedCharacters.high >>> 0).toNumber(); + if (object.failedCharacters != null) + if ($util.Long) + (message.failedCharacters = $util.Long.fromValue(object.failedCharacters)).unsigned = false; + else if (typeof object.failedCharacters === "string") + message.failedCharacters = parseInt(object.failedCharacters, 10); + else if (typeof object.failedCharacters === "number") + message.failedCharacters = object.failedCharacters; + else if (typeof object.failedCharacters === "object") + message.failedCharacters = new $util.LongBits(object.failedCharacters.low >>> 0, object.failedCharacters.high >>> 0).toNumber(); + if (object.totalBillableCharacters != null) + if ($util.Long) + (message.totalBillableCharacters = $util.Long.fromValue(object.totalBillableCharacters)).unsigned = false; + else if (typeof object.totalBillableCharacters === "string") + message.totalBillableCharacters = parseInt(object.totalBillableCharacters, 10); + else if (typeof object.totalBillableCharacters === "number") + message.totalBillableCharacters = object.totalBillableCharacters; + else if (typeof object.totalBillableCharacters === "object") + message.totalBillableCharacters = new $util.LongBits(object.totalBillableCharacters.low >>> 0, object.totalBillableCharacters.high >>> 0).toNumber(); + if (object.submitTime != null) { + if (typeof object.submitTime !== "object") + throw TypeError(".google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.submitTime: object expected"); + message.submitTime = $root.google.protobuf.Timestamp.fromObject(object.submitTime); + } + return message; + }; + + /** + * Creates a plain object from a BatchTranslateDocumentMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata} message BatchTranslateDocumentMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchTranslateDocumentMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedPages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedPages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillablePages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillablePages = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.translatedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.translatedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCharacters = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalBillableCharacters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalBillableCharacters = options.longs === String ? "0" : 0; + object.submitTime = null; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State[message.state] : message.state; + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (typeof message.totalPages === "number") + object.totalPages = options.longs === String ? String(message.totalPages) : message.totalPages; + else + object.totalPages = options.longs === String ? $util.Long.prototype.toString.call(message.totalPages) : options.longs === Number ? new $util.LongBits(message.totalPages.low >>> 0, message.totalPages.high >>> 0).toNumber() : message.totalPages; + if (message.translatedPages != null && message.hasOwnProperty("translatedPages")) + if (typeof message.translatedPages === "number") + object.translatedPages = options.longs === String ? String(message.translatedPages) : message.translatedPages; + else + object.translatedPages = options.longs === String ? $util.Long.prototype.toString.call(message.translatedPages) : options.longs === Number ? new $util.LongBits(message.translatedPages.low >>> 0, message.translatedPages.high >>> 0).toNumber() : message.translatedPages; + if (message.failedPages != null && message.hasOwnProperty("failedPages")) + if (typeof message.failedPages === "number") + object.failedPages = options.longs === String ? String(message.failedPages) : message.failedPages; + else + object.failedPages = options.longs === String ? $util.Long.prototype.toString.call(message.failedPages) : options.longs === Number ? new $util.LongBits(message.failedPages.low >>> 0, message.failedPages.high >>> 0).toNumber() : message.failedPages; + if (message.totalBillablePages != null && message.hasOwnProperty("totalBillablePages")) + if (typeof message.totalBillablePages === "number") + object.totalBillablePages = options.longs === String ? String(message.totalBillablePages) : message.totalBillablePages; + else + object.totalBillablePages = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillablePages) : options.longs === Number ? new $util.LongBits(message.totalBillablePages.low >>> 0, message.totalBillablePages.high >>> 0).toNumber() : message.totalBillablePages; + if (message.totalCharacters != null && message.hasOwnProperty("totalCharacters")) + if (typeof message.totalCharacters === "number") + object.totalCharacters = options.longs === String ? String(message.totalCharacters) : message.totalCharacters; + else + object.totalCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalCharacters) : options.longs === Number ? new $util.LongBits(message.totalCharacters.low >>> 0, message.totalCharacters.high >>> 0).toNumber() : message.totalCharacters; + if (message.translatedCharacters != null && message.hasOwnProperty("translatedCharacters")) + if (typeof message.translatedCharacters === "number") + object.translatedCharacters = options.longs === String ? String(message.translatedCharacters) : message.translatedCharacters; + else + object.translatedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.translatedCharacters) : options.longs === Number ? new $util.LongBits(message.translatedCharacters.low >>> 0, message.translatedCharacters.high >>> 0).toNumber() : message.translatedCharacters; + if (message.failedCharacters != null && message.hasOwnProperty("failedCharacters")) + if (typeof message.failedCharacters === "number") + object.failedCharacters = options.longs === String ? String(message.failedCharacters) : message.failedCharacters; + else + object.failedCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.failedCharacters) : options.longs === Number ? new $util.LongBits(message.failedCharacters.low >>> 0, message.failedCharacters.high >>> 0).toNumber() : message.failedCharacters; + if (message.totalBillableCharacters != null && message.hasOwnProperty("totalBillableCharacters")) + if (typeof message.totalBillableCharacters === "number") + object.totalBillableCharacters = options.longs === String ? String(message.totalBillableCharacters) : message.totalBillableCharacters; + else + object.totalBillableCharacters = options.longs === String ? $util.Long.prototype.toString.call(message.totalBillableCharacters) : options.longs === Number ? new $util.LongBits(message.totalBillableCharacters.low >>> 0, message.totalBillableCharacters.high >>> 0).toNumber() : message.totalBillableCharacters; + if (message.submitTime != null && message.hasOwnProperty("submitTime")) + object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); + return object; + }; + + /** + * Converts this BatchTranslateDocumentMetadata to JSON. + * @function toJSON + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @instance + * @returns {Object.} JSON object + */ + BatchTranslateDocumentMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchTranslateDocumentMetadata + * @function getTypeUrl + * @memberof google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchTranslateDocumentMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata"; + }; + + /** + * State enum. + * @name google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLING=4 CANCELLING value + * @property {number} CANCELLED=5 CANCELLED value + */ + BatchTranslateDocumentMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLING"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return BatchTranslateDocumentMetadata; + })(); + + return v3beta1; + })(); + + return translation; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * 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; + })(); + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a 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; + })(); + + 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.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.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.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + protobuf.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; + })(); + + return protobuf; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + + /** + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; + + /** + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Operations} RPC service. Useful where requests and/or responses are streamed. + */ + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse + */ + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Operations; + })(); + + longrunning.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response + */ + + /** + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.longrunning.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.metadata = null; + + /** + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.done = false; + + /** + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encode + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && 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; + })(); + + 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; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-translate/protos/protos.json b/packages/google-cloud-translate/protos/protos.json new file mode 100644 index 00000000000..d714fb7f191 --- /dev/null +++ b/packages/google-cloud-translate/protos/protos.json @@ -0,0 +1,3988 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "translation": { + "nested": { + "v3": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Translate.V3", + "go_package": "google.golang.org/genproto/googleapis/cloud/translate/v3;translate", + "java_multiple_files": true, + "java_outer_classname": "TranslationServiceProto", + "java_package": "com.google.cloud.translate.v3", + "php_namespace": "Google\\Cloud\\Translate\\V3", + "ruby_package": "Google::Cloud::Translate::V3" + }, + "nested": { + "TranslationService": { + "options": { + "(google.api.default_host)": "translate.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translation" + }, + "methods": { + "TranslateText": { + "requestType": "TranslateTextRequest", + "responseType": "TranslateTextResponse", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}:translateText", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v3/{parent=projects/*}:translateText", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,model,mime_type,source_language_code,target_language_code,contents" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}:translateText", + "body": "*", + "additional_bindings": { + "post": "/v3/{parent=projects/*}:translateText", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,target_language_code,contents" + }, + { + "(google.api.method_signature)": "parent,model,mime_type,source_language_code,target_language_code,contents" + } + ] + }, + "DetectLanguage": { + "requestType": "DetectLanguageRequest", + "responseType": "DetectLanguageResponse", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}:detectLanguage", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v3/{parent=projects/*}:detectLanguage", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,model,mime_type,content" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}:detectLanguage", + "body": "*", + "additional_bindings": { + "post": "/v3/{parent=projects/*}:detectLanguage", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,model,mime_type,content" + } + ] + }, + "GetSupportedLanguages": { + "requestType": "GetSupportedLanguagesRequest", + "responseType": "SupportedLanguages", + "options": { + "(google.api.http).get": "/v3/{parent=projects/*/locations/*}/supportedLanguages", + "(google.api.http).additional_bindings.get": "/v3/{parent=projects/*}/supportedLanguages", + "(google.api.method_signature)": "parent,model,display_language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{parent=projects/*/locations/*}/supportedLanguages", + "additional_bindings": { + "get": "/v3/{parent=projects/*}/supportedLanguages" + } + } + }, + { + "(google.api.method_signature)": "parent,model,display_language_code" + } + ] + }, + "TranslateDocument": { + "requestType": "TranslateDocumentRequest", + "responseType": "TranslateDocumentResponse", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}:translateDocument", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}:translateDocument", + "body": "*" + } + } + ] + }, + "BatchTranslateText": { + "requestType": "BatchTranslateTextRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}:batchTranslateText", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "BatchTranslateResponse", + "(google.longrunning.operation_info).metadata_type": "BatchTranslateMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}:batchTranslateText", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchTranslateResponse", + "metadata_type": "BatchTranslateMetadata" + } + } + ] + }, + "BatchTranslateDocument": { + "requestType": "BatchTranslateDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}:batchTranslateDocument", + "(google.api.http).body": "*", + "(google.api.method_signature)": "parent,source_language_code,target_language_codes,input_configs,output_config", + "(google.longrunning.operation_info).response_type": "BatchTranslateDocumentResponse", + "(google.longrunning.operation_info).metadata_type": "BatchTranslateDocumentMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}:batchTranslateDocument", + "body": "*" + } + }, + { + "(google.api.method_signature)": "parent,source_language_code,target_language_codes,input_configs,output_config" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchTranslateDocumentResponse", + "metadata_type": "BatchTranslateDocumentMetadata" + } + } + ] + }, + "CreateGlossary": { + "requestType": "CreateGlossaryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*/locations/*}/glossaries", + "(google.api.http).body": "glossary", + "(google.api.method_signature)": "parent,glossary", + "(google.longrunning.operation_info).response_type": "Glossary", + "(google.longrunning.operation_info).metadata_type": "CreateGlossaryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*/locations/*}/glossaries", + "body": "glossary" + } + }, + { + "(google.api.method_signature)": "parent,glossary" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Glossary", + "metadata_type": "CreateGlossaryMetadata" + } + } + ] + }, + "ListGlossaries": { + "requestType": "ListGlossariesRequest", + "responseType": "ListGlossariesResponse", + "options": { + "(google.api.http).get": "/v3/{parent=projects/*/locations/*}/glossaries", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{parent=projects/*/locations/*}/glossaries" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetGlossary": { + "requestType": "GetGlossaryRequest", + "responseType": "Glossary", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/locations/*/glossaries/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/locations/*/glossaries/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteGlossary": { + "requestType": "DeleteGlossaryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v3/{name=projects/*/locations/*/glossaries/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "DeleteGlossaryResponse", + "(google.longrunning.operation_info).metadata_type": "DeleteGlossaryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=projects/*/locations/*/glossaries/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "DeleteGlossaryResponse", + "metadata_type": "DeleteGlossaryMetadata" + } + } + ] + } + } + }, + "TranslateTextGlossaryConfig": { + "fields": { + "glossary": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "ignoreCase": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TranslateTextRequest": { + "fields": { + "contents": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "targetLanguageCode": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parent": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "model": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TranslateTextResponse": { + "fields": { + "translations": { + "rule": "repeated", + "type": "Translation", + "id": 1 + }, + "glossaryTranslations": { + "rule": "repeated", + "type": "Translation", + "id": 3 + } + } + }, + "Translation": { + "fields": { + "translatedText": { + "type": "string", + "id": 1 + }, + "model": { + "type": "string", + "id": 2 + }, + "detectedLanguageCode": { + "type": "string", + "id": 4 + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 3 + } + } + }, + "DetectLanguageRequest": { + "oneofs": { + "source": { + "oneof": [ + "content" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "model": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "content": { + "type": "string", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DetectedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + }, + "DetectLanguageResponse": { + "fields": { + "languages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 1 + } + } + }, + "GetSupportedLanguagesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "displayLanguageCode": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "model": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SupportedLanguages": { + "fields": { + "languages": { + "rule": "repeated", + "type": "SupportedLanguage", + "id": 1 + } + } + }, + "SupportedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "supportSource": { + "type": "bool", + "id": 3 + }, + "supportTarget": { + "type": "bool", + "id": 4 + } + } + }, + "GcsSource": { + "fields": { + "inputUri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "InputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "mimeType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + } + } + }, + "GcsDestination": { + "fields": { + "outputUriPrefix": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "OutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + } + } + }, + "DocumentInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "content", + "gcsSource" + ] + } + }, + "fields": { + "content": { + "type": "bytes", + "id": 1 + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + }, + "mimeType": { + "type": "string", + "id": 4 + } + } + }, + "DocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TranslateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "targetLanguageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentInputConfig": { + "type": "DocumentInputConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentOutputConfig": { + "type": "DocumentOutputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "model": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DocumentTranslation": { + "fields": { + "byteStreamOutputs": { + "rule": "repeated", + "type": "bytes", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + }, + "detectedLanguageCode": { + "type": "string", + "id": 3 + } + } + }, + "TranslateDocumentResponse": { + "fields": { + "documentTranslation": { + "type": "DocumentTranslation", + "id": 1 + }, + "glossaryDocumentTranslation": { + "type": "DocumentTranslation", + "id": 2 + }, + "model": { + "type": "string", + "id": 3 + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 4 + } + } + }, + "BatchTranslateTextRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "targetLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "models": { + "keyType": "string", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "inputConfigs": { + "rule": "repeated", + "type": "InputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "OutputConfig", + "id": 6, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "glossaries": { + "keyType": "string", + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchTranslateMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "translatedCharacters": { + "type": "int64", + "id": 2 + }, + "failedCharacters": { + "type": "int64", + "id": 3 + }, + "totalCharacters": { + "type": "int64", + "id": 4 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + }, + "BatchTranslateResponse": { + "fields": { + "totalCharacters": { + "type": "int64", + "id": 1 + }, + "translatedCharacters": { + "type": "int64", + "id": 2 + }, + "failedCharacters": { + "type": "int64", + "id": 3 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + } + } + }, + "GlossaryInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + } + } + }, + "Glossary": { + "options": { + "(google.api.resource).type": "translate.googleapis.com/Glossary", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/glossaries/{glossary}" + }, + "oneofs": { + "languages": { + "oneof": [ + "languagePair", + "languageCodesSet" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languagePair": { + "type": "LanguageCodePair", + "id": 3 + }, + "languageCodesSet": { + "type": "LanguageCodesSet", + "id": 4 + }, + "inputConfig": { + "type": "GlossaryInputConfig", + "id": 5 + }, + "entryCount": { + "type": "int32", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "LanguageCodePair": { + "fields": { + "sourceLanguageCode": { + "type": "string", + "id": 1 + }, + "targetLanguageCode": { + "type": "string", + "id": 2 + } + } + }, + "LanguageCodesSet": { + "fields": { + "languageCodes": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } + }, + "CreateGlossaryRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "glossary": { + "type": "Glossary", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetGlossaryRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "translate.googleapis.com/Glossary" + } + } + } + }, + "DeleteGlossaryRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "translate.googleapis.com/Glossary" + } + } + } + }, + "ListGlossariesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListGlossariesResponse": { + "fields": { + "glossaries": { + "rule": "repeated", + "type": "Glossary", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateGlossaryMetadata": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + }, + "DeleteGlossaryMetadata": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + }, + "DeleteGlossaryResponse": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "BatchTranslateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "targetLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfigs": { + "rule": "repeated", + "type": "BatchDocumentInputConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "BatchDocumentOutputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "models": { + "keyType": "string", + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaries": { + "keyType": "string", + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "formatConversions": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchDocumentInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + } + } + }, + "BatchDocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + } + } + }, + "BatchTranslateDocumentResponse": { + "fields": { + "totalPages": { + "type": "int64", + "id": 1 + }, + "translatedPages": { + "type": "int64", + "id": 2 + }, + "failedPages": { + "type": "int64", + "id": 3 + }, + "totalBillablePages": { + "type": "int64", + "id": 4 + }, + "totalCharacters": { + "type": "int64", + "id": 5 + }, + "translatedCharacters": { + "type": "int64", + "id": 6 + }, + "failedCharacters": { + "type": "int64", + "id": 7 + }, + "totalBillableCharacters": { + "type": "int64", + "id": 8 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 9 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + } + }, + "BatchTranslateDocumentMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "totalPages": { + "type": "int64", + "id": 2 + }, + "translatedPages": { + "type": "int64", + "id": 3 + }, + "failedPages": { + "type": "int64", + "id": 4 + }, + "totalBillablePages": { + "type": "int64", + "id": 5 + }, + "totalCharacters": { + "type": "int64", + "id": 6 + }, + "translatedCharacters": { + "type": "int64", + "id": 7 + }, + "failedCharacters": { + "type": "int64", + "id": 8 + }, + "totalBillableCharacters": { + "type": "int64", + "id": 9 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + } + } + }, + "v3beta1": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Translate.V3Beta1", + "go_package": "google.golang.org/genproto/googleapis/cloud/translate/v3beta1;translate", + "java_multiple_files": true, + "java_outer_classname": "TranslationServiceProto", + "java_package": "com.google.cloud.translate.v3beta1", + "php_namespace": "Google\\Cloud\\Translate\\V3beta1", + "ruby_package": "Google::Cloud::Translate::V3beta1" + }, + "nested": { + "TranslationService": { + "options": { + "(google.api.default_host)": "translate.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-translation" + }, + "methods": { + "TranslateText": { + "requestType": "TranslateTextRequest", + "responseType": "TranslateTextResponse", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*}:translateText", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v3beta1/{parent=projects/*}:translateText", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*}:translateText", + "body": "*", + "additional_bindings": { + "post": "/v3beta1/{parent=projects/*}:translateText", + "body": "*" + } + } + } + ] + }, + "DetectLanguage": { + "requestType": "DetectLanguageRequest", + "responseType": "DetectLanguageResponse", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*}:detectLanguage", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v3beta1/{parent=projects/*}:detectLanguage", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,model,mime_type" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*}:detectLanguage", + "body": "*", + "additional_bindings": { + "post": "/v3beta1/{parent=projects/*}:detectLanguage", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,model,mime_type" + } + ] + }, + "GetSupportedLanguages": { + "requestType": "GetSupportedLanguagesRequest", + "responseType": "SupportedLanguages", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*}/supportedLanguages", + "(google.api.http).additional_bindings.get": "/v3beta1/{parent=projects/*}/supportedLanguages", + "(google.api.method_signature)": "parent,display_language_code,model" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*}/supportedLanguages", + "additional_bindings": { + "get": "/v3beta1/{parent=projects/*}/supportedLanguages" + } + } + }, + { + "(google.api.method_signature)": "parent,display_language_code,model" + } + ] + }, + "TranslateDocument": { + "requestType": "TranslateDocumentRequest", + "responseType": "TranslateDocumentResponse", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*}:translateDocument", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*}:translateDocument", + "body": "*" + } + } + ] + }, + "BatchTranslateText": { + "requestType": "BatchTranslateTextRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*}:batchTranslateText", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "BatchTranslateResponse", + "(google.longrunning.operation_info).metadata_type": "BatchTranslateMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*}:batchTranslateText", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchTranslateResponse", + "metadata_type": "BatchTranslateMetadata" + } + } + ] + }, + "BatchTranslateDocument": { + "requestType": "BatchTranslateDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*}:batchTranslateDocument", + "(google.api.http).body": "*", + "(google.api.method_signature)": "parent,source_language_code,target_language_codes,input_configs,output_config", + "(google.longrunning.operation_info).response_type": "BatchTranslateDocumentResponse", + "(google.longrunning.operation_info).metadata_type": "BatchTranslateDocumentMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*}:batchTranslateDocument", + "body": "*" + } + }, + { + "(google.api.method_signature)": "parent,source_language_code,target_language_codes,input_configs,output_config" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "BatchTranslateDocumentResponse", + "metadata_type": "BatchTranslateDocumentMetadata" + } + } + ] + }, + "CreateGlossary": { + "requestType": "CreateGlossaryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*}/glossaries", + "(google.api.http).body": "glossary", + "(google.api.method_signature)": "parent,glossary", + "(google.longrunning.operation_info).response_type": "Glossary", + "(google.longrunning.operation_info).metadata_type": "CreateGlossaryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*}/glossaries", + "body": "glossary" + } + }, + { + "(google.api.method_signature)": "parent,glossary" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Glossary", + "metadata_type": "CreateGlossaryMetadata" + } + } + ] + }, + "ListGlossaries": { + "requestType": "ListGlossariesRequest", + "responseType": "ListGlossariesResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*}/glossaries", + "(google.api.method_signature)": "parent,filter" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*}/glossaries" + } + }, + { + "(google.api.method_signature)": "parent,filter" + } + ] + }, + "GetGlossary": { + "requestType": "GetGlossaryRequest", + "responseType": "Glossary", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/glossaries/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/glossaries/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteGlossary": { + "requestType": "DeleteGlossaryRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/glossaries/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "DeleteGlossaryResponse", + "(google.longrunning.operation_info).metadata_type": "DeleteGlossaryMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/glossaries/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "DeleteGlossaryResponse", + "metadata_type": "DeleteGlossaryMetadata" + } + } + ] + } + } + }, + "TranslateTextGlossaryConfig": { + "fields": { + "glossary": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "ignoreCase": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TranslateTextRequest": { + "fields": { + "contents": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "targetLanguageCode": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parent": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "model": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TranslateTextResponse": { + "fields": { + "translations": { + "rule": "repeated", + "type": "Translation", + "id": 1 + }, + "glossaryTranslations": { + "rule": "repeated", + "type": "Translation", + "id": 3 + } + } + }, + "Translation": { + "fields": { + "translatedText": { + "type": "string", + "id": 1 + }, + "model": { + "type": "string", + "id": 2 + }, + "detectedLanguageCode": { + "type": "string", + "id": 4 + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 3 + } + } + }, + "DetectLanguageRequest": { + "oneofs": { + "source": { + "oneof": [ + "content" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "model": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "content": { + "type": "string", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DetectedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + }, + "DetectLanguageResponse": { + "fields": { + "languages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 1 + } + } + }, + "GetSupportedLanguagesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "displayLanguageCode": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "model": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SupportedLanguages": { + "fields": { + "languages": { + "rule": "repeated", + "type": "SupportedLanguage", + "id": 1 + } + } + }, + "SupportedLanguage": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "supportSource": { + "type": "bool", + "id": 3 + }, + "supportTarget": { + "type": "bool", + "id": 4 + } + } + }, + "GcsSource": { + "fields": { + "inputUri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "InputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "mimeType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + } + } + }, + "GcsDestination": { + "fields": { + "outputUriPrefix": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "OutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + } + } + }, + "DocumentInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "content", + "gcsSource" + ] + } + }, + "fields": { + "content": { + "type": "bytes", + "id": 1 + }, + "gcsSource": { + "type": "GcsSource", + "id": 2 + }, + "mimeType": { + "type": "string", + "id": 4 + } + } + }, + "DocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TranslateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "targetLanguageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentInputConfig": { + "type": "DocumentInputConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentOutputConfig": { + "type": "DocumentOutputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "model": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DocumentTranslation": { + "fields": { + "byteStreamOutputs": { + "rule": "repeated", + "type": "bytes", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + }, + "detectedLanguageCode": { + "type": "string", + "id": 3 + } + } + }, + "TranslateDocumentResponse": { + "fields": { + "documentTranslation": { + "type": "DocumentTranslation", + "id": 1 + }, + "glossaryDocumentTranslation": { + "type": "DocumentTranslation", + "id": 2 + }, + "model": { + "type": "string", + "id": 3 + }, + "glossaryConfig": { + "type": "TranslateTextGlossaryConfig", + "id": 4 + } + } + }, + "BatchTranslateTextRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "targetLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "models": { + "keyType": "string", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "inputConfigs": { + "rule": "repeated", + "type": "InputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "OutputConfig", + "id": 6, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "glossaries": { + "keyType": "string", + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchTranslateMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "translatedCharacters": { + "type": "int64", + "id": 2 + }, + "failedCharacters": { + "type": "int64", + "id": 3 + }, + "totalCharacters": { + "type": "int64", + "id": 4 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + }, + "BatchTranslateResponse": { + "fields": { + "totalCharacters": { + "type": "int64", + "id": 1 + }, + "translatedCharacters": { + "type": "int64", + "id": 2 + }, + "failedCharacters": { + "type": "int64", + "id": 3 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + } + } + }, + "GlossaryInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + } + } + }, + "Glossary": { + "options": { + "(google.api.resource).type": "translate.googleapis.com/Glossary", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/glossaries/{glossary}" + }, + "oneofs": { + "languages": { + "oneof": [ + "languagePair", + "languageCodesSet" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languagePair": { + "type": "LanguageCodePair", + "id": 3 + }, + "languageCodesSet": { + "type": "LanguageCodesSet", + "id": 4 + }, + "inputConfig": { + "type": "GlossaryInputConfig", + "id": 5 + }, + "entryCount": { + "type": "int32", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "LanguageCodePair": { + "fields": { + "sourceLanguageCode": { + "type": "string", + "id": 1 + }, + "targetLanguageCode": { + "type": "string", + "id": 2 + } + } + }, + "LanguageCodesSet": { + "fields": { + "languageCodes": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } + }, + "CreateGlossaryRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "glossary": { + "type": "Glossary", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetGlossaryRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "translate.googleapis.com/Glossary" + } + } + } + }, + "DeleteGlossaryRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "translate.googleapis.com/Glossary" + } + } + } + }, + "ListGlossariesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListGlossariesResponse": { + "fields": { + "glossaries": { + "rule": "repeated", + "type": "Glossary", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateGlossaryMetadata": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + }, + "DeleteGlossaryMetadata": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + }, + "DeleteGlossaryResponse": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "BatchTranslateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "sourceLanguageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "targetLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "inputConfigs": { + "rule": "repeated", + "type": "BatchDocumentInputConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputConfig": { + "type": "BatchDocumentOutputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "models": { + "keyType": "string", + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "glossaries": { + "keyType": "string", + "type": "TranslateTextGlossaryConfig", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "formatConversions": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchDocumentInputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSource", + "id": 1 + } + } + }, + "BatchDocumentOutputConfig": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "gcsDestination": { + "type": "GcsDestination", + "id": 1 + } + } + }, + "BatchTranslateDocumentResponse": { + "fields": { + "totalPages": { + "type": "int64", + "id": 1 + }, + "translatedPages": { + "type": "int64", + "id": 2 + }, + "failedPages": { + "type": "int64", + "id": 3 + }, + "totalBillablePages": { + "type": "int64", + "id": 4 + }, + "totalCharacters": { + "type": "int64", + "id": 5 + }, + "translatedCharacters": { + "type": "int64", + "id": 6 + }, + "failedCharacters": { + "type": "int64", + "id": 7 + }, + "totalBillableCharacters": { + "type": "int64", + "id": 8 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 9 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + } + }, + "BatchTranslateDocumentMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "totalPages": { + "type": "int64", + "id": 2 + }, + "translatedPages": { + "type": "int64", + "id": 3 + }, + "failedPages": { + "type": "int64", + "id": 4 + }, + "totalBillablePages": { + "type": "int64", + "id": 5 + }, + "totalCharacters": { + "type": "int64", + "id": 6 + }, + "translatedCharacters": { + "type": "int64", + "id": 7 + }, + "failedCharacters": { + "type": "int64", + "id": 8 + }, + "totalBillableCharacters": { + "type": "int64", + "id": 9 + }, + "submitTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLING": 4, + "CANCELLED": 5 + } + } + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "java_multiple_files": true, + "java_outer_classname": "ResourceProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI", + "cc_enable_arenas": true + }, + "nested": { + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, + "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 + } + }, + "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 + } + } + } + } + }, + "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 + } + } + } + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Empty": { + "fields": {} + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "longrunning": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.LongRunning", + "go_package": "google.golang.org/genproto/googleapis/longrunning;longrunning", + "java_multiple_files": true, + "java_outer_classname": "OperationsProto", + "java_package": "com.google.longrunning", + "php_namespace": "Google\\LongRunning" + }, + "nested": { + "operationInfo": { + "type": "google.longrunning.OperationInfo", + "id": 1049, + "extend": "google.protobuf.MethodOptions" + }, + "Operations": { + "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 + } + } + } + } + }, + "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 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-translate/samples/.eslintrc.yml b/packages/google-cloud-translate/samples/.eslintrc.yml new file mode 100644 index 00000000000..282535f55f6 --- /dev/null +++ b/packages/google-cloud-translate/samples/.eslintrc.yml @@ -0,0 +1,3 @@ +--- +rules: + no-console: off diff --git a/packages/google-cloud-translate/samples/README.md b/packages/google-cloud-translate/samples/README.md new file mode 100644 index 00000000000..ca13a804e56 --- /dev/null +++ b/packages/google-cloud-translate/samples/README.md @@ -0,0 +1,428 @@ +[//]: # "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 + +# [Cloud Translation: 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) + * [Translation_service.batch_translate_document](#translation_service.batch_translate_document) + * [Translation_service.batch_translate_text](#translation_service.batch_translate_text) + * [Translation_service.create_glossary](#translation_service.create_glossary) + * [Translation_service.delete_glossary](#translation_service.delete_glossary) + * [Translation_service.detect_language](#translation_service.detect_language) + * [Translation_service.get_glossary](#translation_service.get_glossary) + * [Translation_service.get_supported_languages](#translation_service.get_supported_languages) + * [Translation_service.list_glossaries](#translation_service.list_glossaries) + * [Translation_service.translate_document](#translation_service.translate_document) + * [Translation_service.translate_text](#translation_service.translate_text) + * [Translation_service.batch_translate_document](#translation_service.batch_translate_document) + * [Translation_service.batch_translate_text](#translation_service.batch_translate_text) + * [Translation_service.create_glossary](#translation_service.create_glossary) + * [Translation_service.delete_glossary](#translation_service.delete_glossary) + * [Translation_service.detect_language](#translation_service.detect_language) + * [Translation_service.get_glossary](#translation_service.get_glossary) + * [Translation_service.get_supported_languages](#translation_service.get_supported_languages) + * [Translation_service.list_glossaries](#translation_service.list_glossaries) + * [Translation_service.translate_document](#translation_service.translate_document) + * [Translation_service.translate_text](#translation_service.translate_text) + * [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 + + + +### Translation_service.batch_translate_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_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-translate/samples/generated/v3/translation_service.batch_translate_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js` + + +----- + + + + +### Translation_service.batch_translate_text + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_text.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.batch_translate_text.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_text.js` + + +----- + + + + +### Translation_service.create_glossary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.create_glossary.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.create_glossary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.create_glossary.js` + + +----- + + + + +### Translation_service.delete_glossary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.delete_glossary.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.delete_glossary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.delete_glossary.js` + + +----- + + + + +### Translation_service.detect_language + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.detect_language.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.detect_language.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.detect_language.js` + + +----- + + + + +### Translation_service.get_glossary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.get_glossary.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.get_glossary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.get_glossary.js` + + +----- + + + + +### Translation_service.get_supported_languages + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.get_supported_languages.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.get_supported_languages.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.get_supported_languages.js` + + +----- + + + + +### Translation_service.list_glossaries + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.list_glossaries.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.list_glossaries.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.list_glossaries.js` + + +----- + + + + +### Translation_service.translate_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_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-translate/samples/generated/v3/translation_service.translate_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js` + + +----- + + + + +### Translation_service.translate_text + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js). + +[![Open in Cloud 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-translate/samples/generated/v3/translation_service.translate_text.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js` + + +----- + + + + +### Translation_service.batch_translate_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_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-translate/samples/generated/v3beta1/translation_service.batch_translate_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_document.js` + + +----- + + + + +### Translation_service.batch_translate_text + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js` + + +----- + + + + +### Translation_service.create_glossary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.create_glossary.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.create_glossary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.create_glossary.js` + + +----- + + + + +### Translation_service.delete_glossary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.delete_glossary.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.delete_glossary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.delete_glossary.js` + + +----- + + + + +### Translation_service.detect_language + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.detect_language.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.detect_language.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.detect_language.js` + + +----- + + + + +### Translation_service.get_glossary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_glossary.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.get_glossary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_glossary.js` + + +----- + + + + +### Translation_service.get_supported_languages + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js` + + +----- + + + + +### Translation_service.list_glossaries + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.list_glossaries.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.list_glossaries.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.list_glossaries.js` + + +----- + + + + +### Translation_service.translate_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_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-translate/samples/generated/v3beta1/translation_service.translate_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_document.js` + + +----- + + + + +### Translation_service.translate_text + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_text.js). + +[![Open in Cloud 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-translate/samples/generated/v3beta1/translation_service.translate_text.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_text.js` + + +----- + + + + +### Quickstart + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/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-translate/samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/samples/quickstart.js` + + +----- + + + + +### Quickstart.test + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translate/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-translate/samples/test/quickstart.test.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-translate/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/translate/docs/ diff --git a/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json b/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json new file mode 100644 index 00000000000..26f3106cae6 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json @@ -0,0 +1,567 @@ +{ + "clientLibrary": { + "name": "nodejs-translation", + "version": "7.0.4", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.translation.v3", + "version": "v3" + } + ] + }, + "snippets": [ + { + "regionTag": "translate_v3_generated_TranslationService_TranslateText_async", + "title": "TranslationService translateText Sample", + "origin": "API_DEFINITION", + "description": " Translates input text and returns translated text.", + "canonical": true, + "file": "translation_service.translate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 118, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TranslateText", + "fullName": "google.cloud.translation.v3.TranslationService.TranslateText", + "async": true, + "parameters": [ + { + "name": "contents", + "type": "TYPE_STRING[]" + }, + { + "name": "mime_type", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_code", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": "TYPE_STRING" + }, + { + "name": "glossary_config", + "type": ".google.cloud.translation.v3.TranslateTextGlossaryConfig" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.translation.v3.TranslateTextResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "TranslateText", + "fullName": "google.cloud.translation.v3.TranslationService.TranslateText", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_DetectLanguage_async", + "title": "TranslationService detectLanguage Sample", + "origin": "API_DEFINITION", + "description": " Detects the language of text within a request.", + "canonical": true, + "file": "translation_service.detect_language.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 88, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetectLanguage", + "fullName": "google.cloud.translation.v3.TranslationService.DetectLanguage", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": "TYPE_STRING" + }, + { + "name": "content", + "type": "TYPE_STRING" + }, + { + "name": "mime_type", + "type": "TYPE_STRING" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.translation.v3.DetectLanguageResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "DetectLanguage", + "fullName": "google.cloud.translation.v3.TranslationService.DetectLanguage", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_GetSupportedLanguages_async", + "title": "TranslationService getSupportedLanguages Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of supported languages for translation.", + "canonical": true, + "file": "translation_service.get_supported_languages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSupportedLanguages", + "fullName": "google.cloud.translation.v3.TranslationService.GetSupportedLanguages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "display_language_code", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.translation.v3.SupportedLanguages", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "GetSupportedLanguages", + "fullName": "google.cloud.translation.v3.TranslationService.GetSupportedLanguages", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_TranslateDocument_async", + "title": "TranslationService translateDocument Sample", + "origin": "API_DEFINITION", + "description": " Translates documents in synchronous mode.", + "canonical": true, + "file": "translation_service.translate_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TranslateDocument", + "fullName": "google.cloud.translation.v3.TranslationService.TranslateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_code", + "type": "TYPE_STRING" + }, + { + "name": "document_input_config", + "type": ".google.cloud.translation.v3.DocumentInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.translation.v3.DocumentOutputConfig" + }, + { + "name": "model", + "type": "TYPE_STRING" + }, + { + "name": "glossary_config", + "type": ".google.cloud.translation.v3.TranslateTextGlossaryConfig" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.translation.v3.TranslateDocumentResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "TranslateDocument", + "fullName": "google.cloud.translation.v3.TranslationService.TranslateDocument", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_BatchTranslateText_async", + "title": "TranslationService batchTranslateText Sample", + "origin": "API_DEFINITION", + "description": " Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.", + "canonical": true, + "file": "translation_service.batch_translate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 112, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchTranslateText", + "fullName": "google.cloud.translation.v3.TranslationService.BatchTranslateText", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "models", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "input_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "output_config", + "type": ".google.cloud.translation.v3.OutputConfig" + }, + { + "name": "glossaries", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "BatchTranslateText", + "fullName": "google.cloud.translation.v3.TranslationService.BatchTranslateText", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_BatchTranslateDocument_async", + "title": "TranslationService batchTranslateDocument Sample", + "origin": "API_DEFINITION", + "description": " Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.", + "canonical": true, + "file": "translation_service.batch_translate_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchTranslateDocument", + "fullName": "google.cloud.translation.v3.TranslationService.BatchTranslateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "input_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "output_config", + "type": ".google.cloud.translation.v3.BatchDocumentOutputConfig" + }, + { + "name": "models", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "glossaries", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "format_conversions", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "BatchTranslateDocument", + "fullName": "google.cloud.translation.v3.TranslationService.BatchTranslateDocument", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_CreateGlossary_async", + "title": "TranslationService createGlossary Sample", + "origin": "API_DEFINITION", + "description": " Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.", + "canonical": true, + "file": "translation_service.create_glossary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGlossary", + "fullName": "google.cloud.translation.v3.TranslationService.CreateGlossary", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "glossary", + "type": ".google.cloud.translation.v3.Glossary" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "CreateGlossary", + "fullName": "google.cloud.translation.v3.TranslationService.CreateGlossary", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_ListGlossaries_async", + "title": "TranslationService listGlossaries Sample", + "origin": "API_DEFINITION", + "description": " Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.", + "canonical": true, + "file": "translation_service.list_glossaries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGlossaries", + "fullName": "google.cloud.translation.v3.TranslationService.ListGlossaries", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.translation.v3.ListGlossariesResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "ListGlossaries", + "fullName": "google.cloud.translation.v3.TranslationService.ListGlossaries", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_GetGlossary_async", + "title": "TranslationService getGlossary Sample", + "origin": "API_DEFINITION", + "description": " Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.", + "canonical": true, + "file": "translation_service.get_glossary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGlossary", + "fullName": "google.cloud.translation.v3.TranslationService.GetGlossary", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.translation.v3.Glossary", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "GetGlossary", + "fullName": "google.cloud.translation.v3.TranslationService.GetGlossary", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3_generated_TranslationService_DeleteGlossary_async", + "title": "TranslationService deleteGlossary Sample", + "origin": "API_DEFINITION", + "description": " Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.", + "canonical": true, + "file": "translation_service.delete_glossary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGlossary", + "fullName": "google.cloud.translation.v3.TranslationService.DeleteGlossary", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3.TranslationServiceClient" + }, + "method": { + "shortName": "DeleteGlossary", + "fullName": "google.cloud.translation.v3.TranslationService.DeleteGlossary", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3.TranslationService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js new file mode 100644 index 00000000000..eb48f979ebc --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js @@ -0,0 +1,123 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig) { + // [START translate_v3_generated_TranslationService_BatchTranslateDocument_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. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + */ + // const parent = 'abc123' + /** + * Required. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support (https://cloud.google.com/translate/docs/languages). + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. The BCP-47 language code to use for translation of the input + * document. Specify up to 10 language codes here. + */ + // const targetLanguageCodes = 'abc123' + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + */ + // const inputConfigs = 1234 + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + */ + // const outputConfig = {} + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + */ + // const models = 1234 + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + */ + // const glossaries = 1234 + /** + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + */ + // const formatConversions = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callBatchTranslateDocument() { + // Construct request + const request = { + parent, + sourceLanguageCode, + targetLanguageCodes, + inputConfigs, + outputConfig, + }; + + // Run request + const [operation] = await translationClient.batchTranslateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchTranslateDocument(); + // [END translate_v3_generated_TranslationService_BatchTranslateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_text.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_text.js new file mode 100644 index 00000000000..6e6352ff38c --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_text.js @@ -0,0 +1,120 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig) { + // [START translate_v3_generated_TranslationService_BatchTranslateText_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. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + */ + // const parent = 'abc123' + /** + * Required. Source language code. + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. Specify up to 10 language codes here. + */ + // const targetLanguageCodes = 'abc123' + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + */ + // const models = 1234 + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + */ + // const inputConfigs = 1234 + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + */ + // const outputConfig = {} + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + */ + // const glossaries = 1234 + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callBatchTranslateText() { + // Construct request + const request = { + parent, + sourceLanguageCode, + targetLanguageCodes, + inputConfigs, + outputConfig, + }; + + // Run request + const [operation] = await translationClient.batchTranslateText(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchTranslateText(); + // [END translate_v3_generated_TranslationService_BatchTranslateText_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.create_glossary.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.create_glossary.js new file mode 100644 index 00000000000..6851f996a9d --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.create_glossary.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, glossary) { + // [START translate_v3_generated_TranslationService_CreateGlossary_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 name. + */ + // const parent = 'abc123' + /** + * Required. The glossary to create. + */ + // const glossary = {} + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callCreateGlossary() { + // Construct request + const request = { + parent, + glossary, + }; + + // Run request + const [operation] = await translationClient.createGlossary(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGlossary(); + // [END translate_v3_generated_TranslationService_CreateGlossary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.delete_glossary.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.delete_glossary.js new file mode 100644 index 00000000000..3f73f2c4240 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.delete_glossary.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 translate_v3_generated_TranslationService_DeleteGlossary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the glossary to delete. + */ + // const name = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callDeleteGlossary() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await translationClient.deleteGlossary(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGlossary(); + // [END translate_v3_generated_TranslationService_DeleteGlossary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.detect_language.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.detect_language.js new file mode 100644 index 00000000000..265776c21dc --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.detect_language.js @@ -0,0 +1,96 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translate_v3_generated_TranslationService_DetectLanguage_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. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + */ + // const model = 'abc123' + /** + * The content of the input stored as a string. + */ + // const content = 'abc123' + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + */ + // const mimeType = 'abc123' + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callDetectLanguage() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await translationClient.detectLanguage(request); + console.log(response); + } + + callDetectLanguage(); + // [END translate_v3_generated_TranslationService_DetectLanguage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.get_glossary.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.get_glossary.js new file mode 100644 index 00000000000..3b715e01252 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.get_glossary.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 translate_v3_generated_TranslationService_GetGlossary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the glossary to retrieve. + */ + // const name = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callGetGlossary() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await translationClient.getGlossary(request); + console.log(response); + } + + callGetGlossary(); + // [END translate_v3_generated_TranslationService_GetGlossary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.get_supported_languages.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.get_supported_languages.js new file mode 100644 index 00000000000..bcc8e78f3a2 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.get_supported_languages.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translate_v3_generated_TranslationService_GetSupportedLanguages_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. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + */ + // const displayLanguageCode = 'abc123' + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + */ + // const model = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callGetSupportedLanguages() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await translationClient.getSupportedLanguages(request); + console.log(response); + } + + callGetSupportedLanguages(); + // [END translate_v3_generated_TranslationService_GetSupportedLanguages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.list_glossaries.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.list_glossaries.js new file mode 100644 index 00000000000..2e5ed20b433 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.list_glossaries.js @@ -0,0 +1,94 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translate_v3_generated_TranslationService_ListGlossaries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project from which to list all of the glossaries. + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of ListGlossariesResponse.next_page_token + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + */ + // const pageToken = 'abc123' + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + */ + // const filter = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callListGlossaries() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await translationClient.listGlossariesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGlossaries(); + // [END translate_v3_generated_TranslationService_ListGlossaries_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js new file mode 100644 index 00000000000..069b2b60183 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js @@ -0,0 +1,123 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, targetLanguageCode, documentInputConfig) { + // [START translate_v3_generated_TranslationService_TranslateDocument_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. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. The BCP-47 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + */ + // const targetLanguageCode = 'abc123' + /** + * Required. Input configurations. + */ + // const documentInputConfig = {} + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + */ + // const documentOutputConfig = {} + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + */ + // const model = 'abc123' + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + */ + // const glossaryConfig = {} + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callTranslateDocument() { + // Construct request + const request = { + parent, + targetLanguageCode, + documentInputConfig, + }; + + // Run request + const response = await translationClient.translateDocument(request); + console.log(response); + } + + callTranslateDocument(); + // [END translate_v3_generated_TranslationService_TranslateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js new file mode 100644 index 00000000000..0eb65ba0243 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js @@ -0,0 +1,126 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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(contents, targetLanguageCode, parent) { + // [START translate_v3_generated_TranslationService_TranslateText_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 content of the input in string format. + * We recommend the total content be less than 30k codepoints. The max length + * of this field is 1024. + * Use BatchTranslateText for larger text. + */ + // const contents = 'abc123' + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + */ + // const mimeType = 'abc123' + /** + * Optional. The BCP-47 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. The BCP-47 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + */ + // const targetLanguageCode = 'abc123' + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used. + */ + // const model = 'abc123' + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + */ + // const glossaryConfig = {} + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callTranslateText() { + // Construct request + const request = { + contents, + targetLanguageCode, + parent, + }; + + // Run request + const response = await translationClient.translateText(request); + console.log(response); + } + + callTranslateText(); + // [END translate_v3_generated_TranslationService_TranslateText_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json b/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json new file mode 100644 index 00000000000..7a8f87432a3 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json @@ -0,0 +1,567 @@ +{ + "clientLibrary": { + "name": "nodejs-translation", + "version": "7.0.4", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.translation.v3beta1", + "version": "v3beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "translate_v3beta1_generated_TranslationService_TranslateText_async", + "title": "TranslationService translateText Sample", + "origin": "API_DEFINITION", + "description": " Translates input text and returns translated text.", + "canonical": true, + "file": "translation_service.translate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 117, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TranslateText", + "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateText", + "async": true, + "parameters": [ + { + "name": "contents", + "type": "TYPE_STRING[]" + }, + { + "name": "mime_type", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_code", + "type": "TYPE_STRING" + }, + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": "TYPE_STRING" + }, + { + "name": "glossary_config", + "type": ".google.cloud.translation.v3beta1.TranslateTextGlossaryConfig" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.translation.v3beta1.TranslateTextResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "TranslateText", + "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateText", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_DetectLanguage_async", + "title": "TranslationService detectLanguage Sample", + "origin": "API_DEFINITION", + "description": " Detects the language of text within a request.", + "canonical": true, + "file": "translation_service.detect_language.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetectLanguage", + "fullName": "google.cloud.translation.v3beta1.TranslationService.DetectLanguage", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": "TYPE_STRING" + }, + { + "name": "content", + "type": "TYPE_STRING" + }, + { + "name": "mime_type", + "type": "TYPE_STRING" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.translation.v3beta1.DetectLanguageResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "DetectLanguage", + "fullName": "google.cloud.translation.v3beta1.TranslationService.DetectLanguage", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async", + "title": "TranslationService getSupportedLanguages Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of supported languages for translation.", + "canonical": true, + "file": "translation_service.get_supported_languages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSupportedLanguages", + "fullName": "google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "display_language_code", + "type": "TYPE_STRING" + }, + { + "name": "model", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.translation.v3beta1.SupportedLanguages", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "GetSupportedLanguages", + "fullName": "google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguages", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_TranslateDocument_async", + "title": "TranslationService translateDocument Sample", + "origin": "API_DEFINITION", + "description": " Translates documents in synchronous mode.", + "canonical": true, + "file": "translation_service.translate_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 114, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TranslateDocument", + "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_code", + "type": "TYPE_STRING" + }, + { + "name": "document_input_config", + "type": ".google.cloud.translation.v3beta1.DocumentInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.translation.v3beta1.DocumentOutputConfig" + }, + { + "name": "model", + "type": "TYPE_STRING" + }, + { + "name": "glossary_config", + "type": ".google.cloud.translation.v3beta1.TranslateTextGlossaryConfig" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.translation.v3beta1.TranslateDocumentResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "TranslateDocument", + "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateDocument", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateText_async", + "title": "TranslationService batchTranslateText Sample", + "origin": "API_DEFINITION", + "description": " Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.", + "canonical": true, + "file": "translation_service.batch_translate_text.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 111, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchTranslateText", + "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateText", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "models", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "input_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "output_config", + "type": ".google.cloud.translation.v3beta1.OutputConfig" + }, + { + "name": "glossaries", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "labels", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "BatchTranslateText", + "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateText", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateDocument_async", + "title": "TranslationService batchTranslateDocument Sample", + "origin": "API_DEFINITION", + "description": " Translates a large volume of documents in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.", + "canonical": true, + "file": "translation_service.batch_translate_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchTranslateDocument", + "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_language_code", + "type": "TYPE_STRING" + }, + { + "name": "target_language_codes", + "type": "TYPE_STRING[]" + }, + { + "name": "input_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "output_config", + "type": ".google.cloud.translation.v3beta1.BatchDocumentOutputConfig" + }, + { + "name": "models", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "glossaries", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "format_conversions", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "BatchTranslateDocument", + "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateDocument", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_CreateGlossary_async", + "title": "TranslationService createGlossary Sample", + "origin": "API_DEFINITION", + "description": " Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.", + "canonical": true, + "file": "translation_service.create_glossary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGlossary", + "fullName": "google.cloud.translation.v3beta1.TranslationService.CreateGlossary", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "glossary", + "type": ".google.cloud.translation.v3beta1.Glossary" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "CreateGlossary", + "fullName": "google.cloud.translation.v3beta1.TranslationService.CreateGlossary", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_ListGlossaries_async", + "title": "TranslationService listGlossaries Sample", + "origin": "API_DEFINITION", + "description": " Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.", + "canonical": true, + "file": "translation_service.list_glossaries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGlossaries", + "fullName": "google.cloud.translation.v3beta1.TranslationService.ListGlossaries", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.translation.v3beta1.ListGlossariesResponse", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "ListGlossaries", + "fullName": "google.cloud.translation.v3beta1.TranslationService.ListGlossaries", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_GetGlossary_async", + "title": "TranslationService getGlossary Sample", + "origin": "API_DEFINITION", + "description": " Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.", + "canonical": true, + "file": "translation_service.get_glossary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGlossary", + "fullName": "google.cloud.translation.v3beta1.TranslationService.GetGlossary", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.translation.v3beta1.Glossary", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "GetGlossary", + "fullName": "google.cloud.translation.v3beta1.TranslationService.GetGlossary", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + }, + { + "regionTag": "translate_v3beta1_generated_TranslationService_DeleteGlossary_async", + "title": "TranslationService deleteGlossary Sample", + "origin": "API_DEFINITION", + "description": " Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.", + "canonical": true, + "file": "translation_service.delete_glossary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGlossary", + "fullName": "google.cloud.translation.v3beta1.TranslationService.DeleteGlossary", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "TranslationServiceClient", + "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" + }, + "method": { + "shortName": "DeleteGlossary", + "fullName": "google.cloud.translation.v3beta1.TranslationService.DeleteGlossary", + "service": { + "shortName": "TranslationService", + "fullName": "google.cloud.translation.v3beta1.TranslationService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_document.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_document.js new file mode 100644 index 00000000000..5cea9cd7e20 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_document.js @@ -0,0 +1,123 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig) { + // [START translate_v3beta1_generated_TranslationService_BatchTranslateDocument_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. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + */ + // const parent = 'abc123' + /** + * Required. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support (https://cloud.google.com/translate/docs/languages). + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. The BCP-47 language code to use for translation of the input + * document. Specify up to 10 language codes here. + */ + // const targetLanguageCodes = 'abc123' + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + */ + // const inputConfigs = 1234 + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + */ + // const outputConfig = {} + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is not requested for a language + * pair, then default google model (nmt) is used. + */ + // const models = 1234 + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + */ + // const glossaries = 1234 + /** + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + */ + // const formatConversions = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callBatchTranslateDocument() { + // Construct request + const request = { + parent, + sourceLanguageCode, + targetLanguageCodes, + inputConfigs, + outputConfig, + }; + + // Run request + const [operation] = await translationClient.batchTranslateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchTranslateDocument(); + // [END translate_v3beta1_generated_TranslationService_BatchTranslateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js new file mode 100644 index 00000000000..050b66c6dd5 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.batch_translate_text.js @@ -0,0 +1,119 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig) { + // [START translate_v3beta1_generated_TranslationService_BatchTranslateText_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. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + */ + // const parent = 'abc123' + /** + * Required. Source language code. + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. Specify up to 10 language codes here. + */ + // const targetLanguageCodes = 'abc123' + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + */ + // const models = 1234 + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + */ + // const inputConfigs = 1234 + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + */ + // const outputConfig = {} + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + */ + // const glossaries = 1234 + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/labels for more information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callBatchTranslateText() { + // Construct request + const request = { + parent, + sourceLanguageCode, + targetLanguageCodes, + inputConfigs, + outputConfig, + }; + + // Run request + const [operation] = await translationClient.batchTranslateText(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchTranslateText(); + // [END translate_v3beta1_generated_TranslationService_BatchTranslateText_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.create_glossary.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.create_glossary.js new file mode 100644 index 00000000000..c0282423f71 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.create_glossary.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, glossary) { + // [START translate_v3beta1_generated_TranslationService_CreateGlossary_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 name. + */ + // const parent = 'abc123' + /** + * Required. The glossary to create. + */ + // const glossary = {} + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callCreateGlossary() { + // Construct request + const request = { + parent, + glossary, + }; + + // Run request + const [operation] = await translationClient.createGlossary(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGlossary(); + // [END translate_v3beta1_generated_TranslationService_CreateGlossary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.delete_glossary.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.delete_glossary.js new file mode 100644 index 00000000000..a5f77fcf736 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.delete_glossary.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 translate_v3beta1_generated_TranslationService_DeleteGlossary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the glossary to delete. + */ + // const name = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callDeleteGlossary() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await translationClient.deleteGlossary(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGlossary(); + // [END translate_v3beta1_generated_TranslationService_DeleteGlossary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.detect_language.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.detect_language.js new file mode 100644 index 00000000000..cfd74d4634e --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.detect_language.js @@ -0,0 +1,95 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translate_v3beta1_generated_TranslationService_DetectLanguage_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. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + */ + // const model = 'abc123' + /** + * The content of the input stored as a string. + */ + // const content = 'abc123' + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + */ + // const mimeType = 'abc123' + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/labels for more information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callDetectLanguage() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await translationClient.detectLanguage(request); + console.log(response); + } + + callDetectLanguage(); + // [END translate_v3beta1_generated_TranslationService_DetectLanguage_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_glossary.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_glossary.js new file mode 100644 index 00000000000..8f031109a00 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_glossary.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 translate_v3beta1_generated_TranslationService_GetGlossary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the glossary to retrieve. + */ + // const name = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callGetGlossary() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await translationClient.getGlossary(request); + console.log(response); + } + + callGetGlossary(); + // [END translate_v3beta1_generated_TranslationService_GetGlossary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js new file mode 100644 index 00000000000..6d86e73751c --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.get_supported_languages.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translate_v3beta1_generated_TranslationService_GetSupportedLanguages_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. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + */ + // const displayLanguageCode = 'abc123' + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + */ + // const model = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callGetSupportedLanguages() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await translationClient.getSupportedLanguages(request); + console.log(response); + } + + callGetSupportedLanguages(); + // [END translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.list_glossaries.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.list_glossaries.js new file mode 100644 index 00000000000..b6749dd23e4 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.list_glossaries.js @@ -0,0 +1,94 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translate_v3beta1_generated_TranslationService_ListGlossaries_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project from which to list all of the glossaries. + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of ListGlossariesResponse.next_page_token + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + */ + // const pageToken = 'abc123' + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + */ + // const filter = 'abc123' + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callListGlossaries() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await translationClient.listGlossariesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGlossaries(); + // [END translate_v3beta1_generated_TranslationService_ListGlossaries_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_document.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_document.js new file mode 100644 index 00000000000..ba5432f9c30 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_document.js @@ -0,0 +1,122 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, targetLanguageCode, documentInputConfig) { + // [START translate_v3beta1_generated_TranslationService_TranslateDocument_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. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. The BCP-47 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + */ + // const targetLanguageCode = 'abc123' + /** + * Required. Input configurations. + */ + // const documentInputConfig = {} + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + */ + // const documentOutputConfig = {} + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + */ + // const model = 'abc123' + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + */ + // const glossaryConfig = {} + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callTranslateDocument() { + // Construct request + const request = { + parent, + targetLanguageCode, + documentInputConfig, + }; + + // Run request + const response = await translationClient.translateDocument(request); + console.log(response); + } + + callTranslateDocument(); + // [END translate_v3beta1_generated_TranslationService_TranslateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_text.js b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_text.js new file mode 100644 index 00000000000..bb98ef28de6 --- /dev/null +++ b/packages/google-cloud-translate/samples/generated/v3beta1/translation_service.translate_text.js @@ -0,0 +1,125 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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(contents, targetLanguageCode, parent) { + // [START translate_v3beta1_generated_TranslationService_TranslateText_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 content of the input in string format. + * We recommend the total content be less than 30k codepoints. The max length + * of this field is 1024. + * Use BatchTranslateText for larger text. + */ + // const contents = 'abc123' + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + */ + // const mimeType = 'abc123' + /** + * Optional. The BCP-47 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + */ + // const sourceLanguageCode = 'abc123' + /** + * Required. The BCP-47 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + */ + // const targetLanguageCode = 'abc123' + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + */ + // const parent = 'abc123' + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used + */ + // const model = 'abc123' + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + */ + // const glossaryConfig = {} + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/labels for more information. + */ + // const labels = 1234 + + // Imports the Translation library + const {TranslationServiceClient} = require('@google-cloud/translate').v3beta1; + + // Instantiates a client + const translationClient = new TranslationServiceClient(); + + async function callTranslateText() { + // Construct request + const request = { + contents, + targetLanguageCode, + parent, + }; + + // Run request + const response = await translationClient.translateText(request); + console.log(response); + } + + callTranslateText(); + // [END translate_v3beta1_generated_TranslationService_TranslateText_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/package.json b/packages/google-cloud-translate/samples/package.json new file mode 100644 index 00000000000..a00a6cfea65 --- /dev/null +++ b/packages/google-cloud-translate/samples/package.json @@ -0,0 +1,29 @@ +{ + "name": "nodejs-docs-samples-translate", + "private": true, + "license": "Apache-2.0", + "author": "Google Inc.", + "repository": "googleapis/nodejs-translate", + "files": [ + "!test/" + ], + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "test": "mocha --recursive --timeout 240000" + }, + "dependencies": { + "@google-cloud/automl": "^3.0.0", + "@google-cloud/text-to-speech": "^4.0.0", + "@google-cloud/translate": "^7.0.4", + "@google-cloud/vision": "^3.0.0", + "yargs": "^16.0.0" + }, + "devDependencies": { + "@google-cloud/storage": "^6.0.0", + "chai": "^4.2.0", + "mocha": "^8.0.0", + "uuid": "^9.0.0" + } +} diff --git a/packages/google-cloud-translate/samples/quickstart.js b/packages/google-cloud-translate/samples/quickstart.js new file mode 100644 index 00000000000..57bc3254c20 --- /dev/null +++ b/packages/google-cloud-translate/samples/quickstart.js @@ -0,0 +1,49 @@ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main( + projectId = 'YOUR_PROJECT_ID' // Your GCP Project Id +) { + // [START translate_quickstart] + /** + * TODO(developer): Uncomment the following line before running the sample. + */ + // const projectId = 'YOUR_PROJECT_ID'; + + // Imports the Google Cloud client library + const {Translate} = require('@google-cloud/translate').v2; + + // Instantiates a client + const translate = new Translate({projectId}); + + async function quickStart() { + // The text to translate + const text = 'Hello, world!'; + + // The target language + const target = 'ru'; + + // Translates some text into Russian + const [translation] = await translate.translate(text, target); + console.log(`Text: ${text}`); + console.log(`Translation: ${translation}`); + } + + quickStart(); + // [END translate_quickstart] +} + +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-translate/samples/test/quickstart.test.js b/packages/google-cloud-translate/samples/test/quickstart.test.js new file mode 100644 index 00000000000..f1ed0c72fe0 --- /dev/null +++ b/packages/google-cloud-translate/samples/test/quickstart.test.js @@ -0,0 +1,32 @@ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const {describe, it} = require('mocha'); +const cp = require('child_process'); +const path = require('path'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const cwd = path.join(__dirname, '..'); +const projectId = process.env.GCLOUD_PROJECT; + +describe('quickstart sample tests', () => { + it('should translate a string', async () => { + const stdout = execSync(`node quickstart ${projectId}`, {cwd}); + assert.include(stdout, 'Translation: Привет'); + }); +}); diff --git a/packages/google-cloud-translate/src/index.ts b/packages/google-cloud-translate/src/index.ts new file mode 100644 index 00000000000..ac6281adf90 --- /dev/null +++ b/packages/google-cloud-translate/src/index.ts @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +import * as v3 from './v3'; +import * as v3beta1 from './v3beta1'; + +const TranslationServiceClient = v3.TranslationServiceClient; +type TranslationServiceClient = v3.TranslationServiceClient; + +export {v2, v3, v3beta1, TranslationServiceClient}; +export default {v2, v3, v3beta1, TranslationServiceClient}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-translate/src/v2/index.ts b/packages/google-cloud-translate/src/v2/index.ts new file mode 100644 index 00000000000..e96893a5ec0 --- /dev/null +++ b/packages/google-cloud-translate/src/v2/index.ts @@ -0,0 +1,612 @@ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 {Service, util, Metadata} from '@google-cloud/common'; +import {promisifyAll} from '@google-cloud/promisify'; +import arrify = require('arrify'); +import * as extend from 'extend'; +import {GoogleAuthOptions} from 'google-auth-library'; + +// eslint-disable-next-line @typescript-eslint/no-var-requires +const isHtml = require('is-html'); +import { + DecorateRequestOptions, + BodyResponseCallback, +} from '@google-cloud/common/build/src/util'; + +// eslint-disable-next-line @typescript-eslint/no-var-requires +const PKG = require('../../../package.json'); + +export interface TranslateRequest { + format?: string; + from?: string; + model?: string; + to?: string; +} + +export interface TranslateCallback { + (err: Error | null, translations?: T | null, apiResponse?: Metadata): void; +} + +export interface DetectResult { + language: string; + confidence: number; + input: string; +} + +export interface DetectCallback { + (err: Error | null, results?: T | null, apiResponse?: Metadata): void; +} + +export interface LanguageResult { + code: string; + name: string; +} + +export interface GetLanguagesCallback { + ( + err: Error | null, + results?: LanguageResult[] | null, + apiResponse?: Metadata + ): void; +} + +export interface TranslateConfig extends GoogleAuthOptions { + key?: string; + autoRetry?: boolean; + maxRetries?: number; + /** + * The API endpoint of the service used to make requests. + * Defaults to `translation.googleapis.com`. + */ + apiEndpoint?: string; +} + +/** + * @typedef {object} ClientConfig + * @memberof v2 + * @property {string} [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://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application + * Application Default Credentials}, your project ID will be detected + * automatically. + * @property {string} [key] An API key. You should prefer using a Service + * Account key file instead of an API key. + * @property {string} [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 above is not necessary. NOTE: .pem and + * .p12 require you to specify the `email` option as well. + * @property {string} [email] Account email address. Required when using a .pem + * or .p12 keyFilename. + * @property {object} [credentials] Credentials object. + * @property {string} [credentials.client_email] + * @property {string} [credentials.private_key] + * @property {boolean} [autoRetry=true] Automatically retry requests if the + * response is related to rate limits or certain intermittent server errors. + * We will exponentially backoff subsequent requests by default. + * @property {number} [maxRetries=3] Maximum number of automatic retries + * attempted before returning the error. + * @property {Constructor} [promise] Custom promise module to use instead of + * native Promises. + */ +/** + * With {@link https://cloud.google.com/translate| Google Translate}, you can + * dynamically translate text between thousands of language pairs. + * + * The Google Cloud Translation API lets websites and programs integrate with + * Google Translate programmatically. + * + * @class + * @memberof v2 + * + * @see [Getting Started]{@link https://cloud.google.com/translate/v2/getting_started} + * @see [Identifying your application to Google]{@link https://cloud.google.com/translate/v2/using_rest#auth} + * + * @param {ClientConfig} [options] Configuration options. + * + * @example + * ``` + * //- + * //

Custom Translation API

+ * // + * // The environment variable, `GOOGLE_CLOUD_TRANSLATE_ENDPOINT`, is honored as + * // a custom backend which our library will send requests to. + * //- + * + * ``` + * @example include:samples/quickstart.js + * region_tag:translate_quickstart + * Full quickstart example: + */ +export class Translate extends Service { + options: TranslateConfig; + key?: string; + constructor(options: TranslateConfig = {}) { + options.apiEndpoint = options.apiEndpoint || 'translation.googleapis.com'; + let baseUrl = `https://${options.apiEndpoint}/language/translate/v2`; + if (process.env.GOOGLE_CLOUD_TRANSLATE_ENDPOINT) { + baseUrl = process.env.GOOGLE_CLOUD_TRANSLATE_ENDPOINT.replace(/\/+$/, ''); + } + + const config = { + apiEndpoint: options.apiEndpoint, + baseUrl, + scopes: ['https://www.googleapis.com/auth/cloud-platform'], + packageJson: require('../../../package.json'), + projectIdRequired: false, + }; + + super(config, options); + this.options = options || {}; + if (this.options.key) { + this.key = this.options.key; + } + } + + detect(input: string): Promise<[DetectResult, Metadata]>; + detect(input: string[]): Promise<[DetectResult[], Metadata]>; + detect(input: string, callback: DetectCallback): void; + detect(input: string[], callback: DetectCallback): void; + /** + * @typedef {object} DetectResult + * @memberof v2 + * @property {string} 0.language The language code matched from the input. + * @property {number} [0.confidence] A float 0 - 1. The higher the number, the + * higher the confidence in language detection. Note, this is not always + * returned from the API. + * @property {object} 1 The full API response. + */ + /** + * @callback DetectCallback + * @memberof v2 + * @param {?Error} err Request error, if any. + * @param {object|object[]} results The detection results. + * @param {string} results.language The language code matched from the input. + * @param {number} [results.confidence] A float 0 - 1. The higher the number, the + * higher the confidence in language detection. Note, this is not always + * returned from the API. + * @param {object} apiResponse The full API response. + */ + /** + * Detect the language used in a string or multiple strings. + * + * @see [Detect Language]{@link https://cloud.google.com/translate/v2/using_rest#detect-language} + * + * @param {string|string[]} input - The source string input. + * @param {DetectCallback} [callback] Callback function. + * @returns {Promise} + * + * @example + * ``` + * const {Translate} = require('@google-cloud/translate'); + * + * const translate = new Translate(); + * + * //- + * // Detect the language from a single string input. + * //- + * translate.detect('Hello', (err, results) => { + * if (!err) { + * // results = { + * // language: 'en', + * // confidence: 1, + * // input: 'Hello' + * // } + * } + * }); + * + * //- + * // Detect the languages used in multiple strings. Note that the results are + * // now provided as an array. + * //- + * translate.detect([ + * 'Hello', + * 'Hola' + * ], (err, results) => { + * if (!err) { + * // results = [ + * // { + * // language: 'en', + * // confidence: 1, + * // input: 'Hello' + * // }, + * // { + * // language: 'es', + * // confidence: 1, + * // input: 'Hola' + * // } + * // ] + * } + * }); + * + * //- + * // If the callback is omitted, we'll return a Promise. + * //- + * translate.detect('Hello').then((data) => { + * const results = data[0]; + * const apiResponse = data[2]; + * }); + * + * ``` + * @example include:samples/translate.js + * region_tag:translate_detect_language + * Here's a full example: + */ + detect( + input: string | string[], + callback?: DetectCallback | DetectCallback + ): + | void + | Promise<[DetectResult, Metadata]> + | Promise<[DetectResult[], Metadata]> { + const inputIsArray = Array.isArray(input); + input = arrify(input); + this.request( + { + method: 'POST', + uri: '/detect', + json: { + q: input, + }, + }, + (err, resp) => { + if (err) { + (callback as Function)(err, null, resp); + return; + } + + let results = resp.data.detections.map( + (detection: Array<{}>, index: number) => { + const result = extend({}, detection[0], { + input: input[index], + }); + + // Deprecated. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + delete (result as any).isReliable; + + return result; + } + ); + + if (input.length === 1 && !inputIsArray) { + results = results[0]; + } + + (callback as Function)(null, results, resp); + } + ); + } + + getLanguages(target?: string): Promise<[LanguageResult[], Metadata]>; + getLanguages(target: string, callback: GetLanguagesCallback): void; + getLanguages(callback: GetLanguagesCallback): void; + /** + * @typedef {object} LanguageResult + * @memberof v2 + * @property {string} code The {@link https://en.wikipedia.org/wiki/ISO_639-1| ISO 639-1} + * language code. + * @property {string} name The language name. This can be translated into your + * preferred language with the `target` option. + */ + /** + * @callback GetLanguagesCallback + * @memberof v2 + * @param {?Error} err Request error, if any. + * @param {object[]} results The languages supported by the API. + * @param {string} results.code The {@link https://en.wikipedia.org/wiki/ISO_639-1| ISO 639-1} + * language code. + * @param {string} results.name The language name. This can be translated into your + * preferred language with the `target` option. + * @param {object} apiResponse The full API response. + */ + /** + * Get an array of all supported languages. + * + * @see [Discovering Supported Languages]{@link https://cloud.google.com/translate/v2/discovering-supported-languages-with-rest} + * + * @param {string} [target] Get the language names in a language other than + * English. + * @param {GetLanguagesCallback} [callback] Callback function. + * @returns {Promise} + * + * @example include:samples/translate.js + * region_tag:translate_list_codes + * Gets the language names in English: + * + * @example include:samples/translate.js + * region_tag:translate_list_language_names + * Gets the language names in a language other than English: + */ + getLanguages( + targetOrCallback?: string | GetLanguagesCallback, + callback?: GetLanguagesCallback + ): void | Promise<[LanguageResult[], Metadata]> { + let target: string; + if (typeof targetOrCallback === 'function') { + callback = targetOrCallback as GetLanguagesCallback; + target = 'en'; + } else { + target = targetOrCallback as string; + } + + const reqOpts = { + uri: '/languages', + useQuerystring: true, + qs: {}, + } as DecorateRequestOptions; + + if (target && typeof target === 'string') { + reqOpts.qs.target = target; + } + + this.request(reqOpts, (err, resp) => { + if (err) { + callback!(err, null, resp); + return; + } + + const languages = resp.data.languages.map( + (language: {language: string; name: string}) => { + return { + code: language.language, + name: language.name, + }; + } + ); + + callback!(null, languages, resp); + }); + } + + translate( + input: string, + options: TranslateRequest + ): Promise<[string, Metadata]>; + translate( + input: string[], + options: TranslateRequest + ): Promise<[string[], Metadata]>; + translate(input: string, to: string): Promise<[string, Metadata]>; + translate(input: string[], to: string): Promise<[string[], Metadata]>; + translate( + input: string, + options: TranslateRequest, + callback: TranslateCallback + ): void; + translate( + input: string, + to: string, + callback: TranslateCallback + ): void; + translate( + input: string[], + options: TranslateRequest, + callback: TranslateCallback + ): void; + translate( + input: string[], + to: string, + callback: TranslateCallback + ): void; + /** + * Translate request options. + * + * @typedef {object} TranslateRequest + * @memberof v2 + * @property {string} [format] Set the text's format as `html` or `text`. + * If not provided, we will try to auto-detect if the text given is HTML. + * If not, we set the format as `text`. + * @property {string} [from] The ISO 639-1 language code the source input + * is written in. + * @property {string} [model] Set the model type requested for this + * translation. Please refer to the upstream documentation for possible + * values. + * @property {string} to The ISO 639-1 language code to translate the + * input to. + */ + /** + * @callback TranslateCallback + * @memberof v2 + * @param {?Error} err Request error, if any. + * @param {object|object[]} translations If a single string input was given, a + * single translation is given. Otherwise, it is an array of translations. + * @param {object} apiResponse The full API response. + */ + /** + * Translate a string or multiple strings into another language. + * + * @see {@link https://cloud.google.com/translate/v2/using_rest#Translate| Translate Text} + * + * @throws {Error} If `options` is provided as an object without a `to` + * property. + * + * @param {string|string[]} input The source string input. + * @param {string|TranslateRequest} [options] If a string, it is interpreted as the + * target ISO 639-1 language code to translate the source input to. (e.g. + * `en` for English). If an object, you may also specify the source + * language. + * @param {TranslateCallback} [callback] Callback function. + * @returns {Promise} + * + * @example + * ``` + * //- + * // Pass a string and a language code to get the translation. + * //- + * translate.translate('Hello', 'es', (err, translation) => { + * if (!err) { + * // translation = 'Hola' + * } + * }); + * + * //- + * // The source language is auto-detected by default. To manually set it, + * // provide an object. + * //- + * const options = { + * from: 'en', + * to: 'es' + * }; + * + * translate.translate('Hello', options, (err, translation) => { + * if (!err) { + * // translation = 'Hola' + * } + * }); + * + * //- + * // Translate multiple strings of input. Note that the results are + * // now provided as an array. + * //- + * const input = [ + * 'Hello', + * 'How are you today?' + * ]; + * + * translate.translate(input, 'es', (err, translations) => { + * if (!err) { + * // translations = [ + * // 'Hola', + * // 'Como estas hoy?' + * // ] + * } + * }); + * + * //- + * // If the callback is omitted, we'll return a Promise. + * //- + * translate.translate('Hello', 'es').then((data) => { + * const translation = data[0]; + * const apiResponse = data[1]; + * }); + * + * ``` + * @example include:samples/translate.js + * region_tag:translate_translate_text + * Full translation example: + * + * @example include:samples/translate.js + * region_tag:translate_text_with_model + * Translation using the premium model: + */ + translate( + inputs: string | string[], + optionsOrTo: string | TranslateRequest, + callback?: TranslateCallback | TranslateCallback + ): void | Promise<[string, Metadata]> | Promise<[string[], Metadata]> { + const inputIsArray = Array.isArray(inputs); + const input = arrify(inputs); + let options: TranslateRequest = {}; + if (typeof optionsOrTo === 'object') { + options = optionsOrTo as TranslateRequest; + } else if (typeof optionsOrTo === 'string') { + options = {to: optionsOrTo}; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const body: any = { + q: input, + format: options.format || (isHtml(input[0]) ? 'html' : 'text'), + }; + + if (typeof options === 'string') { + body.target = options; + } else { + if (options.from) { + body.source = options.from; + } + + if (options.to) { + body.target = options.to; + } + + if (options.model) { + body.model = options.model; + } + } + + if (!body.target) { + throw new Error( + 'A target language is required to perform a translation.' + ); + } + + this.request( + { + method: 'POST', + uri: '', + json: body, + }, + (err, resp) => { + if (err) { + (callback as Function)(err, null, resp); + return; + } + + let translations = resp.data.translations.map( + (x: {translatedText: string}) => x.translatedText + ); + + if (body.q.length === 1 && !inputIsArray) { + translations = translations[0]; + } + + (callback as Function)(err, translations, resp); + } + ); + } + + /** + * A custom request implementation. Requests to this API may optionally use an + * API key for an application, not a bearer token from a service account. This + * means it is possible to skip the `makeAuthenticatedRequest` portion of the + * typical request lifecycle, and manually authenticate the request here. + * + * @private + * + * @param {object} reqOpts - Request options that are passed to `request`. + * @param {function} callback - The callback function passed to `request`. + */ + request( + reqOpts: DecorateRequestOptions, + callback: BodyResponseCallback + ): void { + if (!this.key) { + super.request(reqOpts, callback!); + return; + } + + reqOpts.uri = this.baseUrl + reqOpts.uri; + reqOpts = extend(true, {}, reqOpts, { + qs: { + key: this.key, + }, + headers: { + 'User-Agent': util.getUserAgentFromPackageJson(PKG), + }, + }); + + util.makeRequest(reqOpts, this.options, callback!); + } +} + +/*! Developer Documentation + * + * All async methods (except for streams) will return a Promise in the event + * that a callback is omitted. + */ +promisifyAll(Translate, {exclude: ['request']}); diff --git a/packages/google-cloud-translate/src/v3/gapic_metadata.json b/packages/google-cloud-translate/src/v3/gapic_metadata.json new file mode 100644 index 00000000000..6af9328fa91 --- /dev/null +++ b/packages/google-cloud-translate/src/v3/gapic_metadata.json @@ -0,0 +1,127 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.translation.v3", + "libraryPackage": "@google-cloud/translate", + "services": { + "TranslationService": { + "clients": { + "grpc": { + "libraryClient": "TranslationServiceClient", + "rpcs": { + "TranslateText": { + "methods": [ + "translateText" + ] + }, + "DetectLanguage": { + "methods": [ + "detectLanguage" + ] + }, + "GetSupportedLanguages": { + "methods": [ + "getSupportedLanguages" + ] + }, + "TranslateDocument": { + "methods": [ + "translateDocument" + ] + }, + "GetGlossary": { + "methods": [ + "getGlossary" + ] + }, + "BatchTranslateText": { + "methods": [ + "batchTranslateText" + ] + }, + "BatchTranslateDocument": { + "methods": [ + "batchTranslateDocument" + ] + }, + "CreateGlossary": { + "methods": [ + "createGlossary" + ] + }, + "DeleteGlossary": { + "methods": [ + "deleteGlossary" + ] + }, + "ListGlossaries": { + "methods": [ + "listGlossaries", + "listGlossariesStream", + "listGlossariesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TranslationServiceClient", + "rpcs": { + "TranslateText": { + "methods": [ + "translateText" + ] + }, + "DetectLanguage": { + "methods": [ + "detectLanguage" + ] + }, + "GetSupportedLanguages": { + "methods": [ + "getSupportedLanguages" + ] + }, + "TranslateDocument": { + "methods": [ + "translateDocument" + ] + }, + "GetGlossary": { + "methods": [ + "getGlossary" + ] + }, + "BatchTranslateText": { + "methods": [ + "batchTranslateText" + ] + }, + "BatchTranslateDocument": { + "methods": [ + "batchTranslateDocument" + ] + }, + "CreateGlossary": { + "methods": [ + "createGlossary" + ] + }, + "DeleteGlossary": { + "methods": [ + "deleteGlossary" + ] + }, + "ListGlossaries": { + "methods": [ + "listGlossaries", + "listGlossariesStream", + "listGlossariesAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-translate/src/v3/index.ts b/packages/google-cloud-translate/src/v3/index.ts new file mode 100644 index 00000000000..46c99bab76a --- /dev/null +++ b/packages/google-cloud-translate/src/v3/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 {TranslationServiceClient} from './translation_service_client'; diff --git a/packages/google-cloud-translate/src/v3/translation_service_client.ts b/packages/google-cloud-translate/src/v3/translation_service_client.ts new file mode 100644 index 00000000000..a7bf7499a57 --- /dev/null +++ b/packages/google-cloud-translate/src/v3/translation_service_client.ts @@ -0,0 +1,2121 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, +} 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/v3/translation_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './translation_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides natural language translation operations. + * @class + * @memberof v3 + */ +export class TranslationServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + translationServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TranslationServiceClient. + * + * @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 TranslationServiceClient({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 TranslationServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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 = { + glossaryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/glossaries/{glossary}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + }; + + // 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 = { + listGlossaries: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'glossaries' + ), + }; + + 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: '/v3/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v3/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v3/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v3/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v3/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v3/{name=projects/*/locations/*}/operations', + }, + { + selector: 'google.longrunning.Operations.WaitOperation', + post: '/v3/{name=projects/*/locations/*/operations/*}:wait', + body: '*', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const batchTranslateTextResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3.BatchTranslateResponse' + ) as gax.protobuf.Type; + const batchTranslateTextMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3.BatchTranslateMetadata' + ) as gax.protobuf.Type; + const batchTranslateDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3.BatchTranslateDocumentResponse' + ) as gax.protobuf.Type; + const batchTranslateDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3.BatchTranslateDocumentMetadata' + ) as gax.protobuf.Type; + const createGlossaryResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3.Glossary' + ) as gax.protobuf.Type; + const createGlossaryMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3.CreateGlossaryMetadata' + ) as gax.protobuf.Type; + const deleteGlossaryResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3.DeleteGlossaryResponse' + ) as gax.protobuf.Type; + const deleteGlossaryMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3.DeleteGlossaryMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchTranslateText: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchTranslateTextResponse.decode.bind(batchTranslateTextResponse), + batchTranslateTextMetadata.decode.bind(batchTranslateTextMetadata) + ), + batchTranslateDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchTranslateDocumentResponse.decode.bind( + batchTranslateDocumentResponse + ), + batchTranslateDocumentMetadata.decode.bind( + batchTranslateDocumentMetadata + ) + ), + createGlossary: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createGlossaryResponse.decode.bind(createGlossaryResponse), + createGlossaryMetadata.decode.bind(createGlossaryMetadata) + ), + deleteGlossary: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteGlossaryResponse.decode.bind(deleteGlossaryResponse), + deleteGlossaryMetadata.decode.bind(deleteGlossaryMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.translation.v3.TranslationService', + 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.translationServiceStub) { + return this.translationServiceStub; + } + + // Put together the "service stub" for + // google.cloud.translation.v3.TranslationService. + this.translationServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.translation.v3.TranslationService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.translation.v3.TranslationService, + 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 translationServiceStubMethods = [ + 'translateText', + 'detectLanguage', + 'getSupportedLanguages', + 'translateDocument', + 'batchTranslateText', + 'batchTranslateDocument', + 'createGlossary', + 'listGlossaries', + 'getGlossary', + 'deleteGlossary', + ]; + for (const methodName of translationServiceStubMethods) { + const callPromise = this.translationServiceStub.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.translationServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'translate.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 'translate.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', + 'https://www.googleapis.com/auth/cloud-translation', + ]; + } + + 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 -- + // ------------------- + /** + * Translates input text and returns translated text. + * + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.contents + * Required. The content of the input in string format. + * We recommend the total content be less than 30k codepoints. The max length + * of this field is 1024. + * Use BatchTranslateText for larger text. + * @param {string} [request.mimeType] + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param {string} [request.sourceLanguageCode] + * Optional. The BCP-47 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * @param {string} request.targetLanguageCode + * Required. The BCP-47 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @param {string} request.parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.model] + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * + * If not provided, the default Google model (NMT) will be used. + * @param {google.cloud.translation.v3.TranslateTextGlossaryConfig} [request.glossaryConfig] + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TranslateTextResponse]{@link google.cloud.translation.v3.TranslateTextResponse}. + * 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/v3/translation_service.translate_text.js + * region_tag:translate_v3_generated_TranslationService_TranslateText_async + */ + translateText( + request?: protos.google.cloud.translation.v3.ITranslateTextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3.ITranslateTextResponse, + protos.google.cloud.translation.v3.ITranslateTextRequest | undefined, + {} | undefined + ] + >; + translateText( + request: protos.google.cloud.translation.v3.ITranslateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3.ITranslateTextResponse, + | protos.google.cloud.translation.v3.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateText( + request: protos.google.cloud.translation.v3.ITranslateTextRequest, + callback: Callback< + protos.google.cloud.translation.v3.ITranslateTextResponse, + | protos.google.cloud.translation.v3.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateText( + request?: protos.google.cloud.translation.v3.ITranslateTextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3.ITranslateTextResponse, + | protos.google.cloud.translation.v3.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3.ITranslateTextResponse, + | protos.google.cloud.translation.v3.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3.ITranslateTextResponse, + protos.google.cloud.translation.v3.ITranslateTextRequest | 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.translateText(request, options, callback); + } + /** + * Detects the language of text within a request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.model] + * Optional. The language detection model to be used. + * + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * + * If not specified, the default model is used. + * @param {string} request.content + * The content of the input stored as a string. + * @param {string} [request.mimeType] + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DetectLanguageResponse]{@link google.cloud.translation.v3.DetectLanguageResponse}. + * 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/v3/translation_service.detect_language.js + * region_tag:translate_v3_generated_TranslationService_DetectLanguage_async + */ + detectLanguage( + request?: protos.google.cloud.translation.v3.IDetectLanguageRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3.IDetectLanguageResponse, + protos.google.cloud.translation.v3.IDetectLanguageRequest | undefined, + {} | undefined + ] + >; + detectLanguage( + request: protos.google.cloud.translation.v3.IDetectLanguageRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3.IDetectLanguageResponse, + | protos.google.cloud.translation.v3.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + detectLanguage( + request: protos.google.cloud.translation.v3.IDetectLanguageRequest, + callback: Callback< + protos.google.cloud.translation.v3.IDetectLanguageResponse, + | protos.google.cloud.translation.v3.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + detectLanguage( + request?: protos.google.cloud.translation.v3.IDetectLanguageRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3.IDetectLanguageResponse, + | protos.google.cloud.translation.v3.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3.IDetectLanguageResponse, + | protos.google.cloud.translation.v3.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3.IDetectLanguageResponse, + protos.google.cloud.translation.v3.IDetectLanguageRequest | 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.detectLanguage(request, options, callback); + } + /** + * Returns a list of supported languages for translation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for AutoML models. + * + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.displayLanguageCode] + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * @param {string} [request.model] + * Optional. Get supported languages of this model. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SupportedLanguages]{@link google.cloud.translation.v3.SupportedLanguages}. + * 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/v3/translation_service.get_supported_languages.js + * region_tag:translate_v3_generated_TranslationService_GetSupportedLanguages_async + */ + getSupportedLanguages( + request?: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3.ISupportedLanguages, + ( + | protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest + | undefined + ), + {} | undefined + ] + >; + getSupportedLanguages( + request: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3.ISupportedLanguages, + | protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSupportedLanguages( + request: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest, + callback: Callback< + protos.google.cloud.translation.v3.ISupportedLanguages, + | protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSupportedLanguages( + request?: protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3.ISupportedLanguages, + | protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3.ISupportedLanguages, + | protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3.ISupportedLanguages, + ( + | protos.google.cloud.translation.v3.IGetSupportedLanguagesRequest + | 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.getSupportedLanguages(request, options, callback); + } + /** + * Translates documents in synchronous mode. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.sourceLanguageCode] + * Optional. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * @param {string} request.targetLanguageCode + * Required. The BCP-47 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * @param {google.cloud.translation.v3.DocumentInputConfig} request.documentInputConfig + * Required. Input configurations. + * @param {google.cloud.translation.v3.DocumentOutputConfig} [request.documentOutputConfig] + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * @param {string} [request.model] + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If not provided, the default Google model (NMT) will be used for + * translation. + * @param {google.cloud.translation.v3.TranslateTextGlossaryConfig} [request.glossaryConfig] + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TranslateDocumentResponse]{@link google.cloud.translation.v3.TranslateDocumentResponse}. + * 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/v3/translation_service.translate_document.js + * region_tag:translate_v3_generated_TranslationService_TranslateDocument_async + */ + translateDocument( + request?: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + protos.google.cloud.translation.v3.ITranslateDocumentRequest | undefined, + {} | undefined + ] + >; + translateDocument( + request: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateDocument( + request: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + callback: Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateDocument( + request?: protos.google.cloud.translation.v3.ITranslateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3.ITranslateDocumentResponse, + protos.google.cloud.translation.v3.ITranslateDocumentRequest | 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.translateDocument(request, options, callback); + } + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + * exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the glossary to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Glossary]{@link google.cloud.translation.v3.Glossary}. + * 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/v3/translation_service.get_glossary.js + * region_tag:translate_v3_generated_TranslationService_GetGlossary_async + */ + getGlossary( + request?: protos.google.cloud.translation.v3.IGetGlossaryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.IGetGlossaryRequest | undefined, + {} | undefined + ] + >; + getGlossary( + request: protos.google.cloud.translation.v3.IGetGlossaryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.IGetGlossaryRequest | null | undefined, + {} | null | undefined + > + ): void; + getGlossary( + request: protos.google.cloud.translation.v3.IGetGlossaryRequest, + callback: Callback< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.IGetGlossaryRequest | null | undefined, + {} | null | undefined + > + ): void; + getGlossary( + request?: protos.google.cloud.translation.v3.IGetGlossaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3.IGlossary, + | protos.google.cloud.translation.v3.IGetGlossaryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.IGetGlossaryRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.IGetGlossaryRequest | 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.getGlossary(request, options, callback); + } + + /** + * Translates a large volume of text in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can + * use google.longrunning.Operation.name to poll the status of the call. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Location to make a call. Must refer to a caller's project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param {string} request.sourceLanguageCode + * Required. Source language code. + * @param {string[]} request.targetLanguageCodes + * Required. Specify up to 10 language codes here. + * @param {number[]} [request.models] + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @param {number[]} request.inputConfigs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param {google.cloud.translation.v3.OutputConfig} request.outputConfig + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param {number[]} [request.glossaries] + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3/translation_service.batch_translate_text.js + * region_tag:translate_v3_generated_TranslationService_BatchTranslateText_async + */ + batchTranslateText( + request?: protos.google.cloud.translation.v3.IBatchTranslateTextRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchTranslateText( + request: protos.google.cloud.translation.v3.IBatchTranslateTextRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateText( + request: protos.google.cloud.translation.v3.IBatchTranslateTextRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateText( + request?: protos.google.cloud.translation.v3.IBatchTranslateTextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + >, + 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.batchTranslateText(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchTranslateText()`. + * @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/v3/translation_service.batch_translate_text.js + * region_tag:translate_v3_generated_TranslationService_BatchTranslateText_async + */ + async checkBatchTranslateTextProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3.BatchTranslateResponse, + protos.google.cloud.translation.v3.BatchTranslateMetadata + > + > { + 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.batchTranslateText, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3.BatchTranslateResponse, + protos.google.cloud.translation.v3.BatchTranslateMetadata + >; + } + /** + * Translates a large volume of document in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can use + * google.longrunning.Operation.name to poll the status of the call. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param {string} request.sourceLanguageCode + * Required. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support (https://cloud.google.com/translate/docs/languages). + * @param {string[]} request.targetLanguageCodes + * Required. The BCP-47 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @param {number[]} request.inputConfigs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param {google.cloud.translation.v3.BatchDocumentOutputConfig} request.outputConfig + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param {number[]} [request.models] + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @param {number[]} [request.glossaries] + * Optional. Glossaries to be applied. It's keyed by target language code. + * @param {number[]} [request.formatConversions] + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * + * If nothing specified, output files will be in the same format as the + * original file. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3/translation_service.batch_translate_document.js + * region_tag:translate_v3_generated_TranslationService_BatchTranslateDocument_async + */ + batchTranslateDocument( + request?: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchTranslateDocument( + request: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateDocument( + request: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateDocument( + request?: protos.google.cloud.translation.v3.IBatchTranslateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >, + 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.batchTranslateDocument( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `batchTranslateDocument()`. + * @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/v3/translation_service.batch_translate_document.js + * region_tag:translate_v3_generated_TranslationService_BatchTranslateDocument_async + */ + async checkBatchTranslateDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3.BatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.BatchTranslateDocumentMetadata + > + > { + 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.batchTranslateDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3.BatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.BatchTranslateDocumentMetadata + >; + } + /** + * Creates a glossary and returns the long-running operation. Returns + * NOT_FOUND, if the project doesn't exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project name. + * @param {google.cloud.translation.v3.Glossary} request.glossary + * Required. The glossary to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3/translation_service.create_glossary.js + * region_tag:translate_v3_generated_TranslationService_CreateGlossary_async + */ + createGlossary( + request?: protos.google.cloud.translation.v3.ICreateGlossaryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createGlossary( + request: protos.google.cloud.translation.v3.ICreateGlossaryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createGlossary( + request: protos.google.cloud.translation.v3.ICreateGlossaryRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createGlossary( + request?: protos.google.cloud.translation.v3.ICreateGlossaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + >, + 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.createGlossary(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createGlossary()`. + * @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/v3/translation_service.create_glossary.js + * region_tag:translate_v3_generated_TranslationService_CreateGlossary_async + */ + async checkCreateGlossaryProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3.Glossary, + protos.google.cloud.translation.v3.CreateGlossaryMetadata + > + > { + 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.createGlossary, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3.Glossary, + protos.google.cloud.translation.v3.CreateGlossaryMetadata + >; + } + /** + * Deletes a glossary, or cancels glossary construction + * if the glossary isn't created yet. + * Returns NOT_FOUND, if the glossary doesn't exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the glossary to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3/translation_service.delete_glossary.js + * region_tag:translate_v3_generated_TranslationService_DeleteGlossary_async + */ + deleteGlossary( + request?: protos.google.cloud.translation.v3.IDeleteGlossaryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteGlossary( + request: protos.google.cloud.translation.v3.IDeleteGlossaryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteGlossary( + request: protos.google.cloud.translation.v3.IDeleteGlossaryRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteGlossary( + request?: protos.google.cloud.translation.v3.IDeleteGlossaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + >, + 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.deleteGlossary(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteGlossary()`. + * @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/v3/translation_service.delete_glossary.js + * region_tag:translate_v3_generated_TranslationService_DeleteGlossary_async + */ + async checkDeleteGlossaryProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3.DeleteGlossaryResponse, + protos.google.cloud.translation.v3.DeleteGlossaryMetadata + > + > { + 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.deleteGlossary, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3.DeleteGlossaryResponse, + protos.google.cloud.translation.v3.DeleteGlossaryMetadata + >; + } + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + * exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project from which to list all of the glossaries. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @param {string} [request.filter] + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Glossary]{@link google.cloud.translation.v3.Glossary}. + * 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 `listGlossariesAsync()` + * 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. + */ + listGlossaries( + request?: protos.google.cloud.translation.v3.IListGlossariesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3.IGlossary[], + protos.google.cloud.translation.v3.IListGlossariesRequest | null, + protos.google.cloud.translation.v3.IListGlossariesResponse + ] + >; + listGlossaries( + request: protos.google.cloud.translation.v3.IListGlossariesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.translation.v3.IListGlossariesRequest, + | protos.google.cloud.translation.v3.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3.IGlossary + > + ): void; + listGlossaries( + request: protos.google.cloud.translation.v3.IListGlossariesRequest, + callback: PaginationCallback< + protos.google.cloud.translation.v3.IListGlossariesRequest, + | protos.google.cloud.translation.v3.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3.IGlossary + > + ): void; + listGlossaries( + request?: protos.google.cloud.translation.v3.IListGlossariesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.translation.v3.IListGlossariesRequest, + | protos.google.cloud.translation.v3.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3.IGlossary + >, + callback?: PaginationCallback< + protos.google.cloud.translation.v3.IListGlossariesRequest, + | protos.google.cloud.translation.v3.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3.IGlossary + > + ): Promise< + [ + protos.google.cloud.translation.v3.IGlossary[], + protos.google.cloud.translation.v3.IListGlossariesRequest | null, + protos.google.cloud.translation.v3.IListGlossariesResponse + ] + > | 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.listGlossaries(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 name of the project from which to list all of the glossaries. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @param {string} [request.filter] + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @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 [Glossary]{@link google.cloud.translation.v3.Glossary} 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 `listGlossariesAsync()` + * 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. + */ + listGlossariesStream( + request?: protos.google.cloud.translation.v3.IListGlossariesRequest, + 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['listGlossaries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGlossaries.createStream( + this.innerApiCalls.listGlossaries as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listGlossaries`, 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 name of the project from which to list all of the glossaries. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @param {string} [request.filter] + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @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 + * [Glossary]{@link google.cloud.translation.v3.Glossary}. 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/v3/translation_service.list_glossaries.js + * region_tag:translate_v3_generated_TranslationService_ListGlossaries_async + */ + listGlossariesAsync( + request?: protos.google.cloud.translation.v3.IListGlossariesRequest, + 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['listGlossaries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGlossaries.asyncIterate( + this.innerApiCalls['listGlossaries'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified glossary resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} glossary + * @returns {string} Resource name string. + */ + glossaryPath(project: string, location: string, glossary: string) { + return this.pathTemplates.glossaryPathTemplate.render({ + project: project, + location: location, + glossary: glossary, + }); + } + + /** + * Parse the project from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGlossaryName(glossaryName: string) { + return this.pathTemplates.glossaryPathTemplate.match(glossaryName).project; + } + + /** + * Parse the location from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGlossaryName(glossaryName: string) { + return this.pathTemplates.glossaryPathTemplate.match(glossaryName).location; + } + + /** + * Parse the glossary from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the glossary. + */ + matchGlossaryFromGlossaryName(glossaryName: string) { + return this.pathTemplates.glossaryPathTemplate.match(glossaryName).glossary; + } + + /** + * 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; + } + + /** + * 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.translationServiceStub && !this._terminated) { + return this.translationServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-translate/src/v3/translation_service_client_config.json b/packages/google-cloud-translate/src/v3/translation_service_client_config.json new file mode 100644 index 00000000000..d17bfe2c1c7 --- /dev/null +++ b/packages/google-cloud-translate/src/v3/translation_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.translation.v3.TranslationService": { + "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": { + "TranslateText": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DetectLanguage": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSupportedLanguages": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "TranslateDocument": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchTranslateText": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchTranslateDocument": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateGlossary": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListGlossaries": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetGlossary": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteGlossary": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-translate/src/v3/translation_service_proto_list.json b/packages/google-cloud-translate/src/v3/translation_service_proto_list.json new file mode 100644 index 00000000000..21e41c10464 --- /dev/null +++ b/packages/google-cloud-translate/src/v3/translation_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/translate/v3/translation_service.proto" +] diff --git a/packages/google-cloud-translate/src/v3beta1/gapic_metadata.json b/packages/google-cloud-translate/src/v3beta1/gapic_metadata.json new file mode 100644 index 00000000000..4c7891e520f --- /dev/null +++ b/packages/google-cloud-translate/src/v3beta1/gapic_metadata.json @@ -0,0 +1,127 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.translation.v3beta1", + "libraryPackage": "@google-cloud/translate", + "services": { + "TranslationService": { + "clients": { + "grpc": { + "libraryClient": "TranslationServiceClient", + "rpcs": { + "TranslateText": { + "methods": [ + "translateText" + ] + }, + "DetectLanguage": { + "methods": [ + "detectLanguage" + ] + }, + "GetSupportedLanguages": { + "methods": [ + "getSupportedLanguages" + ] + }, + "TranslateDocument": { + "methods": [ + "translateDocument" + ] + }, + "GetGlossary": { + "methods": [ + "getGlossary" + ] + }, + "BatchTranslateText": { + "methods": [ + "batchTranslateText" + ] + }, + "BatchTranslateDocument": { + "methods": [ + "batchTranslateDocument" + ] + }, + "CreateGlossary": { + "methods": [ + "createGlossary" + ] + }, + "DeleteGlossary": { + "methods": [ + "deleteGlossary" + ] + }, + "ListGlossaries": { + "methods": [ + "listGlossaries", + "listGlossariesStream", + "listGlossariesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TranslationServiceClient", + "rpcs": { + "TranslateText": { + "methods": [ + "translateText" + ] + }, + "DetectLanguage": { + "methods": [ + "detectLanguage" + ] + }, + "GetSupportedLanguages": { + "methods": [ + "getSupportedLanguages" + ] + }, + "TranslateDocument": { + "methods": [ + "translateDocument" + ] + }, + "GetGlossary": { + "methods": [ + "getGlossary" + ] + }, + "BatchTranslateText": { + "methods": [ + "batchTranslateText" + ] + }, + "BatchTranslateDocument": { + "methods": [ + "batchTranslateDocument" + ] + }, + "CreateGlossary": { + "methods": [ + "createGlossary" + ] + }, + "DeleteGlossary": { + "methods": [ + "deleteGlossary" + ] + }, + "ListGlossaries": { + "methods": [ + "listGlossaries", + "listGlossariesStream", + "listGlossariesAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-translate/src/v3beta1/index.ts b/packages/google-cloud-translate/src/v3beta1/index.ts new file mode 100644 index 00000000000..46c99bab76a --- /dev/null +++ b/packages/google-cloud-translate/src/v3beta1/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 {TranslationServiceClient} from './translation_service_client'; diff --git a/packages/google-cloud-translate/src/v3beta1/translation_service_client.ts b/packages/google-cloud-translate/src/v3beta1/translation_service_client.ts new file mode 100644 index 00000000000..9fe11f56fb0 --- /dev/null +++ b/packages/google-cloud-translate/src/v3beta1/translation_service_client.ts @@ -0,0 +1,2136 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, +} 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/v3beta1/translation_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './translation_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Provides natural language translation operations. + * @class + * @memberof v3beta1 + */ +export class TranslationServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + translationServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TranslationServiceClient. + * + * @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 TranslationServiceClient({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 TranslationServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // 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 = { + glossaryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/glossaries/{glossary}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + }; + + // 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 = { + listGlossaries: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'glossaries' + ), + }; + + 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: '/v3beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v3beta1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v3beta1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v3beta1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v3beta1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v3beta1/{name=projects/*/locations/*}/operations', + }, + { + selector: 'google.longrunning.Operations.WaitOperation', + post: '/v3beta1/{name=projects/*/locations/*/operations/*}:wait', + body: '*', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const batchTranslateTextResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.BatchTranslateResponse' + ) as gax.protobuf.Type; + const batchTranslateTextMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.BatchTranslateMetadata' + ) as gax.protobuf.Type; + const batchTranslateDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.BatchTranslateDocumentResponse' + ) as gax.protobuf.Type; + const batchTranslateDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata' + ) as gax.protobuf.Type; + const createGlossaryResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.Glossary' + ) as gax.protobuf.Type; + const createGlossaryMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.CreateGlossaryMetadata' + ) as gax.protobuf.Type; + const deleteGlossaryResponse = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.DeleteGlossaryResponse' + ) as gax.protobuf.Type; + const deleteGlossaryMetadata = protoFilesRoot.lookup( + '.google.cloud.translation.v3beta1.DeleteGlossaryMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchTranslateText: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchTranslateTextResponse.decode.bind(batchTranslateTextResponse), + batchTranslateTextMetadata.decode.bind(batchTranslateTextMetadata) + ), + batchTranslateDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchTranslateDocumentResponse.decode.bind( + batchTranslateDocumentResponse + ), + batchTranslateDocumentMetadata.decode.bind( + batchTranslateDocumentMetadata + ) + ), + createGlossary: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createGlossaryResponse.decode.bind(createGlossaryResponse), + createGlossaryMetadata.decode.bind(createGlossaryMetadata) + ), + deleteGlossary: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteGlossaryResponse.decode.bind(deleteGlossaryResponse), + deleteGlossaryMetadata.decode.bind(deleteGlossaryMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.translation.v3beta1.TranslationService', + 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.translationServiceStub) { + return this.translationServiceStub; + } + + // Put together the "service stub" for + // google.cloud.translation.v3beta1.TranslationService. + this.translationServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.translation.v3beta1.TranslationService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.translation.v3beta1 + .TranslationService, + 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 translationServiceStubMethods = [ + 'translateText', + 'detectLanguage', + 'getSupportedLanguages', + 'translateDocument', + 'batchTranslateText', + 'batchTranslateDocument', + 'createGlossary', + 'listGlossaries', + 'getGlossary', + 'deleteGlossary', + ]; + for (const methodName of translationServiceStubMethods) { + const callPromise = this.translationServiceStub.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.translationServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'translate.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 'translate.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', + 'https://www.googleapis.com/auth/cloud-translation', + ]; + } + + 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 -- + // ------------------- + /** + * Translates input text and returns translated text. + * + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.contents + * Required. The content of the input in string format. + * We recommend the total content be less than 30k codepoints. The max length + * of this field is 1024. + * Use BatchTranslateText for larger text. + * @param {string} [request.mimeType] + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param {string} [request.sourceLanguageCode] + * Optional. The BCP-47 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * @param {string} request.targetLanguageCode + * Required. The BCP-47 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @param {string} request.parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.model] + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * + * If not provided, the default Google model (NMT) will be used + * @param {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} [request.glossaryConfig] + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/labels for more information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TranslateTextResponse]{@link google.cloud.translation.v3beta1.TranslateTextResponse}. + * 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/v3beta1/translation_service.translate_text.js + * region_tag:translate_v3beta1_generated_TranslationService_TranslateText_async + */ + translateText( + request?: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3beta1.ITranslateTextResponse, + protos.google.cloud.translation.v3beta1.ITranslateTextRequest | undefined, + {} | undefined + ] + >; + translateText( + request: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3beta1.ITranslateTextResponse, + | protos.google.cloud.translation.v3beta1.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateText( + request: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, + callback: Callback< + protos.google.cloud.translation.v3beta1.ITranslateTextResponse, + | protos.google.cloud.translation.v3beta1.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateText( + request?: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3beta1.ITranslateTextResponse, + | protos.google.cloud.translation.v3beta1.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3beta1.ITranslateTextResponse, + | protos.google.cloud.translation.v3beta1.ITranslateTextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3beta1.ITranslateTextResponse, + protos.google.cloud.translation.v3beta1.ITranslateTextRequest | 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.translateText(request, options, callback); + } + /** + * Detects the language of text within a request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.model] + * Optional. The language detection model to be used. + * + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * + * If not specified, the default model is used. + * @param {string} request.content + * The content of the input stored as a string. + * @param {string} [request.mimeType] + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/labels for more information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DetectLanguageResponse]{@link google.cloud.translation.v3beta1.DetectLanguageResponse}. + * 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/v3beta1/translation_service.detect_language.js + * region_tag:translate_v3beta1_generated_TranslationService_DetectLanguage_async + */ + detectLanguage( + request?: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, + ( + | protos.google.cloud.translation.v3beta1.IDetectLanguageRequest + | undefined + ), + {} | undefined + ] + >; + detectLanguage( + request: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, + | protos.google.cloud.translation.v3beta1.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + detectLanguage( + request: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, + callback: Callback< + protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, + | protos.google.cloud.translation.v3beta1.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + detectLanguage( + request?: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, + | protos.google.cloud.translation.v3beta1.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, + | protos.google.cloud.translation.v3beta1.IDetectLanguageRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, + ( + | protos.google.cloud.translation.v3beta1.IDetectLanguageRequest + | 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.detectLanguage(request, options, callback); + } + /** + * Returns a list of supported languages for translation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for AutoML models. + * + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.displayLanguageCode] + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * @param {string} [request.model] + * Optional. Get supported languages of this model. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SupportedLanguages]{@link google.cloud.translation.v3beta1.SupportedLanguages}. + * 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/v3beta1/translation_service.get_supported_languages.js + * region_tag:translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async + */ + getSupportedLanguages( + request?: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3beta1.ISupportedLanguages, + ( + | protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest + | undefined + ), + {} | undefined + ] + >; + getSupportedLanguages( + request: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3beta1.ISupportedLanguages, + | protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSupportedLanguages( + request: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, + callback: Callback< + protos.google.cloud.translation.v3beta1.ISupportedLanguages, + | protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSupportedLanguages( + request?: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3beta1.ISupportedLanguages, + | protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3beta1.ISupportedLanguages, + | protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3beta1.ISupportedLanguages, + ( + | protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest + | 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.getSupportedLanguages(request, options, callback); + } + /** + * Translates documents in synchronous mode. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global`. + * + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param {string} [request.sourceLanguageCode] + * Optional. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * @param {string} request.targetLanguageCode + * Required. The BCP-47 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * @param {google.cloud.translation.v3beta1.DocumentInputConfig} request.documentInputConfig + * Required. Input configurations. + * @param {google.cloud.translation.v3beta1.DocumentOutputConfig} [request.documentOutputConfig] + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * @param {string} [request.model] + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If not provided, the default Google model (NMT) will be used for + * translation. + * @param {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} [request.glossaryConfig] + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TranslateDocumentResponse]{@link google.cloud.translation.v3beta1.TranslateDocumentResponse}. + * 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/v3beta1/translation_service.translate_document.js + * region_tag:translate_v3beta1_generated_TranslationService_TranslateDocument_async + */ + translateDocument( + request?: protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3beta1.ITranslateDocumentResponse, + ( + | protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest + | undefined + ), + {} | undefined + ] + >; + translateDocument( + request: protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3beta1.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateDocument( + request: protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest, + callback: Callback< + protos.google.cloud.translation.v3beta1.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + translateDocument( + request?: protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3beta1.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3beta1.ITranslateDocumentResponse, + | protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3beta1.ITranslateDocumentResponse, + ( + | protos.google.cloud.translation.v3beta1.ITranslateDocumentRequest + | 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.translateDocument(request, options, callback); + } + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + * exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the glossary to retrieve. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Glossary]{@link google.cloud.translation.v3beta1.Glossary}. + * 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/v3beta1/translation_service.get_glossary.js + * region_tag:translate_v3beta1_generated_TranslationService_GetGlossary_async + */ + getGlossary( + request?: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.IGetGlossaryRequest | undefined, + {} | undefined + ] + >; + getGlossary( + request: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.translation.v3beta1.IGlossary, + | protos.google.cloud.translation.v3beta1.IGetGlossaryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getGlossary( + request: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, + callback: Callback< + protos.google.cloud.translation.v3beta1.IGlossary, + | protos.google.cloud.translation.v3beta1.IGetGlossaryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getGlossary( + request?: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.translation.v3beta1.IGlossary, + | protos.google.cloud.translation.v3beta1.IGetGlossaryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.translation.v3beta1.IGlossary, + | protos.google.cloud.translation.v3beta1.IGetGlossaryRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.IGetGlossaryRequest | 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.getGlossary(request, options, callback); + } + + /** + * Translates a large volume of text in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can + * use google.longrunning.Operation.name to poll the status of the call. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Location to make a call. Must refer to a caller's project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param {string} request.sourceLanguageCode + * Required. Source language code. + * @param {string[]} request.targetLanguageCodes + * Required. Specify up to 10 language codes here. + * @param {number[]} [request.models] + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @param {number[]} request.inputConfigs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param {google.cloud.translation.v3beta1.OutputConfig} request.outputConfig + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param {number[]} [request.glossaries] + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * @param {number[]} [request.labels] + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/labels for more information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3beta1/translation_service.batch_translate_text.js + * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateText_async + */ + batchTranslateText( + request?: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchTranslateText( + request: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateText( + request: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateText( + request?: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + >, + 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.batchTranslateText(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchTranslateText()`. + * @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/v3beta1/translation_service.batch_translate_text.js + * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateText_async + */ + async checkBatchTranslateTextProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3beta1.BatchTranslateResponse, + protos.google.cloud.translation.v3beta1.BatchTranslateMetadata + > + > { + 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.batchTranslateText, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3beta1.BatchTranslateResponse, + protos.google.cloud.translation.v3beta1.BatchTranslateMetadata + >; + } + /** + * Translates a large volume of documents in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can use + * google.longrunning.Operation.name to poll the status of the call. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param {string} request.sourceLanguageCode + * Required. The BCP-47 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support (https://cloud.google.com/translate/docs/languages). + * @param {string[]} request.targetLanguageCodes + * Required. The BCP-47 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @param {number[]} request.inputConfigs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param {google.cloud.translation.v3beta1.BatchDocumentOutputConfig} request.outputConfig + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param {number[]} [request.models] + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is not requested for a language + * pair, then default google model (nmt) is used. + * @param {number[]} [request.glossaries] + * Optional. Glossaries to be applied. It's keyed by target language code. + * @param {number[]} [request.formatConversions] + * Optional. File format conversion map to be applied to all input files. + * Map's key is the original mime_type. Map's value is the target mime_type of + * translated documents. + * + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * + * If nothing specified, output files will be in the same format as the + * original file. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3beta1/translation_service.batch_translate_document.js + * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateDocument_async + */ + batchTranslateDocument( + request?: protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchTranslateDocument( + request: protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateDocument( + request: protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchTranslateDocument( + request?: protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + >, + 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.batchTranslateDocument( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `batchTranslateDocument()`. + * @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/v3beta1/translation_service.batch_translate_document.js + * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateDocument_async + */ + async checkBatchTranslateDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3beta1.BatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + > + > { + 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.batchTranslateDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3beta1.BatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.BatchTranslateDocumentMetadata + >; + } + /** + * Creates a glossary and returns the long-running operation. Returns + * NOT_FOUND, if the project doesn't exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project name. + * @param {google.cloud.translation.v3beta1.Glossary} request.glossary + * Required. The glossary to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3beta1/translation_service.create_glossary.js + * region_tag:translate_v3beta1_generated_TranslationService_CreateGlossary_async + */ + createGlossary( + request?: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createGlossary( + request: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createGlossary( + request: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createGlossary( + request?: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + >, + 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.createGlossary(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createGlossary()`. + * @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/v3beta1/translation_service.create_glossary.js + * region_tag:translate_v3beta1_generated_TranslationService_CreateGlossary_async + */ + async checkCreateGlossaryProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3beta1.Glossary, + protos.google.cloud.translation.v3beta1.CreateGlossaryMetadata + > + > { + 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.createGlossary, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3beta1.Glossary, + protos.google.cloud.translation.v3beta1.CreateGlossaryMetadata + >; + } + /** + * Deletes a glossary, or cancels glossary construction + * if the glossary isn't created yet. + * Returns NOT_FOUND, if the glossary doesn't exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the glossary to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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/v3beta1/translation_service.delete_glossary.js + * region_tag:translate_v3beta1_generated_TranslationService_DeleteGlossary_async + */ + deleteGlossary( + request?: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteGlossary( + request: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteGlossary( + request: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, + callback: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteGlossary( + request?: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + >, + 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.deleteGlossary(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteGlossary()`. + * @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/v3beta1/translation_service.delete_glossary.js + * region_tag:translate_v3beta1_generated_TranslationService_DeleteGlossary_async + */ + async checkDeleteGlossaryProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.translation.v3beta1.DeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.DeleteGlossaryMetadata + > + > { + 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.deleteGlossary, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.translation.v3beta1.DeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.DeleteGlossaryMetadata + >; + } + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + * exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project from which to list all of the glossaries. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @param {string} [request.filter] + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Glossary]{@link google.cloud.translation.v3beta1.Glossary}. + * 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 `listGlossariesAsync()` + * 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. + */ + listGlossaries( + request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.translation.v3beta1.IGlossary[], + protos.google.cloud.translation.v3beta1.IListGlossariesRequest | null, + protos.google.cloud.translation.v3beta1.IListGlossariesResponse + ] + >; + listGlossaries( + request: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + | protos.google.cloud.translation.v3beta1.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3beta1.IGlossary + > + ): void; + listGlossaries( + request: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + callback: PaginationCallback< + protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + | protos.google.cloud.translation.v3beta1.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3beta1.IGlossary + > + ): void; + listGlossaries( + request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + | protos.google.cloud.translation.v3beta1.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3beta1.IGlossary + >, + callback?: PaginationCallback< + protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + | protos.google.cloud.translation.v3beta1.IListGlossariesResponse + | null + | undefined, + protos.google.cloud.translation.v3beta1.IGlossary + > + ): Promise< + [ + protos.google.cloud.translation.v3beta1.IGlossary[], + protos.google.cloud.translation.v3beta1.IListGlossariesRequest | null, + protos.google.cloud.translation.v3beta1.IListGlossariesResponse + ] + > | 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.listGlossaries(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 name of the project from which to list all of the glossaries. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @param {string} [request.filter] + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @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 [Glossary]{@link google.cloud.translation.v3beta1.Glossary} 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 `listGlossariesAsync()` + * 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. + */ + listGlossariesStream( + request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + 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['listGlossaries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGlossaries.createStream( + this.innerApiCalls.listGlossaries as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listGlossaries`, 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 name of the project from which to list all of the glossaries. + * @param {number} [request.pageSize] + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @param {string} [request.filter] + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @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 + * [Glossary]{@link google.cloud.translation.v3beta1.Glossary}. 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/v3beta1/translation_service.list_glossaries.js + * region_tag:translate_v3beta1_generated_TranslationService_ListGlossaries_async + */ + listGlossariesAsync( + request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, + 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['listGlossaries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listGlossaries.asyncIterate( + this.innerApiCalls['listGlossaries'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified glossary resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} glossary + * @returns {string} Resource name string. + */ + glossaryPath(project: string, location: string, glossary: string) { + return this.pathTemplates.glossaryPathTemplate.render({ + project: project, + location: location, + glossary: glossary, + }); + } + + /** + * Parse the project from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the project. + */ + matchProjectFromGlossaryName(glossaryName: string) { + return this.pathTemplates.glossaryPathTemplate.match(glossaryName).project; + } + + /** + * Parse the location from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the location. + */ + matchLocationFromGlossaryName(glossaryName: string) { + return this.pathTemplates.glossaryPathTemplate.match(glossaryName).location; + } + + /** + * Parse the glossary from Glossary resource. + * + * @param {string} glossaryName + * A fully-qualified path representing Glossary resource. + * @returns {string} A string representing the glossary. + */ + matchGlossaryFromGlossaryName(glossaryName: string) { + return this.pathTemplates.glossaryPathTemplate.match(glossaryName).glossary; + } + + /** + * 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; + } + + /** + * 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.translationServiceStub && !this._terminated) { + return this.translationServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-translate/src/v3beta1/translation_service_client_config.json b/packages/google-cloud-translate/src/v3beta1/translation_service_client_config.json new file mode 100644 index 00000000000..bbf1a651f11 --- /dev/null +++ b/packages/google-cloud-translate/src/v3beta1/translation_service_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.translation.v3beta1.TranslationService": { + "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": { + "TranslateText": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DetectLanguage": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSupportedLanguages": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "TranslateDocument": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchTranslateText": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "BatchTranslateDocument": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateGlossary": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListGlossaries": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetGlossary": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteGlossary": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-translate/src/v3beta1/translation_service_proto_list.json b/packages/google-cloud-translate/src/v3beta1/translation_service_proto_list.json new file mode 100644 index 00000000000..a50dcfc7d4f --- /dev/null +++ b/packages/google-cloud-translate/src/v3beta1/translation_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/translate/v3beta1/translation_service.proto" +] diff --git a/packages/google-cloud-translate/system-test/fixtures/sample/src/index.js b/packages/google-cloud-translate/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..ece56feb1d4 --- /dev/null +++ b/packages/google-cloud-translate/system-test/fixtures/sample/src/index.js @@ -0,0 +1,26 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translation = require('@google-cloud/translate'); + +function main() { + const translationServiceClient = new translation.TranslationServiceClient(); +} + +main(); diff --git a/packages/google-cloud-translate/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-translate/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..38feffe8bea --- /dev/null +++ b/packages/google-cloud-translate/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {TranslationServiceClient} from '@google-cloud/translate'; + +// check that the client class type name can be used +function doStuffWithTranslationServiceClient(client: TranslationServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const translationServiceClient = new TranslationServiceClient(); + doStuffWithTranslationServiceClient(translationServiceClient); +} + +main(); diff --git a/packages/google-cloud-translate/system-test/install.ts b/packages/google-cloud-translate/system-test/install.ts new file mode 100644 index 00000000000..6dd1eaadafa --- /dev/null +++ b/packages/google-cloud-translate/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-translate/test/gapic_translation_service_v3.ts b/packages/google-cloud-translate/test/gapic_translation_service_v3.ts new file mode 100644 index 00000000000..640f81602c7 --- /dev/null +++ b/packages/google-cloud-translate/test/gapic_translation_service_v3.ts @@ -0,0 +1,2137 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translationserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +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); +} + +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('v3.TranslationServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + translationserviceModule.v3.TranslationServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + translationserviceModule.v3.TranslationServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = translationserviceModule.v3.TranslationServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new translationserviceModule.v3.TranslationServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.translationServiceStub, undefined); + await client.initialize(); + assert(client.translationServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.translationServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.translationServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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 translationserviceModule.v3.TranslationServiceClient({ + 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('translateText', () => { + it('invokes translateText without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateTextResponse() + ); + client.innerApiCalls.translateText = stubSimpleCall(expectedResponse); + const [response] = await client.translateText(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateText without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateTextResponse() + ); + client.innerApiCalls.translateText = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.translateText( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3.ITranslateTextResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateText with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.translateText = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.translateText(request), expectedError); + const actualRequest = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateText with closed client', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.translateText(request), expectedError); + }); + }); + + describe('detectLanguage', () => { + it('invokes detectLanguage without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.DetectLanguageResponse() + ); + client.innerApiCalls.detectLanguage = stubSimpleCall(expectedResponse); + const [response] = await client.detectLanguage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectLanguage without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.DetectLanguageResponse() + ); + client.innerApiCalls.detectLanguage = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detectLanguage( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3.IDetectLanguageResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectLanguage with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detectLanguage = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.detectLanguage(request), expectedError); + const actualRequest = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectLanguage with closed client', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.detectLanguage(request), expectedError); + }); + }); + + describe('getSupportedLanguages', () => { + it('invokes getSupportedLanguages without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.SupportedLanguages() + ); + client.innerApiCalls.getSupportedLanguages = + stubSimpleCall(expectedResponse); + const [response] = await client.getSupportedLanguages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSupportedLanguages without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.SupportedLanguages() + ); + client.innerApiCalls.getSupportedLanguages = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSupportedLanguages( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3.ISupportedLanguages | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSupportedLanguages with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSupportedLanguages = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getSupportedLanguages(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSupportedLanguages with closed client', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getSupportedLanguages(request), + expectedError + ); + }); + }); + + describe('translateDocument', () => { + it('invokes translateDocument without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentResponse() + ); + client.innerApiCalls.translateDocument = stubSimpleCall(expectedResponse); + const [response] = await client.translateDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateDocument without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentResponse() + ); + client.innerApiCalls.translateDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.translateDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3.ITranslateDocumentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateDocument with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.translateDocument = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.translateDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateDocument with closed client', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.translateDocument(request), expectedError); + }); + }); + + describe('getGlossary', () => { + it('invokes getGlossary without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ); + client.innerApiCalls.getGlossary = stubSimpleCall(expectedResponse); + const [response] = await client.getGlossary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGlossary without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ); + client.innerApiCalls.getGlossary = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGlossary( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3.IGlossary | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGlossary with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGlossary = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getGlossary(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGlossary with closed client', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGlossary(request), expectedError); + }); + }); + + describe('batchTranslateText', () => { + it('invokes batchTranslateText without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateText = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchTranslateText(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateText without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateText = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchTranslateText( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3.IBatchTranslateResponse, + protos.google.cloud.translation.v3.IBatchTranslateMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateText with call error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateText = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchTranslateText(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateText with LRO error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateText = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchTranslateText(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchTranslateTextProgress without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkBatchTranslateTextProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchTranslateTextProgress with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkBatchTranslateTextProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchTranslateDocument', () => { + it('invokes batchTranslateDocument without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchTranslateDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateDocument without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchTranslateDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3.IBatchTranslateDocumentMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateDocument with call error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchTranslateDocument(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateDocument with LRO error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchTranslateDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchTranslateDocumentProgress without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkBatchTranslateDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchTranslateDocumentProgress with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkBatchTranslateDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createGlossary', () => { + it('invokes createGlossary without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGlossary = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createGlossary(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGlossary without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGlossary = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGlossary( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3.IGlossary, + protos.google.cloud.translation.v3.ICreateGlossaryMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGlossary with call error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGlossary = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createGlossary(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGlossary with LRO error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGlossary = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createGlossary(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateGlossaryProgress without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkCreateGlossaryProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateGlossaryProgress with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkCreateGlossaryProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteGlossary', () => { + it('invokes deleteGlossary without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGlossary = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGlossary(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGlossary without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGlossary = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGlossary( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3.IDeleteGlossaryMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGlossary with call error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGlossary = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteGlossary(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGlossary with LRO error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGlossary = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteGlossary(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteGlossaryProgress without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkDeleteGlossaryProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteGlossaryProgress with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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.checkDeleteGlossaryProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listGlossaries', () => { + it('invokes listGlossaries without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + ]; + client.innerApiCalls.listGlossaries = stubSimpleCall(expectedResponse); + const [response] = await client.listGlossaries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGlossaries without error using callback', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + ]; + client.innerApiCalls.listGlossaries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGlossaries( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3.IGlossary[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGlossaries with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGlossaries = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listGlossaries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGlossariesStream without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + ]; + client.descriptors.page.listGlossaries.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGlossariesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.translation.v3.Glossary[] = []; + stream.on( + 'data', + (response: protos.google.cloud.translation.v3.Glossary) => { + 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.listGlossaries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGlossaries, request) + ); + assert( + (client.descriptors.page.listGlossaries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listGlossariesStream with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGlossaries.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGlossariesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.translation.v3.Glossary[] = []; + stream.on( + 'data', + (response: protos.google.cloud.translation.v3.Glossary) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listGlossaries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGlossaries, request) + ); + assert( + (client.descriptors.page.listGlossaries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGlossaries without error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3.Glossary() + ), + ]; + client.descriptors.page.listGlossaries.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.translation.v3.IGlossary[] = []; + const iterable = client.listGlossariesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGlossaries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGlossaries with error', async () => { + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGlossaries.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGlossariesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.translation.v3.IGlossary[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGlossaries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('glossary', () => { + const fakePath = '/rendered/path/glossary'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + glossary: 'glossaryValue', + }; + const client = new translationserviceModule.v3.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.glossaryPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.glossaryPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('glossaryPath', () => { + const result = client.glossaryPath( + 'projectValue', + 'locationValue', + 'glossaryValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.glossaryPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromGlossaryName', () => { + const result = client.matchProjectFromGlossaryName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.glossaryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromGlossaryName', () => { + const result = client.matchLocationFromGlossaryName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.glossaryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGlossaryFromGlossaryName', () => { + const result = client.matchGlossaryFromGlossaryName(fakePath); + assert.strictEqual(result, 'glossaryValue'); + assert( + (client.pathTemplates.glossaryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new translationserviceModule.v3.TranslationServiceClient({ + 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) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-translate/test/gapic_translation_service_v3beta1.ts b/packages/google-cloud-translate/test/gapic_translation_service_v3beta1.ts new file mode 100644 index 00000000000..ba1f72d388a --- /dev/null +++ b/packages/google-cloud-translate/test/gapic_translation_service_v3beta1.ts @@ -0,0 +1,2201 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 translationserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +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); +} + +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('v3beta1.TranslationServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + translationserviceModule.v3beta1.TranslationServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + translationserviceModule.v3beta1.TranslationServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + translationserviceModule.v3beta1.TranslationServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.translationServiceStub, undefined); + await client.initialize(); + assert(client.translationServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.translationServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.translationServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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 translationserviceModule.v3beta1.TranslationServiceClient({ + 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('translateText', () => { + it('invokes translateText without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateTextResponse() + ); + client.innerApiCalls.translateText = stubSimpleCall(expectedResponse); + const [response] = await client.translateText(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateText without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateTextResponse() + ); + client.innerApiCalls.translateText = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.translateText( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3beta1.ITranslateTextResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateText with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.translateText = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.translateText(request), expectedError); + const actualRequest = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateText with closed client', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.translateText(request), expectedError); + }); + }); + + describe('detectLanguage', () => { + it('invokes detectLanguage without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DetectLanguageResponse() + ); + client.innerApiCalls.detectLanguage = stubSimpleCall(expectedResponse); + const [response] = await client.detectLanguage(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectLanguage without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DetectLanguageResponse() + ); + client.innerApiCalls.detectLanguage = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detectLanguage( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3beta1.IDetectLanguageResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectLanguage with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detectLanguage = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.detectLanguage(request), expectedError); + const actualRequest = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectLanguage as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectLanguage with closed client', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DetectLanguageRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.detectLanguage(request), expectedError); + }); + }); + + describe('getSupportedLanguages', () => { + it('invokes getSupportedLanguages without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.SupportedLanguages() + ); + client.innerApiCalls.getSupportedLanguages = + stubSimpleCall(expectedResponse); + const [response] = await client.getSupportedLanguages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSupportedLanguages without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.SupportedLanguages() + ); + client.innerApiCalls.getSupportedLanguages = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSupportedLanguages( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3beta1.ISupportedLanguages | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSupportedLanguages with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSupportedLanguages = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getSupportedLanguages(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSupportedLanguages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSupportedLanguages with closed client', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getSupportedLanguages(request), + expectedError + ); + }); + }); + + describe('translateDocument', () => { + it('invokes translateDocument without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateDocumentResponse() + ); + client.innerApiCalls.translateDocument = stubSimpleCall(expectedResponse); + const [response] = await client.translateDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateDocument without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateDocumentResponse() + ); + client.innerApiCalls.translateDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.translateDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3beta1.ITranslateDocumentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateDocument with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.translateDocument = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.translateDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.translateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes translateDocument with closed client', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.TranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.TranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.translateDocument(request), expectedError); + }); + }); + + describe('getGlossary', () => { + it('invokes getGlossary without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ); + client.innerApiCalls.getGlossary = stubSimpleCall(expectedResponse); + const [response] = await client.getGlossary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGlossary without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ); + client.innerApiCalls.getGlossary = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGlossary( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3beta1.IGlossary | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGlossary with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGlossary = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getGlossary(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getGlossary with closed client', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.GetGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getGlossary(request), expectedError); + }); + }); + + describe('batchTranslateText', () => { + it('invokes batchTranslateText without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateText = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchTranslateText(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateText without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateText = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchTranslateText( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateText with call error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateText = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchTranslateText(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateText with LRO error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateTextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateText = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchTranslateText(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateText as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchTranslateTextProgress without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkBatchTranslateTextProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchTranslateTextProgress with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkBatchTranslateTextProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchTranslateDocument', () => { + it('invokes batchTranslateDocument without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchTranslateDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateDocument without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchTranslateDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchTranslateDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentResponse, + protos.google.cloud.translation.v3beta1.IBatchTranslateDocumentMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateDocument with call error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchTranslateDocument(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchTranslateDocument with LRO error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.BatchTranslateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchTranslateDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchTranslateDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchTranslateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchTranslateDocumentProgress without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkBatchTranslateDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchTranslateDocumentProgress with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkBatchTranslateDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createGlossary', () => { + it('invokes createGlossary without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGlossary = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createGlossary(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGlossary without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createGlossary = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGlossary( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3beta1.IGlossary, + protos.google.cloud.translation.v3beta1.ICreateGlossaryMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGlossary with call error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGlossary = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createGlossary(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createGlossary with LRO error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.CreateGlossaryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGlossary = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createGlossary(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateGlossaryProgress without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkCreateGlossaryProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateGlossaryProgress with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkCreateGlossaryProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteGlossary', () => { + it('invokes deleteGlossary without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGlossary = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGlossary(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGlossary without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteGlossary = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGlossary( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.translation.v3beta1.IDeleteGlossaryResponse, + protos.google.cloud.translation.v3beta1.IDeleteGlossaryMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGlossary with call error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGlossary = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteGlossary(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteGlossary with LRO error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.DeleteGlossaryRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGlossary = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteGlossary(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGlossary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteGlossaryProgress without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkDeleteGlossaryProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteGlossaryProgress with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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.checkDeleteGlossaryProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listGlossaries', () => { + it('invokes listGlossaries without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + ]; + client.innerApiCalls.listGlossaries = stubSimpleCall(expectedResponse); + const [response] = await client.listGlossaries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGlossaries without error using callback', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + ]; + client.innerApiCalls.listGlossaries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGlossaries( + request, + ( + err?: Error | null, + result?: protos.google.cloud.translation.v3beta1.IGlossary[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGlossaries with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGlossaries = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listGlossaries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGlossaries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listGlossariesStream without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + ]; + client.descriptors.page.listGlossaries.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGlossariesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.translation.v3beta1.Glossary[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.translation.v3beta1.Glossary) => { + 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.listGlossaries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGlossaries, request) + ); + assert( + (client.descriptors.page.listGlossaries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listGlossariesStream with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGlossaries.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGlossariesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.translation.v3beta1.Glossary[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.translation.v3beta1.Glossary) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listGlossaries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGlossaries, request) + ); + assert( + (client.descriptors.page.listGlossaries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGlossaries without error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + generateSampleMessage( + new protos.google.cloud.translation.v3beta1.Glossary() + ), + ]; + client.descriptors.page.listGlossaries.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.translation.v3beta1.IGlossary[] = []; + const iterable = client.listGlossariesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGlossaries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listGlossaries with error', async () => { + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.translation.v3beta1.ListGlossariesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGlossaries.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGlossariesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.translation.v3beta1.IGlossary[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGlossaries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('glossary', () => { + const fakePath = '/rendered/path/glossary'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + glossary: 'glossaryValue', + }; + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.glossaryPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.glossaryPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('glossaryPath', () => { + const result = client.glossaryPath( + 'projectValue', + 'locationValue', + 'glossaryValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.glossaryPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromGlossaryName', () => { + const result = client.matchProjectFromGlossaryName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.glossaryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromGlossaryName', () => { + const result = client.matchLocationFromGlossaryName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.glossaryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGlossaryFromGlossaryName', () => { + const result = client.matchGlossaryFromGlossaryName(fakePath); + assert.strictEqual(result, 'glossaryValue'); + assert( + (client.pathTemplates.glossaryPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new translationserviceModule.v3beta1.TranslationServiceClient({ + 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) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-translate/test/index.ts b/packages/google-cloud-translate/test/index.ts new file mode 100644 index 00000000000..24ebb33a826 --- /dev/null +++ b/packages/google-cloud-translate/test/index.ts @@ -0,0 +1,648 @@ +// Copyright 2015 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 {DecorateRequestOptions, util} from '@google-cloud/common'; +import { + BodyResponseCallback, + MakeRequestConfig, +} from '@google-cloud/common/build/src/util'; +import * as pfy from '@google-cloud/promisify'; +import * as assert from 'assert'; +import {after, afterEach, before, beforeEach, describe, it} from 'mocha'; +import * as extend from 'extend'; +import * as proxyquire from 'proxyquire'; +import * as r from 'request'; + +import * as orig from '../src'; + +// eslint-disable-next-line @typescript-eslint/no-var-requires +const pkgJson = require('../../package.json'); + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +let makeRequestOverride: any; +let promisified = false; +const fakePromisify = extend({}, pfy, { + promisifyAll(c: Function) { + if (c.name === 'Translate') { + promisified = true; + } + }, +}); + +const fakeUtil = extend({}, util, { + makeRequest( + opts: DecorateRequestOptions, + cfg: MakeRequestConfig, + cb: BodyResponseCallback + ) { + if (makeRequestOverride) { + return makeRequestOverride(opts, cfg, cb); + } + return util.makeRequest(opts, cfg, cb); + }, +}); +const originalFakeUtil = extend(true, {}, fakeUtil); + +class FakeService { + calledWith_: IArguments; + request?: Function; + constructor() { + // eslint-disable-next-line prefer-rest-params + this.calledWith_ = arguments; + } +} + +describe('Translate v2', () => { + const OPTIONS = { + projectId: 'test-project', + }; + + // tslint:disable-next-line variable-name + let Translate: typeof orig.v2.Translate; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let translate: any; + + before(() => { + Translate = proxyquire('../src/v2', { + '@google-cloud/common': { + util: fakeUtil, + Service: FakeService, + }, + '@google-cloud/promisify': fakePromisify, + }).Translate; + }); + + beforeEach(() => { + extend(fakeUtil, originalFakeUtil); + makeRequestOverride = null; + + translate = new Translate(OPTIONS); + }); + + describe('instantiation', () => { + it('should promisify all the things', () => { + assert(promisified); + }); + + it('should inherit from Service', () => { + assert(translate instanceof FakeService); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const calledWith = (translate as any).calledWith_[0]; + const baseUrl = + 'https://translation.googleapis.com/language/translate/v2'; + + assert.strictEqual(calledWith.baseUrl, baseUrl); + assert.deepStrictEqual(calledWith.scopes, [ + 'https://www.googleapis.com/auth/cloud-platform', + ]); + assert.deepStrictEqual(calledWith.packageJson, pkgJson); + assert.strictEqual(calledWith.projectIdRequired, false); + }); + + it('should allow apiEndpoint override', () => { + const apiEndpoint = 'fake.endpoint'; + translate = new Translate({ + projectId: 'test-project', + apiEndpoint, + }); + const calledWith = translate.calledWith_[0]; + assert.strictEqual(calledWith.apiEndpoint, apiEndpoint); + }); + + describe('Using an API Key', () => { + const KEY_OPTIONS = { + key: 'api-key', + }; + + beforeEach(() => { + translate = new Translate(KEY_OPTIONS); + }); + + it('should localize the options', () => { + const options = {key: '...'}; + const translate = new Translate(options); + assert.strictEqual(translate.options.key, options.key); + }); + + it('should localize the api key', () => { + assert.strictEqual(translate.key, KEY_OPTIONS.key); + }); + }); + + describe('GOOGLE_CLOUD_TRANSLATE_ENDPOINT', () => { + const CUSTOM_ENDPOINT = '...'; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let translate: any; + + before(() => { + process.env.GOOGLE_CLOUD_TRANSLATE_ENDPOINT = CUSTOM_ENDPOINT; + translate = new Translate(OPTIONS); + }); + + after(() => { + delete process.env.GOOGLE_CLOUD_TRANSLATE_ENDPOINT; + }); + + it('should correctly set the baseUrl', () => { + const baseUrl = translate.calledWith_[0].baseUrl; + + assert.strictEqual(baseUrl, CUSTOM_ENDPOINT); + }); + + it('should remove trailing slashes', () => { + const expectedBaseUrl = 'http://localhost:8080'; + + process.env.GOOGLE_CLOUD_TRANSLATE_ENDPOINT = 'http://localhost:8080//'; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const translate: any = new Translate(OPTIONS); + const baseUrl = translate.calledWith_[0].baseUrl; + + assert.strictEqual(baseUrl, expectedBaseUrl); + }); + }); + }); + + describe('detect', () => { + const INPUT = 'input'; + + it('should make the correct API request', done => { + translate.request = (reqOpts: r.OptionsWithUri) => { + assert.strictEqual(reqOpts.uri, '/detect'); + assert.strictEqual(reqOpts.method, 'POST'); + assert.deepStrictEqual(reqOpts.json, {q: [INPUT]}); + done(); + }; + + translate.detect(INPUT, assert.ifError); + }); + + describe('error', () => { + const error = new Error('Error.'); + const apiResponse = {}; + + beforeEach(() => { + translate.request = (reqOpts: r.OptionsWithUri, callback: Function) => { + callback(error, apiResponse); + }; + }); + + it('should execute callback with error & API resp', done => { + translate.detect(INPUT, (err: Error, results: {}, apiResponse_: {}) => { + assert.strictEqual(err, error); + assert.strictEqual(results, null); + assert.strictEqual(apiResponse_, apiResponse); + done(); + }); + }); + }); + + describe('success', () => { + const apiResponse = { + data: { + detections: [ + [ + { + isReliable: true, + a: 'b', + c: 'd', + }, + ], + ], + }, + }; + + const originalApiResponse = extend({}, apiResponse); + + const expectedResults = { + a: 'b', + c: 'd', + input: INPUT, + }; + + beforeEach(() => { + translate.request = (reqOpts: {}, callback: Function) => { + callback(null, apiResponse); + }; + }); + + it('should execute callback with results & API response', done => { + translate.detect(INPUT, (err: Error, results: {}, apiResponse_: {}) => { + assert.ifError(err); + assert.deepStrictEqual(results, expectedResults); + assert.strictEqual(apiResponse_, apiResponse); + assert.deepStrictEqual(apiResponse_, originalApiResponse); + done(); + }); + }); + + it('should execute callback with multiple results', done => { + translate.detect([INPUT, INPUT], (err: Error, results: {}) => { + assert.ifError(err); + assert.deepStrictEqual(results, [expectedResults]); + done(); + }); + }); + + it('should return an array if input was an array', done => { + translate.detect( + [INPUT], + (err: Error, results: {}, apiResponse_: {}) => { + assert.ifError(err); + assert.deepStrictEqual(results, [expectedResults]); + assert.strictEqual(apiResponse_, apiResponse); + assert.deepStrictEqual(apiResponse_, originalApiResponse); + done(); + } + ); + }); + }); + }); + + describe('getLanguages', () => { + it('should make the correct API request', done => { + translate.request = (reqOpts: r.OptionsWithUri) => { + assert.strictEqual(reqOpts.uri, '/languages'); + assert.deepStrictEqual(reqOpts.qs, { + target: 'en', + }); + done(); + }; + + translate.getLanguages(assert.ifError); + }); + + it('should make the correct API request with target', done => { + translate.request = (reqOpts: r.OptionsWithUri) => { + assert.strictEqual(reqOpts.uri, '/languages'); + assert.deepStrictEqual(reqOpts.qs, { + target: 'es', + }); + done(); + }; + + translate.getLanguages('es', assert.ifError); + }); + + describe('error', () => { + const error = new Error('Error.'); + const apiResponse = {}; + + beforeEach(() => { + translate.request = (reqOpts: {}, callback: Function) => { + callback(error, apiResponse); + }; + }); + + it('should exec callback with error & API response', done => { + translate.getLanguages( + (err: Error, languages: {}, apiResponse_: {}) => { + assert.strictEqual(err, error); + assert.strictEqual(languages, null); + assert.strictEqual(apiResponse_, apiResponse); + done(); + } + ); + }); + }); + + describe('success', () => { + const apiResponse = { + data: { + languages: [ + { + language: 'en', + name: 'English', + }, + { + language: 'es', + name: 'Spanish', + }, + ], + }, + }; + + const expectedResults = [ + { + code: 'en', + name: 'English', + }, + { + code: 'es', + name: 'Spanish', + }, + ]; + + beforeEach(() => { + translate.request = (reqOpts: {}, callback: Function) => { + callback(null, apiResponse); + }; + }); + + it('should exec callback with languages', done => { + translate.getLanguages( + (err: Error, languages: {}, apiResponse_: {}) => { + assert.ifError(err); + assert.deepStrictEqual(languages, expectedResults); + assert.strictEqual(apiResponse_, apiResponse); + done(); + } + ); + }); + }); + }); + + describe('translate', () => { + const INPUT = 'Hello'; + const INPUT_HTML = 'Hello'; + const SOURCE_LANG_CODE = 'en'; + const TARGET_LANG_CODE = 'es'; + + const OPTIONS = { + from: SOURCE_LANG_CODE, + to: TARGET_LANG_CODE, + }; + + describe('options = target langauge', () => { + it('should make the correct API request', done => { + translate.request = (reqOpts: r.Options) => { + assert.strictEqual(reqOpts.json.target, TARGET_LANG_CODE); + done(); + }; + + translate.translate(INPUT, TARGET_LANG_CODE, assert.ifError); + }); + }); + + describe('options = { source & target }', () => { + it('should throw if `to` is not provided', () => { + assert.throws(() => { + translate.translate(INPUT, {from: SOURCE_LANG_CODE}, util.noop); + }, /A target language is required to perform a translation\./); + }); + + it('should make the correct API request', done => { + translate.request = (reqOpts: r.Options) => { + assert.strictEqual(reqOpts.json.source, SOURCE_LANG_CODE); + assert.strictEqual(reqOpts.json.target, TARGET_LANG_CODE); + done(); + }; + + translate.translate( + INPUT, + { + from: SOURCE_LANG_CODE, + to: TARGET_LANG_CODE, + }, + assert.ifError + ); + }); + }); + + describe('options.format', () => { + it('should default to text', done => { + translate.request = (reqOpts: r.Options) => { + assert.strictEqual(reqOpts.json.format, 'text'); + done(); + }; + + translate.translate(INPUT, OPTIONS, assert.ifError); + }); + + it('should recognize HTML', done => { + translate.request = (reqOpts: r.Options) => { + assert.strictEqual(reqOpts.json.format, 'html'); + done(); + }; + + translate.translate(INPUT_HTML, OPTIONS, assert.ifError); + }); + + it('should allow overriding the format', done => { + const options = extend({}, OPTIONS, { + format: 'custom format', + }); + + translate.request = (reqOpts: r.Options) => { + assert.strictEqual(reqOpts.json.format, options.format); + done(); + }; + + translate.translate(INPUT_HTML, options, assert.ifError); + }); + }); + + describe('options.model', () => { + it('should set the model option when available', done => { + const fakeOptions = { + model: 'nmt', + to: 'es', + }; + + translate.request = (reqOpts: r.Options) => { + assert.strictEqual(reqOpts.json.model, 'nmt'); + done(); + }; + + translate.translate(INPUT, fakeOptions, assert.ifError); + }); + }); + + it('should make the correct API request', done => { + translate.request = (reqOpts: r.OptionsWithUri) => { + assert.strictEqual(reqOpts.uri, ''); + assert.strictEqual(reqOpts.method, 'POST'); + assert.deepStrictEqual(reqOpts.json, { + q: [INPUT], + format: 'text', + source: SOURCE_LANG_CODE, + target: TARGET_LANG_CODE, + }); + done(); + }; + + translate.translate(INPUT, OPTIONS, assert.ifError); + }); + + describe('error', () => { + const error = new Error('Error.'); + const apiResponse = {}; + + beforeEach(() => { + translate.request = (reqOpts: r.Options, callback: Function) => { + callback(error, apiResponse); + }; + }); + + it('should exec callback with error & API response', done => { + translate.translate( + INPUT, + OPTIONS, + (err: Error, translations: {}, resp: r.Response) => { + assert.strictEqual(err, error); + assert.strictEqual(translations, null); + assert.strictEqual(resp, apiResponse); + done(); + } + ); + }); + }); + + describe('success', () => { + const apiResponse = { + data: { + translations: [ + { + translatedText: 'text', + a: 'b', + c: 'd', + }, + ], + }, + }; + + const expectedResults = apiResponse.data.translations[0].translatedText; + + beforeEach(() => { + translate.request = (reqOpts: r.Options, callback: Function) => { + callback(null, apiResponse); + }; + }); + + it('should execute callback with results & API response', done => { + translate.translate( + INPUT, + OPTIONS, + (err: Error, translations: {}, resp: r.Response) => { + assert.ifError(err); + assert.deepStrictEqual(translations, expectedResults); + assert.strictEqual(resp, apiResponse); + done(); + } + ); + }); + + it('should execute callback with multiple results', done => { + const input = [INPUT, INPUT]; + translate.translate(input, OPTIONS, (err: Error, translations: {}) => { + assert.ifError(err); + assert.deepStrictEqual(translations, [expectedResults]); + done(); + }); + }); + + it('should return an array if input was an array', done => { + translate.translate( + [INPUT], + OPTIONS, + (err: Error, translations: {}) => { + assert.ifError(err); + assert.deepStrictEqual(translations, [expectedResults]); + done(); + } + ); + }); + }); + }); + + describe('request', () => { + describe('OAuth mode', () => { + let request: Function; + + beforeEach(() => { + request = FakeService.prototype.request!; + }); + + afterEach(() => { + FakeService.prototype.request = request; + }); + + it('should make the correct request', done => { + const fakeOptions = { + uri: '/test', + a: 'b', + json: { + a: 'b', + }, + }; + + FakeService.prototype.request = ( + reqOpts: r.Options, + callback: Function + ) => { + assert.strictEqual(reqOpts, fakeOptions); + callback(); + }; + + translate.request(fakeOptions, done); + }); + }); + + describe('API key mode', () => { + const KEY_OPTIONS = { + key: 'api-key', + }; + + beforeEach(() => { + translate = new Translate(KEY_OPTIONS); + }); + + it('should make the correct request', done => { + const userAgent = 'user-agent/0.0.0'; + + const getUserAgentFn = fakeUtil.getUserAgentFromPackageJson; + fakeUtil.getUserAgentFromPackageJson = packageJson => { + fakeUtil.getUserAgentFromPackageJson = getUserAgentFn; + assert.deepStrictEqual(packageJson, pkgJson); + return userAgent; + }; + + const reqOpts = { + uri: '/test', + a: 'b', + c: 'd', + qs: { + a: 'b', + c: 'd', + }, + }; + + const expectedReqOpts = extend(true, {}, reqOpts, { + qs: { + key: translate.key, + }, + headers: { + 'User-Agent': userAgent, + }, + }); + + expectedReqOpts.uri = translate.baseUrl + reqOpts.uri; + + makeRequestOverride = ( + reqOpts: r.Options, + options: {}, + callback: Function + ) => { + assert.deepStrictEqual(reqOpts, expectedReqOpts); + assert.strictEqual(options, translate.options); + callback(); // done() + }; + + translate.request(reqOpts, done); + }); + }); + }); +}); diff --git a/packages/google-cloud-translate/tsconfig.json b/packages/google-cloud-translate/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/packages/google-cloud-translate/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-translate/webpack.config.js b/packages/google-cloud-translate/webpack.config.js new file mode 100644 index 00000000000..289fef92e44 --- /dev/null +++ b/packages/google-cloud-translate/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: 'TranslationService', + filename: './translation-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 6d97ebbeb08..6851cb877c8 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -30,6 +30,7 @@ "packages/google-cloud-resourcemanager": {}, "packages/google-cloud-security-publicca": {}, "packages/google-cloud-shell": {}, + "packages/google-cloud-translate": {}, "packages/google-cloud-videointelligence": {}, "packages/google-devtools-artifactregistry": {}, "packages/google-iam": {},