diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4415c028214..66c5fb48df5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -57,11 +57,10 @@ "packages/google-cloud-gkeconnect-gateway": "2.0.5", "packages/google-cloud-gkehub": "3.2.2", "packages/google-cloud-gkemulticloud": "0.1.4", - "packages/google-cloud-kms": "3.1.0", - "packages/google-cloud-ids": "2.1.2", "packages/google-cloud-iap": "2.0.3", "packages/google-cloud-ids": "2.1.2", "packages/google-cloud-iot": "3.1.2", + "packages/google-cloud-kms": "3.1.0", "packages/google-cloud-language": "5.1.2", "packages/google-cloud-lifesciences": "2.1.2", "packages/google-cloud-managedidentities": "2.1.3", @@ -81,6 +80,7 @@ "packages/google-cloud-phishingprotection": "3.0.6", "packages/google-cloud-policytroubleshooter": "2.0.6", "packages/google-cloud-privatecatalog": "2.0.4", + "packages/google-cloud-recaptchaenterprise": "3.1.1", "packages/google-cloud-recommender": "5.0.4", "packages/google-cloud-redis": "3.1.5", "packages/google-cloud-resourcemanager": "4.1.3", diff --git a/packages/google-cloud-recaptchaenterprise/.OwlBot.yaml b/packages/google-cloud-recaptchaenterprise/.OwlBot.yaml new file mode 100644 index 00000000000..11e36782453 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.OwlBot.yaml @@ -0,0 +1,21 @@ +# 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/recaptchaenterprise/(.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-recaptchaenterprise/$1 + diff --git a/packages/google-cloud-recaptchaenterprise/.eslintignore b/packages/google-cloud-recaptchaenterprise/.eslintignore new file mode 100644 index 00000000000..ea5b04aebe6 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ +samples/generated/ diff --git a/packages/google-cloud-recaptchaenterprise/.eslintrc.json b/packages/google-cloud-recaptchaenterprise/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-recaptchaenterprise/.gitattributes b/packages/google-cloud-recaptchaenterprise/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.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-recaptchaenterprise/.gitignore b/packages/google-cloud-recaptchaenterprise/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.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-recaptchaenterprise/.jsdoc.js b/packages/google-cloud-recaptchaenterprise/.jsdoc.js new file mode 100644 index 00000000000..fd8d38512d4 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.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/recaptcha-enterprise', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-recaptchaenterprise/.mocharc.js b/packages/google-cloud-recaptchaenterprise/.mocharc.js new file mode 100644 index 00000000000..cdb7b752160 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.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-recaptchaenterprise/.nycrc b/packages/google-cloud-recaptchaenterprise/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.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-recaptchaenterprise/.prettierignore b/packages/google-cloud-recaptchaenterprise/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-recaptchaenterprise/.prettierrc.js b/packages/google-cloud-recaptchaenterprise/.prettierrc.js new file mode 100644 index 00000000000..d546a4ad546 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.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-recaptchaenterprise/.repo-metadata.json b/packages/google-cloud-recaptchaenterprise/.repo-metadata.json new file mode 100644 index 00000000000..078cbb15f0b --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/.repo-metadata.json @@ -0,0 +1,16 @@ +{ + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/recaptcha-enterprise/latest", + "api_id": "recaptchaenterprise.googleapis.com", + "distribution_name": "@google-cloud/recaptcha-enterprise", + "release_level": "stable", + "default_version": "v1", + "language": "nodejs", + "name_pretty": "Google Cloud reCAPTCHA Enterprise", + "repo": "googleapis/google-cloud-node", + "product_documentation": "https://cloud.google.com/recaptcha-enterprise/docs/", + "requires_billing": true, + "name": "recaptcha-enterprise", + "issue_tracker": "https://github.com/googleapis/google-cloud-node/issues", + "api_shortname": "recaptchaenterprise", + "library_type": "GAPIC_AUTO" +} diff --git a/packages/google-cloud-recaptchaenterprise/CHANGELOG.md b/packages/google-cloud-recaptchaenterprise/CHANGELOG.md new file mode 100644 index 00000000000..42cf3fec26e --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/CHANGELOG.md @@ -0,0 +1,354 @@ +# Changelog + +[npm history][1] + +[1]: https://www.npmjs.com/package/@google-cloud/recaptcha-enterprise?activeTab=versions + +## [3.1.1](https://github.com/googleapis/nodejs-recaptcha-enterprise/compare/v3.1.0...v3.1.1) (2022-11-11) + + +### Bug Fixes + +* **deps:** Use google-gax v3.5.2 ([#415](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/415)) ([c6c07ec](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/c6c07ecfc53d1983dbd7d87a3a6e917629bf1cf3)) +* Regenerated protos JS and TS definitions ([#419](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/419)) ([932b9c7](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/932b9c7a3dcfd2fbed34647d2050c22a34e79b5a)) + +## [3.1.0](https://github.com/googleapis/nodejs-recaptcha-enterprise/compare/v3.0.4...v3.1.0) (2022-10-13) + + +### Features + +* Add RetrieveLegacySecretKey method ([#411](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/411)) ([2e8fa59](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/2e8fa599b514e9e666bd04d009dd503318c205e4)) + +## [3.0.4](https://github.com/googleapis/nodejs-recaptcha-enterprise/compare/v3.0.3...v3.0.4) (2022-09-22) + + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#403](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/403)) ([4e53af0](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/4e53af0efb857467f4100700243c269c2d35b2fd)) +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/1553)) ([#402](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/402)) ([a0508d7](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/a0508d77f3d4e46338b714555163b85c4d6871af)) +* Preserve default values in x-goog-request-params header ([#408](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/408)) ([53d8757](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/53d8757169e872522d8b1e6d2854bf75aac375fa)) +* use google-gax v3.3.0 ([a0508d7](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/a0508d77f3d4e46338b714555163b85c4d6871af)) + +## [3.0.3](https://github.com/googleapis/nodejs-recaptcha-enterprise/compare/v3.0.2...v3.0.3) (2022-08-23) + + +### Bug Fixes + +* better support for fallback mode ([#396](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/396)) ([a3dde75](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/a3dde75d3080a30c5613703041d48ec466403511)) +* change import long to require ([#398](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/398)) ([6d14b20](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/6d14b2030dd5ca2bf6fdc7ba72c45d05ac19bd1a)) +* remove pip install statements ([#1546](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/1546)) ([#401](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/401)) ([82e9ae9](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/82e9ae9361edbb1c98284d6946ae299fbf607faf)) + +## [3.0.2](https://github.com/googleapis/nodejs-recaptcha-enterprise/compare/v3.0.1...v3.0.2) (2022-06-30) + + +### Bug Fixes + +* **docs:** describe fallback rest option ([#387](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/387)) ([fe11f09](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/fe11f09fb6b12af1194ac63bccec4c6a79f5d9a4)) + +## [3.0.1](https://github.com/googleapis/nodejs-recaptcha-enterprise/compare/v3.0.0...v3.0.1) (2022-06-16) + + +### Bug Fixes + +* set the right field number for reCAPTCHA private password leak ([#385](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/385)) ([1d571f3](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/1d571f3eb1eeb8f83bb52a32a39ee527e8411af1)) + +## [3.0.0](https://github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.5.0...v3.0.0) (2022-05-19) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#374) +* rename parent to project in SearchRelatedAccountGroupMembershipsRequest (#370) +* remove key management API (#366) + +### Features + +* Add support for Password Check through the private_password_leak_verification field in the reCAPTCHA Assessment ([#376](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/376)) ([7c1583c](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/7c1583c6854d9a567fd135f5ba1629250fe5f8ce)) + + +### Bug Fixes + +* remove key management API ([#366](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/366)) ([44a5a4b](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/44a5a4be5ee8fedd9258d28cd2151f15961dba5c)) +* rename parent to project in SearchRelatedAccountGroupMembershipsRequest ([#370](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/370)) ([aad0883](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/aad0883aa839e16ab76c3057678cf7583652466a)) + + +### Build System + +* update library to use Node 12 ([#374](https://github.com/googleapis/nodejs-recaptcha-enterprise/issues/374)) ([4042ae2](https://github.com/googleapis/nodejs-recaptcha-enterprise/commit/4042ae2304c92b7c74187c3874807be80ad72537)) + +## [2.5.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.4.0...v2.5.0) (2021-12-10) + + +### Features + +* add new reCAPTCHA Enterprise fraud annotations ([#334](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/334)) ([24fdff1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/24fdff1520fb8ff3192be7d256f7a7875d5803b6)) + +## [2.4.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.3.0...v2.4.0) (2021-11-09) + + +### Features + +* add reCAPTCHA Enterprise account defender API methods ([#328](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/328)) ([2099c50](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/2099c503c2bb91347761b083140c66f22b042a0d)) + +## [2.3.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.2.1...v2.3.0) (2021-09-16) + + +### Features + +* add GetMetrics and MigrateKey methods to reCAPTCHA enterprise API ([#318](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/318)) ([55b1adc](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/55b1adc261879db1b073f3ad9cd3453c09d1e8d8)) + +### [2.2.1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.2.0...v2.2.1) (2021-09-09) + + +### Bug Fixes + +* **build:** switch primary branch to main ([#315](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/315)) ([2fc99ad](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/2fc99ad6d478bc98f8d3cf39ba19780b13449db3)) + +## [2.2.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.7...v2.2.0) (2021-08-23) + + +### Features + +* turns on self-signed JWT feature flag ([#311](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/311)) ([c12da34](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/c12da3410a4ebc87884d9caaaba7c700b396c6b4)) + +### [2.1.7](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.6...v2.1.7) (2021-08-17) + + +### Bug Fixes + +* **deps:** google-gax v2.24.1 ([#309](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/309)) ([de80090](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/de800902327bad13ee6145ecbbb6b90d11cb8f59)) + +### [2.1.6](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.5...v2.1.6) (2021-07-16) + + +### Bug Fixes + +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#299](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/299)) ([6787e23](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/6787e23374c3ef97b4f267bf629ae03bf58f321a)) + +### [2.1.5](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.4...v2.1.5) (2021-07-12) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#297](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/297)) ([15640f1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/15640f1a4a931caa9ece4b749994e7d6d609200e)) + +### [2.1.4](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.3...v2.1.4) (2021-06-30) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#294](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/294)) ([45c12e5](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/45c12e5a7f9dbb40f054f7a4d9da0477010f6b00)) + +### [2.1.3](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.2...v2.1.3) (2021-06-24) + + +### Bug Fixes + +* make request optional in all cases ([#290](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/290)) ([e18a1d1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/e18a1d1131bed1ce355f9e91811a68b0799ca696)) + +### [2.1.2](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.1...v2.1.2) (2021-05-25) + + +### Bug Fixes + +* GoogleAdsError missing using generator version after 1.3.0 ([#279](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/279)) ([6dc35a7](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/6dc35a7c158b3981d7854969d37ff0ddebbbe6de)) + +### [2.1.1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.1.0...v2.1.1) (2021-05-12) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#270](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/270)) ([ab16a25](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/ab16a254b7da037039a51277495e65bbc983f1c7)) +* use require() to load JSON protos ([#273](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/273)) ([fdbc0fe](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/fdbc0fe7d12c1f70f3f592028c30c455a1526ee2)) + +## [2.1.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.0.3...v2.1.0) (2021-01-07) + + +### Features + +* introduces style enumeration ([#234](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/234)) ([35f1bb6](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/35f1bb6de0d16a10cc9e18ab7cf5aadd332bd0d8)) + +### [2.0.3](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.0.2...v2.0.3) (2020-11-25) + + +### Bug Fixes + +* **browser:** check for fetch on window ([#226](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/226)) ([8eb79dd](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/8eb79dd2b9f1eb7d4848aef63bf3bf236928fc67)) + +### [2.0.2](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.0.1...v2.0.2) (2020-11-06) + + +### Bug Fixes + +* do not modify options object, use defaultScopes ([#222](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/222)) ([807b692](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/807b6925ce52d14b3e7b2afa75fc54da805ce604)) + +### [2.0.1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v2.0.0...v2.0.1) (2020-07-06) + + +### Bug Fixes + +* proper fallback option handling ([#180](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/180)) ([52fe53d](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/52fe53d93402d247036b31badde5d57fa4f1ee78)) + +## [2.0.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.8.0...v2.0.0) (2020-05-12) + + +### ⚠ BREAKING CHANGES + +* Remove RecaptchaEnterpriseServiceV1Beta1Client. +* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. + +### Features + +* drop node8 support, support for async iterators ([#145](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/145)) ([cc4cc51](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/cc4cc51ec7b1ff8d5078b8524a9e7240639d72c3)) + + +### Bug Fixes + +* export explicit version from protos.js ([#150](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/150)) ([0bfb3c7](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/0bfb3c74a6eaaa906ee34224675ea8dad2e5a055)) +* regen protos and tests, formatting ([#169](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/169)) ([731fe3b](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/731fe3b8236478772a7cc311d0c26ee804080184)) +* remove eslint, update gax, fix generated protos, run the generator ([#155](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/155)) ([21b09f5](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/21b09f555632c6f36d1a487ccac3567064077a49)) +* synth.py clean up for multiple version ([#172](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/172)) ([ee1c250](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/ee1c2509b43b340a731aa98674ebceeab5ccdb2a)) + +## [1.8.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.7.0...v1.8.0) (2020-03-25) + + +### Features + +* add the v1 API surface ([#141](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/141)) ([bb1bd33](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/bb1bd33c1f51d37ca8db15ce7579259560250530)) + +## [1.7.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.6.0...v1.7.0) (2020-03-10) + + +### Features + +* deferred client initialization ([#128](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/128)) ([3de999e](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/3de999e1d4efc823dd52844a7ee19ec9b8c3ebfd)) + +## [1.6.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.5.3...v1.6.0) (2020-03-05) + + +### Features + +* export protos in src/index.ts ([ffd77ca](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/ffd77caffcec5d341517e7b82e58d1c50288ea22)) + +### [1.5.3](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.5.2...v1.5.3) (2020-02-12) + + +### Bug Fixes + +* pass x-goog-request-params header for streaming calls ([983411e](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/983411e0a115c6be6fe9ac0001d333bfef5e81a8)) + +### [1.5.2](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.5.1...v1.5.2) (2020-01-28) + + +### Bug Fixes + +* enum, bytes, and Long types now accept strings ([394cfd8](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/394cfd824a655245d1430afd68682b51e99b90d3)) + +### [1.5.1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.5.0...v1.5.1) (2020-01-09) + + +### Bug Fixes + +* proper routing headers ([4d1b1d3](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/4d1b1d31da7e5ca064ad2d26f0a1b1103251bdfa)) + +## [1.5.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.4.0...v1.5.0) (2020-01-02) + + +### Features + +* move to typescript code generation ([#87](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/87)) ([11051db](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/11051db91512f6abb21988d6b7049ce9904a656c)) + +## [1.4.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.3.1...v1.4.0) (2019-12-10) + + +### Features + +* add crud support for keys ([#84](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/84)) ([adfc3f9](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/adfc3f954f79110ad73425e2da9381fa6c02152d)) +* add plural and singular resource descriptor ([#78](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/78)) ([a67ffa7](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/a67ffa751551f4d6346c806e82b2311030b7ab61)) + + +### Bug Fixes + +* **deps:** pin TypeScript below 3.7.0 ([0e96508](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/0e965087f253c8474143051c06a955d2797cbcf4)) +* **docs:** bump the release level to beta ([#76](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/76)) ([8a2e2c0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/8a2e2c005d5d73a57cff2056cc212736610060a6)) +* **docs:** snippets are now replaced in jsdoc comments ([#74](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/74)) ([b3c31fc](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/b3c31fced63701a8e70b5f0ce3373466626ee960)) + +### [1.3.1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.3.0...v1.3.1) (2019-10-22) + + +### Bug Fixes + +* **deps:** bump google-gax to 1.7.5 ([#68](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/68)) ([0605bb8](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/0605bb8ce6a246fb31f4d54f4fbc126f1924f331)) + +## [1.3.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.2.0...v1.3.0) (2019-10-12) + + +### Features + +* update scopes and classifications ([#60](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/60)) ([b216630](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/b216630a5abd910e908d0b81d0dfe24a4ddd66b5)) + + +### Bug Fixes + +* use compatible version of google-gax ([dfb174a](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/dfb174aa8848f66e83d4f9f125ce3b7aaac282e2)) + +## [1.2.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.1.4...v1.2.0) (2019-09-16) + + +### Features + +* load protos from JSON, grpc-fallback support ([7a4b2a6](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/7a4b2a6)) + +### [1.1.4](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.1.3...v1.1.4) (2019-08-26) + + +### Bug Fixes + +* include the correct version of node in a header ([#46](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/46)) ([2cc8099](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/2cc8099)) + +### [1.1.3](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.1.2...v1.1.3) (2019-08-05) + + +### Bug Fixes + +* allow calls with no request, add JSON proto ([ab643f8](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/ab643f8)) + +### [1.1.2](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.1.1...v1.1.2) (2019-06-26) + + +### Bug Fixes + +* **docs:** link to reference docs section on googleapis.dev ([#35](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/35)) ([14ada6b](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/14ada6b)) + +### [1.1.1](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.1.0...v1.1.1) (2019-06-14) + + +### Bug Fixes + +* **docs:** move to new client docs URL ([#32](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/32)) ([6a95276](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/6a95276)) + +## [1.1.0](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/compare/v1.0.0...v1.1.0) (2019-06-05) + + +### Features + +* support apiEndpoint override in client constructor ([#30](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/30)) ([1192afd](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/1192afd)) + +## 1.0.0 (2019-05-14) + + +### Bug Fixes + +* **deps:** update dependency google-gax to v1 ([#17](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/17)) ([0f9e159](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/0f9e159)) +* DEADLINE_EXCEEDED retry code is idempotent ([#10](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/10)) ([746151c](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/746151c)) +* do not retry request on DEADLINE_EXCEEDED ([a6e9f4a](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/a6e9f4a)) + + +### Build System + +* upgrade engines field to >=8.10.0 ([#2](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/issues/2)) ([94d6a49](https://www.github.com/googleapis/nodejs-recaptcha-enterprise/commit/94d6a49)) + + +### BREAKING CHANGES + +* upgrade engines field to >=8.10.0 (#2) diff --git a/packages/google-cloud-recaptchaenterprise/CODE_OF_CONDUCT.md b/packages/google-cloud-recaptchaenterprise/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..2add2547a81 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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-recaptchaenterprise/CONTRIBUTING.md b/packages/google-cloud-recaptchaenterprise/CONTRIBUTING.md new file mode 100644 index 00000000000..3f52f24fcca --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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 Google Cloud reCAPTCHA Enterprise 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=recaptchaenterprise.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-recaptchaenterprise/LICENSE b/packages/google-cloud-recaptchaenterprise/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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-recaptchaenterprise/README.md b/packages/google-cloud-recaptchaenterprise/README.md new file mode 100644 index 00000000000..e4866ae5969 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/README.md @@ -0,0 +1,154 @@ +[//]: # "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 + +# [Google Cloud reCAPTCHA Enterprise: 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/recaptcha-enterprise.svg)](https://www.npmjs.org/package/@google-cloud/recaptcha-enterprise) + + + + +reCAPTCHA Enterprise API client for Node.js + + +A comprehensive list of changes in each version may be found in +[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-recaptchaenterprise/CHANGELOG.md). + +* [Google Cloud reCAPTCHA Enterprise Node.js Client API Reference][client-docs] +* [Google Cloud reCAPTCHA Enterprise Documentation][product-docs] +* [github.com/googleapis/google-cloud-node/packages/google-cloud-recaptchaenterprise](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-recaptchaenterprise) + +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) + +* [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 Google Cloud reCAPTCHA Enterprise 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/recaptcha-enterprise +``` + + + + +## 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 | +| --------------------------- | --------------------------------- | ------ | +| Recaptcha_enterprise_service.annotate_assessment | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js,samples/README.md) | +| Recaptcha_enterprise_service.create_assessment | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js,samples/README.md) | +| Recaptcha_enterprise_service.create_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_key.js,samples/README.md) | +| Recaptcha_enterprise_service.delete_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.delete_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.delete_key.js,samples/README.md) | +| Recaptcha_enterprise_service.get_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_key.js,samples/README.md) | +| Recaptcha_enterprise_service.get_metrics | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js,samples/README.md) | +| Recaptcha_enterprise_service.list_keys | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_keys.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_keys.js,samples/README.md) | +| Recaptcha_enterprise_service.list_related_account_group_memberships | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js,samples/README.md) | +| Recaptcha_enterprise_service.list_related_account_groups | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js,samples/README.md) | +| Recaptcha_enterprise_service.migrate_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js,samples/README.md) | +| Recaptcha_enterprise_service.retrieve_legacy_secret_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js,samples/README.md) | +| Recaptcha_enterprise_service.search_related_account_group_memberships | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js,samples/README.md) | +| Recaptcha_enterprise_service.update_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.update_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.update_key.js,samples/README.md) | +| Recaptcha_enterprise_service_v1_beta1.annotate_assessment | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js,samples/README.md) | +| Recaptcha_enterprise_service_v1_beta1.create_assessment | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js,samples/README.md) | +| Recaptcha_enterprise_service_v1_beta1.create_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js,samples/README.md) | +| Recaptcha_enterprise_service_v1_beta1.delete_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js,samples/README.md) | +| Recaptcha_enterprise_service_v1_beta1.get_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js,samples/README.md) | +| Recaptcha_enterprise_service_v1_beta1.list_keys | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js,samples/README.md) | +| Recaptcha_enterprise_service_v1_beta1.update_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js,samples/README.md) | + + + +The [Google Cloud reCAPTCHA Enterprise 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/recaptcha-enterprise@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/recaptcha-enterprise/latest +[product-docs]: https://cloud.google.com/recaptcha-enterprise/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=recaptchaenterprise.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-recaptchaenterprise/linkinator.config.json b/packages/google-cloud-recaptchaenterprise/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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-recaptchaenterprise/package.json b/packages/google-cloud-recaptchaenterprise/package.json new file mode 100644 index 00000000000..b397bf38278 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/package.json @@ -0,0 +1,74 @@ +{ + "repository": { + "type": "git", + "directory": "packages/google-cloud-recaptchaenterprise", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, + "name": "@google-cloud/recaptcha-enterprise", + "version": "3.1.1", + "author": "Google LLC", + "description": "reCAPTCHA Enterprise API client for Node.js", + "main": "build/src/index.js", + "files": [ + "build/protos", + "build/src", + "AUTHORS", + "COPYING" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google recaptchaenterprise", + "recaptchaenterprise", + "reCAPTCHA Enterprise API" + ], + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^18.0.0", + "@types/sinon": "^10.0.0", + "c8": "^7.0.0", + "gts": "^3.1.0", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.0", + "jsdoc-region-tag": "^2.0.0", + "linkinator": "^4.0.0", + "mocha": "^9.2.2", + "null-loader": "^4.0.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^9.0.0", + "typescript": "^4.6.4", + "webpack": "^5.0.0", + "webpack-cli": "^4.0.0" + }, + "scripts": { + "lint": "gts check", + "fix": "gts fix", + "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test", + "system-test": "npm run compile && c8 mocha build/system-test", + "docs": "jsdoc -c .jsdoc.js", + "test": "c8 mocha build/test", + "docs-test": "linkinator docs", + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "predocs-test": "npm run docs", + "prepare": "npm run compile", + "prelint": "cd samples; npm link ../; npm install", + "precompile": "gts clean" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-recaptchaenterprise" +} diff --git a/packages/google-cloud-recaptchaenterprise/protos/google/cloud/common_resources.proto b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto new file mode 100644 index 00000000000..9376f342ce5 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -0,0 +1,998 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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.recaptchaenterprise.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.RecaptchaEnterprise.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1;recaptchaenterprise"; +option java_multiple_files = true; +option java_outer_classname = "RecaptchaEnterpriseProto"; +option java_package = "com.google.recaptchaenterprise.v1"; +option objc_class_prefix = "GCRE"; +option php_namespace = "Google\\Cloud\\RecaptchaEnterprise\\V1"; +option ruby_package = "Google::Cloud::RecaptchaEnterprise::V1"; + +// Service to determine the likelihood an event is legitimate. +service RecaptchaEnterpriseService { + option (google.api.default_host) = "recaptchaenterprise.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates an Assessment of the likelihood an event is legitimate. + rpc CreateAssessment(CreateAssessmentRequest) returns (Assessment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/assessments" + body: "assessment" + }; + option (google.api.method_signature) = "parent,assessment"; + } + + // Annotates a previously created Assessment to provide additional information + // on whether the event turned out to be authentic or fraudulent. + rpc AnnotateAssessment(AnnotateAssessmentRequest) returns (AnnotateAssessmentResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/assessments/*}:annotate" + body: "*" + }; + option (google.api.method_signature) = "name,annotation"; + } + + // Creates a new reCAPTCHA Enterprise key. + rpc CreateKey(CreateKeyRequest) returns (Key) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/keys" + body: "key" + }; + } + + // Returns the list of all keys that belong to a project. + rpc ListKeys(ListKeysRequest) returns (ListKeysResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/keys" + }; + } + + // Returns the secret key related to the specified public key. + // You must use the legacy secret key only in a 3rd party integration with + // legacy reCAPTCHA. + rpc RetrieveLegacySecretKey(RetrieveLegacySecretKeyRequest) returns (RetrieveLegacySecretKeyResponse) { + option (google.api.http) = { + get: "/v1/{key=projects/*/keys/*}:retrieveLegacySecretKey" + }; + option (google.api.method_signature) = "key"; + } + + // Returns the specified key. + rpc GetKey(GetKeyRequest) returns (Key) { + option (google.api.http) = { + get: "/v1/{name=projects/*/keys/*}" + }; + } + + // Updates the specified key. + rpc UpdateKey(UpdateKeyRequest) returns (Key) { + option (google.api.http) = { + patch: "/v1/{key.name=projects/*/keys/*}" + body: "key" + }; + } + + // Deletes the specified key. + rpc DeleteKey(DeleteKeyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/keys/*}" + }; + } + + // Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. + // Once a key is migrated, it can be used from either product. SiteVerify + // requests are billed as CreateAssessment calls. You must be + // authenticated as one of the current owners of the reCAPTCHA Site Key, and + // your user must have the reCAPTCHA Enterprise Admin IAM role in the + // destination project. + rpc MigrateKey(MigrateKeyRequest) returns (Key) { + option (google.api.http) = { + post: "/v1/{name=projects/*/keys/*}:migrate" + body: "*" + }; + } + + // Get some aggregated metrics for a Key. This data can be used to build + // dashboards. + rpc GetMetrics(GetMetricsRequest) returns (Metrics) { + option (google.api.http) = { + get: "/v1/{name=projects/*/keys/*/metrics}" + }; + option (google.api.method_signature) = "name"; + } + + // List groups of related accounts. + rpc ListRelatedAccountGroups(ListRelatedAccountGroupsRequest) returns (ListRelatedAccountGroupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/relatedaccountgroups" + }; + option (google.api.method_signature) = "parent"; + } + + // Get memberships in a group of related accounts. + rpc ListRelatedAccountGroupMemberships(ListRelatedAccountGroupMembershipsRequest) returns (ListRelatedAccountGroupMembershipsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/relatedaccountgroups/*}/memberships" + }; + option (google.api.method_signature) = "parent"; + } + + // Search group memberships related to a given account. + rpc SearchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest) returns (SearchRelatedAccountGroupMembershipsResponse) { + option (google.api.http) = { + post: "/v1/{project=projects/*}/relatedaccountgroupmemberships:search" + body: "*" + }; + option (google.api.method_signature) = "project,hashed_account_id"; + } +} + +// The create assessment request message. +message CreateAssessmentRequest { + // Required. The name of the project in which the assessment will be created, + // in the format "projects/{project}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The assessment details. + Assessment assessment = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message to annotate an Assessment. +message AnnotateAssessmentRequest { + // Enum that represents the types of annotations. + enum Annotation { + // Default unspecified type. + ANNOTATION_UNSPECIFIED = 0; + + // Provides information that the event turned out to be legitimate. + LEGITIMATE = 1; + + // Provides information that the event turned out to be fraudulent. + FRAUDULENT = 2; + + // Provides information that the event was related to a login event in which + // the user typed the correct password. Deprecated, prefer indicating + // CORRECT_PASSWORD through the reasons field instead. + PASSWORD_CORRECT = 3 [deprecated = true]; + + // Provides information that the event was related to a login event in which + // the user typed the incorrect password. Deprecated, prefer indicating + // INCORRECT_PASSWORD through the reasons field instead. + PASSWORD_INCORRECT = 4 [deprecated = true]; + } + + // Enum that represents potential reasons for annotating an assessment. + enum Reason { + // Default unspecified reason. + REASON_UNSPECIFIED = 0; + + // Indicates that the transaction had a chargeback issued with no other + // details. When possible, specify the type by using CHARGEBACK_FRAUD or + // CHARGEBACK_DISPUTE instead. + CHARGEBACK = 1; + + // Indicates that the transaction had a chargeback issued related to an + // alleged unauthorized transaction from the cardholder's perspective (for + // example, the card number was stolen). + CHARGEBACK_FRAUD = 8; + + // Indicates that the transaction had a chargeback issued related to the + // cardholder having provided their card details but allegedly not being + // satisfied with the purchase (for example, misrepresentation, attempted + // cancellation). + CHARGEBACK_DISPUTE = 9; + + // Indicates that the completed payment transaction was refunded by the + // seller. + REFUND = 10; + + // Indicates that the completed payment transaction was determined to be + // fraudulent by the seller, and was cancelled and refunded as a result. + REFUND_FRAUD = 11; + + // Indicates that the payment transaction was accepted, and the user was + // charged. + TRANSACTION_ACCEPTED = 12; + + // Indicates that the payment transaction was declined, for example due to + // invalid card details. + TRANSACTION_DECLINED = 13; + + // Indicates the transaction associated with the assessment is suspected of + // being fraudulent based on the payment method, billing details, shipping + // address or other transaction information. + PAYMENT_HEURISTICS = 2; + + // Indicates that the user was served a 2FA challenge. An old assessment + // with `ENUM_VALUES.INITIATED_TWO_FACTOR` reason that has not been + // overwritten with `PASSED_TWO_FACTOR` is treated as an abandoned 2FA flow. + // This is equivalent to `FAILED_TWO_FACTOR`. + INITIATED_TWO_FACTOR = 7; + + // Indicates that the user passed a 2FA challenge. + PASSED_TWO_FACTOR = 3; + + // Indicates that the user failed a 2FA challenge. + FAILED_TWO_FACTOR = 4; + + // Indicates the user provided the correct password. + CORRECT_PASSWORD = 5; + + // Indicates the user provided an incorrect password. + INCORRECT_PASSWORD = 6; + + // Indicates that the user sent unwanted and abusive messages to other users + // of the platform, such as spam, scams, phishing, or social engineering. + SOCIAL_SPAM = 14; + } + + // Required. The resource name of the Assessment, in the format + // "projects/{project}/assessments/{assessment}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Assessment" + } + ]; + + // Optional. The annotation that will be assigned to the Event. This field can be left + // empty to provide reasons that apply to an event without concluding whether + // the event is legitimate or fraudulent. + Annotation annotation = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional reasons for the annotation that will be assigned to the Event. + repeated Reason reasons = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Unique stable hashed user identifier to apply to the assessment. + // This is an alternative to setting the hashed_account_id in + // CreateAssessment, for example when the account identifier is not yet known + // in the initial request. It is recommended that the identifier is hashed + // using hmac-sha256 with stable secret. + bytes hashed_account_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Empty response for AnnotateAssessment. +message AnnotateAssessmentResponse { + +} + +// Private password leak verification info. +message PrivatePasswordLeakVerification { + // Optional. Exactly 26-bit prefix of the SHA-256 hash of the canonicalized username. It + // is used to look up password leaks associated with that hash prefix. + bytes lookup_hash_prefix = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Encrypted Scrypt hash of the canonicalized username+password. It is + // re-encrypted by the server and returned through + // `reencrypted_user_credentials_hash`. + bytes encrypted_user_credentials_hash = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. List of prefixes of the encrypted potential password leaks that matched the + // given parameters. They must be compared with the client-side decryption + // prefix of `reencrypted_user_credentials_hash` + repeated bytes encrypted_leak_match_prefixes = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Corresponds to the re-encryption of the `encrypted_user_credentials_hash` + // field. It is used to match potential password leaks within + // `encrypted_leak_match_prefixes`. + bytes reencrypted_user_credentials_hash = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A recaptcha assessment resource. +message Assessment { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/Assessment" + pattern: "projects/{project}/assessments/{assessment}" + }; + + // Output only. The resource name for the Assessment in the format + // "projects/{project}/assessments/{assessment}". + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The event being assessed. + Event event = 2; + + // Output only. The risk analysis result for the event being assessed. + RiskAnalysis risk_analysis = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Properties of the provided event token. + TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Assessment returned by account defender when a hashed_account_id is + // provided. + AccountDefenderAssessment account_defender_assessment = 6; + + // The private password leak verification field contains the parameters that + // are used to to check for leaks privately without sharing user credentials. + PrivatePasswordLeakVerification private_password_leak_verification = 8; +} + +message Event { + // Optional. The user response token provided by the reCAPTCHA client-side integration + // on your site. + string token = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The site key that was used to invoke reCAPTCHA on your site and generate + // the token. + string site_key = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The user agent present in the request from the user's device related to + // this event. + string user_agent = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The IP address in the request from the user's device related to this event. + string user_ip_address = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The expected action for this type of event. This should be the same action + // provided at token generation time on client-side platforms already + // integrated with recaptcha enterprise. + string expected_action = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Unique stable hashed user identifier for the request. The identifier must + // be hashed using hmac-sha256 with stable secret. + bytes hashed_account_id = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Risk analysis result for an event. +message RiskAnalysis { + // Reasons contributing to the risk analysis verdict. + enum ClassificationReason { + // Default unspecified type. + CLASSIFICATION_REASON_UNSPECIFIED = 0; + + // Interactions matched the behavior of an automated agent. + AUTOMATION = 1; + + // The event originated from an illegitimate environment. + UNEXPECTED_ENVIRONMENT = 2; + + // Traffic volume from the event source is higher than normal. + TOO_MUCH_TRAFFIC = 3; + + // Interactions with the site were significantly different than expected + // patterns. + UNEXPECTED_USAGE_PATTERNS = 4; + + // Too little traffic has been received from this site thus far to generate + // quality risk analysis. + LOW_CONFIDENCE_SCORE = 5; + } + + // Legitimate event score from 0.0 to 1.0. + // (1.0 means very likely legitimate traffic while 0.0 means very likely + // non-legitimate traffic). + float score = 1; + + // Reasons contributing to the risk analysis verdict. + repeated ClassificationReason reasons = 2; +} + +message TokenProperties { + // Enum that represents the types of invalid token reasons. + enum InvalidReason { + // Default unspecified type. + INVALID_REASON_UNSPECIFIED = 0; + + // If the failure reason was not accounted for. + UNKNOWN_INVALID_REASON = 1; + + // The provided user verification token was malformed. + MALFORMED = 2; + + // The user verification token had expired. + EXPIRED = 3; + + // The user verification had already been seen. + DUPE = 4; + + // The user verification token was not present. + MISSING = 5; + + // A retriable error (such as network failure) occurred on the browser. + // Could easily be simulated by an attacker. + BROWSER_ERROR = 6; + } + + // Whether the provided user response token is valid. When valid = false, the + // reason could be specified in invalid_reason or it could also be due to + // a user failing to solve a challenge or a sitekey mismatch (i.e the sitekey + // used to generate the token was different than the one specified in the + // assessment). + bool valid = 1; + + // Reason associated with the response when valid = false. + InvalidReason invalid_reason = 2; + + // The timestamp corresponding to the generation of the token. + google.protobuf.Timestamp create_time = 3; + + // The hostname of the page on which the token was generated (Web keys only). + string hostname = 4; + + // Action name provided at token generation. + string action = 5; +} + +// Account defender risk assessment. +message AccountDefenderAssessment { + // Labels returned by account defender for this request. + enum AccountDefenderLabel { + // Default unspecified type. + ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0; + + // The request matches a known good profile for the user. + PROFILE_MATCH = 1; + + // The request is potentially a suspicious login event and must be further + // verified either through multi-factor authentication or another system. + SUSPICIOUS_LOGIN_ACTIVITY = 2; + + // The request matched a profile that previously had suspicious account + // creation behavior. This can mean that this is a fake account. + SUSPICIOUS_ACCOUNT_CREATION = 3; + + // The account in the request has a high number of related accounts. It does + // not necessarily imply that the account is bad but can require further + // investigation. + RELATED_ACCOUNTS_NUMBER_HIGH = 4; + } + + // Labels for this request. + repeated AccountDefenderLabel labels = 1; +} + +// The create key request message. +message CreateKeyRequest { + // Required. The name of the project in which the key will be created, in the + // format "projects/{project}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. Information to create a reCAPTCHA Enterprise key. + Key key = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The list keys request message. +message ListKeysRequest { + // Required. The name of the project that contains the keys that will be + // listed, in the format "projects/{project}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Optional. The maximum number of keys to return. Default is 10. Max limit is + // 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous. + // ListKeysRequest, if any. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response to request to list keys in a project. +message ListKeysResponse { + // Key details. + repeated Key keys = 1; + + // Token to retrieve the next page of results. It is set to empty if no keys + // remain in results. + string next_page_token = 2; +} + +// The retrieve legacy secret key request message. +message RetrieveLegacySecretKeyRequest { + // Required. The public key name linked to the requested secret key in the format + // "projects/{project}/keys/{key}". + string key = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + +// The get key request message. +message GetKeyRequest { + // Required. The name of the requested key, in the format + // "projects/{project}/keys/{key}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + +// The update key request message. +message UpdateKeyRequest { + // Required. The key to update. + Key key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields of the key get updated. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The delete key request message. +message DeleteKeyRequest { + // Required. The name of the key to be deleted, in the format + // "projects/{project}/keys/{key}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + +// The migrate key request message. +message MigrateKeyRequest { + // Required. The name of the key to be migrated, in the format + // "projects/{project}/keys/{key}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + +// The get metrics request message. +message GetMetricsRequest { + // Required. The name of the requested metrics, in the format + // "projects/{project}/keys/{key}/metrics". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Metrics" + } + ]; +} + +// Metrics for a single Key. +message Metrics { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/Metrics" + pattern: "projects/{project}/keys/{key}/metrics" + }; + + // Output only. The name of the metrics, in the format + // "projects/{project}/keys/{key}/metrics". + string name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Inclusive start time aligned to a day (UTC). + google.protobuf.Timestamp start_time = 1; + + // Metrics will be continuous and in order by dates, and in the granularity + // of day. All Key types should have score-based data. + repeated ScoreMetrics score_metrics = 2; + + // Metrics will be continuous and in order by dates, and in the granularity + // of day. Only challenge-based keys (CHECKBOX, INVISIBLE), will have + // challenge-based data. + repeated ChallengeMetrics challenge_metrics = 3; +} + +// Secret key is used only in legacy reCAPTCHA. It must be used in a 3rd party +// integration with legacy reCAPTCHA. +message RetrieveLegacySecretKeyResponse { + // The secret key (also known as shared secret) authorizes communication + // between your application backend and the reCAPTCHA Enterprise server to + // create an assessment. + // The secret key needs to be kept safe for security purposes. + string legacy_secret_key = 1; +} + +// A key used to identify and configure applications (web and/or mobile) that +// use reCAPTCHA Enterprise. +message Key { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/Key" + pattern: "projects/{project}/keys/{key}" + }; + + // The resource name for the Key in the format + // "projects/{project}/keys/{key}". + string name = 1; + + // Human-readable display name of this key. Modifiable by user. + string display_name = 2; + + // Platform specific settings for this key. The key can only be used on a + // platform for which the settings are enabled. + oneof platform_settings { + // Settings for keys that can be used by websites. + WebKeySettings web_settings = 3; + + // Settings for keys that can be used by Android apps. + AndroidKeySettings android_settings = 4; + + // Settings for keys that can be used by iOS apps. + IOSKeySettings ios_settings = 5; + } + + // See + // Creating and managing labels. + map labels = 6; + + // The timestamp corresponding to the creation of this Key. + google.protobuf.Timestamp create_time = 7; + + // Options for user acceptance testing. + TestingOptions testing_options = 9; + + // Settings for WAF + WafSettings waf_settings = 10; +} + +// Options for user acceptance testing. +message TestingOptions { + // Enum that represents the challenge option for challenge-based (CHECKBOX, + // INVISIBLE) testing keys. + enum TestingChallenge { + // Perform the normal risk analysis and return either nocaptcha or a + // challenge depending on risk and trust factors. + TESTING_CHALLENGE_UNSPECIFIED = 0; + + // Challenge requests for this key always return a nocaptcha, which + // does not require a solution. + NOCAPTCHA = 1; + + // Challenge requests for this key always return an unsolvable + // challenge. + UNSOLVABLE_CHALLENGE = 2; + } + + // All assessments for this Key will return this score. Must be between 0 + // (likely not legitimate) and 1 (likely legitimate) inclusive. + float testing_score = 1; + + // For challenge-based keys only (CHECKBOX, INVISIBLE), all challenge requests + // for this site will return nocaptcha if NOCAPTCHA, or an unsolvable + // challenge if CHALLENGE. + TestingChallenge testing_challenge = 2; +} + +// Settings specific to keys that can be used by websites. +message WebKeySettings { + // Enum that represents the integration types for web keys. + enum IntegrationType { + // Default type that indicates this enum hasn't been specified. This is not + // a valid IntegrationType, one of the other types must be specified + // instead. + INTEGRATION_TYPE_UNSPECIFIED = 0; + + // Only used to produce scores. It doesn't display the "I'm not a robot" + // checkbox and never shows captcha challenges. + SCORE = 1; + + // Displays the "I'm not a robot" checkbox and may show captcha challenges + // after it is checked. + CHECKBOX = 2; + + // Doesn't display the "I'm not a robot" checkbox, but may show captcha + // challenges after risk analysis. + INVISIBLE = 3; + } + + // Enum that represents the possible challenge frequency and difficulty + // configurations for a web key. + enum ChallengeSecurityPreference { + // Default type that indicates this enum hasn't been specified. + CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0; + + // Key tends to show fewer and easier challenges. + USABILITY = 1; + + // Key tends to show balanced (in amount and difficulty) challenges. + BALANCE = 2; + + // Key tends to show more and harder challenges. + SECURITY = 3; + } + + // If set to true, it means allowed_domains will not be enforced. + bool allow_all_domains = 3; + + // Domains or subdomains of websites allowed to use the key. All subdomains + // of an allowed domain are automatically allowed. A valid domain requires a + // host and must not include any path, port, query or fragment. + // Examples: 'example.com' or 'subdomain.example.com' + repeated string allowed_domains = 1; + + // If set to true, the key can be used on AMP (Accelerated Mobile Pages) + // websites. This is supported only for the SCORE integration type. + bool allow_amp_traffic = 2; + + // Required. Describes how this key is integrated with the website. + IntegrationType integration_type = 4 [(google.api.field_behavior) = REQUIRED]; + + // Settings for the frequency and difficulty at which this key triggers + // captcha challenges. This should only be specified for IntegrationTypes + // CHECKBOX and INVISIBLE. + ChallengeSecurityPreference challenge_security_preference = 5; +} + +// Settings specific to keys that can be used by Android apps. +message AndroidKeySettings { + // If set to true, allowed_package_names are not enforced. + bool allow_all_package_names = 2; + + // Android package names of apps allowed to use the key. + // Example: 'com.companyname.appname' + repeated string allowed_package_names = 1; +} + +// Settings specific to keys that can be used by iOS apps. +message IOSKeySettings { + // If set to true, allowed_bundle_ids are not enforced. + bool allow_all_bundle_ids = 2; + + // iOS bundle ids of apps allowed to use the key. + // Example: 'com.companyname.productname.appname' + repeated string allowed_bundle_ids = 1; +} + +// Score distribution. +message ScoreDistribution { + // Map key is score value multiplied by 100. The scores are discrete values + // between [0, 1]. The maximum number of buckets is on order of a few dozen, + // but typically much lower (ie. 10). + map score_buckets = 1; +} + +// Metrics related to scoring. +message ScoreMetrics { + // Aggregated score metrics for all traffic. + ScoreDistribution overall_metrics = 1; + + // Action-based metrics. The map key is the action name which specified by the + // site owners at time of the "execute" client-side call. + // Populated only for SCORE keys. + map action_metrics = 2; +} + +// Metrics related to challenges. +message ChallengeMetrics { + // Count of reCAPTCHA checkboxes or badges rendered. This is mostly equivalent + // to a count of pageloads for pages that include reCAPTCHA. + int64 pageload_count = 1; + + // Count of nocaptchas (successful verification without a challenge) issued. + int64 nocaptcha_count = 2; + + // Count of submitted challenge solutions that were incorrect or otherwise + // deemed suspicious such that a subsequent challenge was triggered. + int64 failed_count = 3; + + // Count of nocaptchas (successful verification without a challenge) plus + // submitted challenge solutions that were correct and resulted in + // verification. + int64 passed_count = 4; +} + +// The request message to list memberships in a related account group. +message ListRelatedAccountGroupMembershipsRequest { + // Required. The resource name for the related account group in the format + // `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + ]; + + // Optional. The maximum number of accounts to return. The service might return fewer + // than this value. + // If unspecified, at most 50 accounts are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + // call. + // + // When paginating, all other parameters provided to + // `ListRelatedAccountGroupMemberships` must match the call that provided the + // page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response to a `ListRelatedAccountGroupMemberships` call. +message ListRelatedAccountGroupMembershipsResponse { + // The memberships listed by the query. + repeated RelatedAccountGroupMembership related_account_group_memberships = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The request message to list related account groups. +message ListRelatedAccountGroupsRequest { + // Required. The name of the project to list related account groups from, in the format + // "projects/{project}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup" + } + ]; + + // Optional. The maximum number of groups to return. The service might return fewer than + // this value. + // If unspecified, at most 50 groups are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListRelatedAccountGroups` must match the call that provided the page + // token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response to a `ListRelatedAccountGroups` call. +message ListRelatedAccountGroupsResponse { + // The groups of related accounts listed by the query. + repeated RelatedAccountGroup related_account_groups = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The request message to search related account group memberships. +message SearchRelatedAccountGroupMembershipsRequest { + // Required. The name of the project to search related account group memberships from. + // Specify the project name in the following format: "projects/{project}". + string project = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + ]; + + // Optional. The unique stable hashed user identifier we should search connections to. + // The identifier should correspond to a `hashed_account_id` provided in a + // previous `CreateAssessment` or `AnnotateAssessment` call. + bytes hashed_account_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of groups to return. The service might return fewer than + // this value. + // If unspecified, at most 50 groups are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the + // subsequent page. + // + // When paginating, all other parameters provided to + // `SearchRelatedAccountGroupMemberships` must match the call that provided + // the page token. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response to a `SearchRelatedAccountGroupMemberships` call. +message SearchRelatedAccountGroupMembershipsResponse { + // The queried memberships. + repeated RelatedAccountGroupMembership related_account_group_memberships = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// A membership in a group of related accounts. +message RelatedAccountGroupMembership { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}" + }; + + // Required. The resource name for this membership in the format + // `projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + ]; + + // The unique stable hashed user identifier of the member. The identifier + // corresponds to a `hashed_account_id` provided in a previous + // `CreateAssessment` or `AnnotateAssessment` call. + bytes hashed_account_id = 2; +} + +// A group of related accounts. +message RelatedAccountGroup { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup" + pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}" + }; + + // Required. The resource name for the related account group in the format + // `projects/{project}/relatedaccountgroups/{related_account_group}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup" + } + ]; +} + +// Settings specific to keys that can be used for WAF (Web Application +// Firewall). +message WafSettings { + // Supported WAF features. For more information, see + // https://cloud.google.com/recaptcha-enterprise/docs/usecase#comparison_of_features. + enum WafFeature { + // Undefined feature. + WAF_FEATURE_UNSPECIFIED = 0; + + // Redirects suspicious traffic to reCAPTCHA. + CHALLENGE_PAGE = 1; + + // Use reCAPTCHA session-tokens to protect the whole user session on the + // site's domain. + SESSION_TOKEN = 2; + + // Use reCAPTCHA action-tokens to protect user actions. + ACTION_TOKEN = 3; + } + + // Web Application Firewalls supported by reCAPTCHA Enterprise. + enum WafService { + // Undefined WAF + WAF_SERVICE_UNSPECIFIED = 0; + + // Cloud Armor + CA = 1; + } + + // Required. The WAF service that uses this key. + WafService waf_service = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The WAF feature for which this key is enabled. + WafFeature waf_feature = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto new file mode 100644 index 00000000000..28a07a8e51b --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto @@ -0,0 +1,350 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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.recaptchaenterprise.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.RecaptchaEnterprise.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1;recaptchaenterprise"; +option java_multiple_files = true; +option java_outer_classname = "RecaptchaEnterpriseProto"; +option java_package = "com.google.recaptchaenterprise.v1beta1"; +option objc_class_prefix = "GCRE"; +option php_namespace = "Google\\Cloud\\RecaptchaEnterprise\\V1beta1"; +option ruby_package = "Google::Cloud::RecaptchaEnterprise::V1beta1"; + +// Service to determine the likelihood an event is legitimate. +service RecaptchaEnterpriseServiceV1Beta1 { + option (google.api.default_host) = "recaptchaenterprise.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates an Assessment of the likelihood an event is legitimate. + rpc CreateAssessment(CreateAssessmentRequest) returns (Assessment) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*}/assessments" + body: "assessment" + }; + option (google.api.method_signature) = "parent,assessment"; + } + + // Annotates a previously created Assessment to provide additional information + // on whether the event turned out to be authentic or fradulent. + rpc AnnotateAssessment(AnnotateAssessmentRequest) returns (AnnotateAssessmentResponse) { + option (google.api.http) = { + post: "/v1beta1/{name=projects/*/assessments/*}:annotate" + body: "*" + }; + option (google.api.method_signature) = "name,annotation"; + } +} + +// The create assessment request message. +message CreateAssessmentRequest { + // Required. The name of the project in which the assessment will be created, + // in the format "projects/{project_number}". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The assessment details. + Assessment assessment = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message to annotate an Assessment. +message AnnotateAssessmentRequest { + // Enum that represents the types of annotations. + enum Annotation { + // Default unspecified type. + ANNOTATION_UNSPECIFIED = 0; + + // Provides information that the event turned out to be legitimate. + LEGITIMATE = 1; + + // Provides information that the event turned out to be fraudulent. + FRAUDULENT = 2; + + // Provides information that the event was related to a login event in which + // the user typed the correct password. Deprecated, prefer indicating + // CORRECT_PASSWORD through the reasons field instead. + PASSWORD_CORRECT = 3 [deprecated = true]; + + // Provides information that the event was related to a login event in which + // the user typed the incorrect password. Deprecated, prefer indicating + // INCORRECT_PASSWORD through the reasons field instead. + PASSWORD_INCORRECT = 4 [deprecated = true]; + } + + // Enum that represents potential reasons for annotating an assessment. + enum Reason { + // Default unspecified reason. + REASON_UNSPECIFIED = 0; + + // Indicates a chargeback issued for the transaction with no other details. + // When possible, specify the type by using CHARGEBACK_FRAUD or + // CHARGEBACK_DISPUTE instead. + CHARGEBACK = 1; + + // Indicates a chargeback related to an alleged unauthorized transaction + // from the cardholder's perspective (for example, the card number was + // stolen). + CHARGEBACK_FRAUD = 8; + + // Indicates a chargeback related to the cardholder having provided their + // card details but allegedly not being satisfied with the purchase + // (for example, misrepresentation, attempted cancellation). + CHARGEBACK_DISPUTE = 9; + + // Indicates the transaction associated with the assessment is suspected of + // being fraudulent based on the payment method, billing details, shipping + // address or other transaction information. + PAYMENT_HEURISTICS = 2; + + // Indicates that the user was served a 2FA challenge. An old assessment + // with `ENUM_VALUES.INITIATED_TWO_FACTOR` reason that has not been + // overwritten with `PASSED_TWO_FACTOR` is treated as an abandoned 2FA flow. + // This is equivalent to `FAILED_TWO_FACTOR`. + INITIATED_TWO_FACTOR = 7; + + // Indicates that the user passed a 2FA challenge. + PASSED_TWO_FACTOR = 3; + + // Indicates that the user failed a 2FA challenge. + FAILED_TWO_FACTOR = 4; + + // Indicates the user provided the correct password. + CORRECT_PASSWORD = 5; + + // Indicates the user provided an incorrect password. + INCORRECT_PASSWORD = 6; + } + + // Required. The resource name of the Assessment, in the format + // "projects/{project_number}/assessments/{assessment_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Assessment" + } + ]; + + // Optional. The annotation that will be assigned to the Event. This field can be left + // empty to provide reasons that apply to an event without concluding whether + // the event is legitimate or fraudulent. + Annotation annotation = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional reasons for the annotation that will be assigned to the Event. + repeated Reason reasons = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional unique stable hashed user identifier to apply to the assessment. + // This is an alternative to setting the hashed_account_id in + // CreateAssessment, for example when the account identifier is not yet known + // in the initial request. It is recommended that the identifier is hashed + // using hmac-sha256 with stable secret. + bytes hashed_account_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Empty response for AnnotateAssessment. +message AnnotateAssessmentResponse { + +} + +// Password leak verification info. +message PasswordLeakVerification { + // Optional. Scrypt hash of the username+password that the customer wants to verify + // against a known password leak. + bytes hashed_user_credentials = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Whether or not the user's credentials are present in a known leak. + bool credentials_leaked = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The username part of the user credentials for which we want to trigger a + // leak check in canonicalized form. This is the same data used to create the + // hashed_user_credentials on the customer side. + string canonicalized_username = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A recaptcha assessment resource. +message Assessment { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/Assessment" + pattern: "projects/{project}/assessments/{assessment}" + }; + + // Reasons contributing to the risk analysis verdict. + enum ClassificationReason { + // Default unspecified type. + CLASSIFICATION_REASON_UNSPECIFIED = 0; + + // Interactions matched the behavior of an automated agent. + AUTOMATION = 1; + + // The event originated from an illegitimate environment. + UNEXPECTED_ENVIRONMENT = 2; + + // Traffic volume from the event source is higher than normal. + TOO_MUCH_TRAFFIC = 3; + + // Interactions with the site were significantly different than expected + // patterns. + UNEXPECTED_USAGE_PATTERNS = 4; + + // Too little traffic has been received from this site thus far to generate + // quality risk analysis. + LOW_CONFIDENCE_SCORE = 5; + } + + // Output only. The resource name for the Assessment in the format + // "projects/{project_number}/assessments/{assessment_id}". + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The event being assessed. + Event event = 2; + + // Output only. Legitimate event score from 0.0 to 1.0. + // (1.0 means very likely legitimate traffic while 0.0 means very likely + // non-legitimate traffic). + float score = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Properties of the provided event token. + TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Reasons contributing to the risk analysis verdict. + repeated ClassificationReason reasons = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Information about the user's credentials used to check for leaks. + // This feature is part of the Early Access Program (EAP). Exercise caution, + // and do not deploy integrations based on this feature in a production + // environment. + PasswordLeakVerification password_leak_verification = 7; + + // Assessment returned by Account Defender when a hashed_account_id is + // provided. + AccountDefenderAssessment account_defender_assessment = 8; +} + +message Event { + // Optional. The user response token provided by the reCAPTCHA client-side integration + // on your site. + string token = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The site key that was used to invoke reCAPTCHA on your site and generate + // the token. + string site_key = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The user agent present in the request from the user's device related to + // this event. + string user_agent = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The IP address in the request from the user's device related to this event. + string user_ip_address = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The expected action for this type of event. This should be the same action + // provided at token generation time on client-side platforms already + // integrated with recaptcha enterprise. + string expected_action = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional unique stable hashed user identifier for the request. The + // identifier should ideally be hashed using sha256 with stable secret. + bytes hashed_account_id = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +message TokenProperties { + // Enum that represents the types of invalid token reasons. + enum InvalidReason { + // Default unspecified type. + INVALID_REASON_UNSPECIFIED = 0; + + // If the failure reason was not accounted for. + UNKNOWN_INVALID_REASON = 1; + + // The provided user verification token was malformed. + MALFORMED = 2; + + // The user verification token had expired. + EXPIRED = 3; + + // The user verification had already been seen. + DUPE = 4; + + // The user verification token did not match the provided site key. + // This may be a configuration error (e.g. development keys used in + // production) or end users trying to use verification tokens from other + // sites. + SITE_MISMATCH = 5 [deprecated = true]; + + // The user verification token was not present. It is a required input. + MISSING = 6; + + // A retriable error (such as network failure) occurred on the browser. + // Could easily be simulated by an attacker. + BROWSER_ERROR = 7; + } + + // Whether the provided user response token is valid. When valid = false, the + // reason could be specified in invalid_reason or it could also be due to + // a user failing to solve a challenge or a sitekey mismatch (i.e the sitekey + // used to generate the token was different than the one specified in the + // assessment). + bool valid = 1; + + // Reason associated with the response when valid = false. + InvalidReason invalid_reason = 2; + + // The timestamp corresponding to the generation of the token. + google.protobuf.Timestamp create_time = 3; + + // The hostname of the page on which the token was generated. + string hostname = 4; + + // Action name provided at token generation. + string action = 5; +} + +// Account Defender risk assessment. +message AccountDefenderAssessment { + // Labels returned by Account Defender for this request. + enum AccountDefenderLabel { + // Default unspecified type. + ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0; + + // The request matches a known good profile for the user. + PROFILE_MATCH = 1; + + // The request is potentially a suspicious login event and should be further + // verified either via multi-factor authentication or another system. + SUSPICIOUS_LOGIN_ACTIVITY = 2; + + // The request matched a profile that previously had suspicious account + // creation behavior. This could mean this is a fake account. + SUSPICIOUS_ACCOUNT_CREATION = 3; + + // The account in the request has a high number of related accounts. It does + // not necessarily imply that the account is bad but could require + // investigating. + RELATED_ACCOUNTS_NUMBER_HIGH = 4; + } + + // Labels for this request. + repeated AccountDefenderLabel labels = 1; +} diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts b/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts new file mode 100644 index 00000000000..819d15cf6a6 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts @@ -0,0 +1,9694 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 recaptchaenterprise. */ + namespace recaptchaenterprise { + + /** Namespace v1. */ + namespace v1 { + + /** Represents a RecaptchaEnterpriseService */ + class RecaptchaEnterpriseService extends $protobuf.rpc.Service { + + /** + * Constructs a new RecaptchaEnterpriseService 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 RecaptchaEnterpriseService 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): RecaptchaEnterpriseService; + + /** + * Calls CreateAssessment. + * @param request CreateAssessmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Assessment + */ + public createAssessment(request: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateAssessmentCallback): void; + + /** + * Calls CreateAssessment. + * @param request CreateAssessmentRequest message or plain object + * @returns Promise + */ + public createAssessment(request: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest): Promise; + + /** + * Calls AnnotateAssessment. + * @param request AnnotateAssessmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnnotateAssessmentResponse + */ + public annotateAssessment(request: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.AnnotateAssessmentCallback): void; + + /** + * Calls AnnotateAssessment. + * @param request AnnotateAssessmentRequest message or plain object + * @returns Promise + */ + public annotateAssessment(request: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest): Promise; + + /** + * Calls CreateKey. + * @param request CreateKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Key + */ + public createKey(request: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateKeyCallback): void; + + /** + * Calls CreateKey. + * @param request CreateKeyRequest message or plain object + * @returns Promise + */ + public createKey(request: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest): Promise; + + /** + * Calls ListKeys. + * @param request ListKeysRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListKeysResponse + */ + public listKeys(request: google.cloud.recaptchaenterprise.v1.IListKeysRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListKeysCallback): void; + + /** + * Calls ListKeys. + * @param request ListKeysRequest message or plain object + * @returns Promise + */ + public listKeys(request: google.cloud.recaptchaenterprise.v1.IListKeysRequest): Promise; + + /** + * Calls RetrieveLegacySecretKey. + * @param request RetrieveLegacySecretKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and RetrieveLegacySecretKeyResponse + */ + public retrieveLegacySecretKey(request: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKeyCallback): void; + + /** + * Calls RetrieveLegacySecretKey. + * @param request RetrieveLegacySecretKeyRequest message or plain object + * @returns Promise + */ + public retrieveLegacySecretKey(request: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest): Promise; + + /** + * Calls GetKey. + * @param request GetKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Key + */ + public getKey(request: google.cloud.recaptchaenterprise.v1.IGetKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetKeyCallback): void; + + /** + * Calls GetKey. + * @param request GetKeyRequest message or plain object + * @returns Promise + */ + public getKey(request: google.cloud.recaptchaenterprise.v1.IGetKeyRequest): Promise; + + /** + * Calls UpdateKey. + * @param request UpdateKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Key + */ + public updateKey(request: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.UpdateKeyCallback): void; + + /** + * Calls UpdateKey. + * @param request UpdateKeyRequest message or plain object + * @returns Promise + */ + public updateKey(request: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest): Promise; + + /** + * Calls DeleteKey. + * @param request DeleteKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteKey(request: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.DeleteKeyCallback): void; + + /** + * Calls DeleteKey. + * @param request DeleteKeyRequest message or plain object + * @returns Promise + */ + public deleteKey(request: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest): Promise; + + /** + * Calls MigrateKey. + * @param request MigrateKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Key + */ + public migrateKey(request: google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKeyCallback): void; + + /** + * Calls MigrateKey. + * @param request MigrateKeyRequest message or plain object + * @returns Promise + */ + public migrateKey(request: google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest): Promise; + + /** + * Calls GetMetrics. + * @param request GetMetricsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Metrics + */ + public getMetrics(request: google.cloud.recaptchaenterprise.v1.IGetMetricsRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetMetricsCallback): void; + + /** + * Calls GetMetrics. + * @param request GetMetricsRequest message or plain object + * @returns Promise + */ + public getMetrics(request: google.cloud.recaptchaenterprise.v1.IGetMetricsRequest): Promise; + + /** + * Calls ListRelatedAccountGroups. + * @param request ListRelatedAccountGroupsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRelatedAccountGroupsResponse + */ + public listRelatedAccountGroups(request: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroupsCallback): void; + + /** + * Calls ListRelatedAccountGroups. + * @param request ListRelatedAccountGroupsRequest message or plain object + * @returns Promise + */ + public listRelatedAccountGroups(request: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest): Promise; + + /** + * Calls ListRelatedAccountGroupMemberships. + * @param request ListRelatedAccountGroupMembershipsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListRelatedAccountGroupMembershipsResponse + */ + public listRelatedAccountGroupMemberships(request: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroupMembershipsCallback): void; + + /** + * Calls ListRelatedAccountGroupMemberships. + * @param request ListRelatedAccountGroupMembershipsRequest message or plain object + * @returns Promise + */ + public listRelatedAccountGroupMemberships(request: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest): Promise; + + /** + * Calls SearchRelatedAccountGroupMemberships. + * @param request SearchRelatedAccountGroupMembershipsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchRelatedAccountGroupMembershipsResponse + */ + public searchRelatedAccountGroupMemberships(request: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.SearchRelatedAccountGroupMembershipsCallback): void; + + /** + * Calls SearchRelatedAccountGroupMemberships. + * @param request SearchRelatedAccountGroupMembershipsRequest message or plain object + * @returns Promise + */ + public searchRelatedAccountGroupMemberships(request: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest): Promise; + } + + namespace RecaptchaEnterpriseService { + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|createAssessment}. + * @param error Error, if any + * @param [response] Assessment + */ + type CreateAssessmentCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Assessment) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|annotateAssessment}. + * @param error Error, if any + * @param [response] AnnotateAssessmentResponse + */ + type AnnotateAssessmentCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|createKey}. + * @param error Error, if any + * @param [response] Key + */ + type CreateKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Key) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|listKeys}. + * @param error Error, if any + * @param [response] ListKeysResponse + */ + type ListKeysCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.ListKeysResponse) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|retrieveLegacySecretKey}. + * @param error Error, if any + * @param [response] RetrieveLegacySecretKeyResponse + */ + type RetrieveLegacySecretKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|getKey}. + * @param error Error, if any + * @param [response] Key + */ + type GetKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Key) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|updateKey}. + * @param error Error, if any + * @param [response] Key + */ + type UpdateKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Key) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|deleteKey}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteKeyCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|migrateKey}. + * @param error Error, if any + * @param [response] Key + */ + type MigrateKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Key) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|getMetrics}. + * @param error Error, if any + * @param [response] Metrics + */ + type GetMetricsCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Metrics) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|listRelatedAccountGroups}. + * @param error Error, if any + * @param [response] ListRelatedAccountGroupsResponse + */ + type ListRelatedAccountGroupsCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|listRelatedAccountGroupMemberships}. + * @param error Error, if any + * @param [response] ListRelatedAccountGroupMembershipsResponse + */ + type ListRelatedAccountGroupMembershipsCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|searchRelatedAccountGroupMemberships}. + * @param error Error, if any + * @param [response] SearchRelatedAccountGroupMembershipsResponse + */ + type SearchRelatedAccountGroupMembershipsCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse) => void; + } + + /** Properties of a CreateAssessmentRequest. */ + interface ICreateAssessmentRequest { + + /** CreateAssessmentRequest parent */ + parent?: (string|null); + + /** CreateAssessmentRequest assessment */ + assessment?: (google.cloud.recaptchaenterprise.v1.IAssessment|null); + } + + /** Represents a CreateAssessmentRequest. */ + class CreateAssessmentRequest implements ICreateAssessmentRequest { + + /** + * Constructs a new CreateAssessmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest); + + /** CreateAssessmentRequest parent. */ + public parent: string; + + /** CreateAssessmentRequest assessment. */ + public assessment?: (google.cloud.recaptchaenterprise.v1.IAssessment|null); + + /** + * Creates a new CreateAssessmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateAssessmentRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Encodes the specified CreateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @param message CreateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @param message CreateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Verifies a CreateAssessmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateAssessmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Creates a plain object from a CreateAssessmentRequest message. Also converts values to other types if specified. + * @param message CreateAssessmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateAssessmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateAssessmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnnotateAssessmentRequest. */ + interface IAnnotateAssessmentRequest { + + /** AnnotateAssessmentRequest name */ + name?: (string|null); + + /** AnnotateAssessmentRequest annotation */ + annotation?: (google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|null); + + /** AnnotateAssessmentRequest reasons */ + reasons?: (google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason[]|null); + + /** AnnotateAssessmentRequest hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); + } + + /** Represents an AnnotateAssessmentRequest. */ + class AnnotateAssessmentRequest implements IAnnotateAssessmentRequest { + + /** + * Constructs a new AnnotateAssessmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest); + + /** AnnotateAssessmentRequest name. */ + public name: string; + + /** AnnotateAssessmentRequest annotation. */ + public annotation: (google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation); + + /** AnnotateAssessmentRequest reasons. */ + public reasons: google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason[]; + + /** AnnotateAssessmentRequest hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + + /** + * Creates a new AnnotateAssessmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotateAssessmentRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Encodes the specified AnnotateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @param message AnnotateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @param message AnnotateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Verifies an AnnotateAssessmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AnnotateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotateAssessmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Creates a plain object from an AnnotateAssessmentRequest message. Also converts values to other types if specified. + * @param message AnnotateAssessmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotateAssessmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnnotateAssessmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AnnotateAssessmentRequest { + + /** Annotation enum. */ + enum Annotation { + ANNOTATION_UNSPECIFIED = 0, + LEGITIMATE = 1, + FRAUDULENT = 2, + PASSWORD_CORRECT = 3, + PASSWORD_INCORRECT = 4 + } + + /** Reason enum. */ + enum Reason { + REASON_UNSPECIFIED = 0, + CHARGEBACK = 1, + CHARGEBACK_FRAUD = 8, + CHARGEBACK_DISPUTE = 9, + REFUND = 10, + REFUND_FRAUD = 11, + TRANSACTION_ACCEPTED = 12, + TRANSACTION_DECLINED = 13, + PAYMENT_HEURISTICS = 2, + INITIATED_TWO_FACTOR = 7, + PASSED_TWO_FACTOR = 3, + FAILED_TWO_FACTOR = 4, + CORRECT_PASSWORD = 5, + INCORRECT_PASSWORD = 6, + SOCIAL_SPAM = 14 + } + } + + /** Properties of an AnnotateAssessmentResponse. */ + interface IAnnotateAssessmentResponse { + } + + /** Represents an AnnotateAssessmentResponse. */ + class AnnotateAssessmentResponse implements IAnnotateAssessmentResponse { + + /** + * Constructs a new AnnotateAssessmentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse); + + /** + * Creates a new AnnotateAssessmentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotateAssessmentResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Encodes the specified AnnotateAssessmentResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @param message AnnotateAssessmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotateAssessmentResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @param message AnnotateAssessmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Verifies an AnnotateAssessmentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AnnotateAssessmentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotateAssessmentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Creates a plain object from an AnnotateAssessmentResponse message. Also converts values to other types if specified. + * @param message AnnotateAssessmentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotateAssessmentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnnotateAssessmentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PrivatePasswordLeakVerification. */ + interface IPrivatePasswordLeakVerification { + + /** PrivatePasswordLeakVerification lookupHashPrefix */ + lookupHashPrefix?: (Uint8Array|string|null); + + /** PrivatePasswordLeakVerification encryptedUserCredentialsHash */ + encryptedUserCredentialsHash?: (Uint8Array|string|null); + + /** PrivatePasswordLeakVerification encryptedLeakMatchPrefixes */ + encryptedLeakMatchPrefixes?: (Uint8Array[]|null); + + /** PrivatePasswordLeakVerification reencryptedUserCredentialsHash */ + reencryptedUserCredentialsHash?: (Uint8Array|string|null); + } + + /** Represents a PrivatePasswordLeakVerification. */ + class PrivatePasswordLeakVerification implements IPrivatePasswordLeakVerification { + + /** + * Constructs a new PrivatePasswordLeakVerification. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification); + + /** PrivatePasswordLeakVerification lookupHashPrefix. */ + public lookupHashPrefix: (Uint8Array|string); + + /** PrivatePasswordLeakVerification encryptedUserCredentialsHash. */ + public encryptedUserCredentialsHash: (Uint8Array|string); + + /** PrivatePasswordLeakVerification encryptedLeakMatchPrefixes. */ + public encryptedLeakMatchPrefixes: Uint8Array[]; + + /** PrivatePasswordLeakVerification reencryptedUserCredentialsHash. */ + public reencryptedUserCredentialsHash: (Uint8Array|string); + + /** + * Creates a new PrivatePasswordLeakVerification instance using the specified properties. + * @param [properties] Properties to set + * @returns PrivatePasswordLeakVerification instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Encodes the specified PrivatePasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * @param message PrivatePasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PrivatePasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * @param message PrivatePasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PrivatePasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PrivatePasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Verifies a PrivatePasswordLeakVerification message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PrivatePasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PrivatePasswordLeakVerification + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification; + + /** + * Creates a plain object from a PrivatePasswordLeakVerification message. Also converts values to other types if specified. + * @param message PrivatePasswordLeakVerification + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PrivatePasswordLeakVerification to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PrivatePasswordLeakVerification + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Assessment. */ + interface IAssessment { + + /** Assessment name */ + name?: (string|null); + + /** Assessment event */ + event?: (google.cloud.recaptchaenterprise.v1.IEvent|null); + + /** Assessment riskAnalysis */ + riskAnalysis?: (google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null); + + /** Assessment tokenProperties */ + tokenProperties?: (google.cloud.recaptchaenterprise.v1.ITokenProperties|null); + + /** Assessment accountDefenderAssessment */ + accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null); + + /** Assessment privatePasswordLeakVerification */ + privatePasswordLeakVerification?: (google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null); + } + + /** Represents an Assessment. */ + class Assessment implements IAssessment { + + /** + * Constructs a new Assessment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAssessment); + + /** Assessment name. */ + public name: string; + + /** Assessment event. */ + public event?: (google.cloud.recaptchaenterprise.v1.IEvent|null); + + /** Assessment riskAnalysis. */ + public riskAnalysis?: (google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null); + + /** Assessment tokenProperties. */ + public tokenProperties?: (google.cloud.recaptchaenterprise.v1.ITokenProperties|null); + + /** Assessment accountDefenderAssessment. */ + public accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null); + + /** Assessment privatePasswordLeakVerification. */ + public privatePasswordLeakVerification?: (google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null); + + /** + * Creates a new Assessment instance using the specified properties. + * @param [properties] Properties to set + * @returns Assessment instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAssessment): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Assessment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Decodes an Assessment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Verifies an Assessment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Assessment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * @param message Assessment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.Assessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Assessment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Assessment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Event. */ + interface IEvent { + + /** Event token */ + token?: (string|null); + + /** Event siteKey */ + siteKey?: (string|null); + + /** Event userAgent */ + userAgent?: (string|null); + + /** Event userIpAddress */ + userIpAddress?: (string|null); + + /** Event expectedAction */ + expectedAction?: (string|null); + + /** Event hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); + } + + /** Represents an Event. */ + class Event implements IEvent { + + /** + * Constructs a new Event. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IEvent); + + /** Event token. */ + public token: string; + + /** Event siteKey. */ + public siteKey: string; + + /** Event userAgent. */ + public userAgent: string; + + /** Event userIpAddress. */ + public userIpAddress: string; + + /** Event expectedAction. */ + public expectedAction: string; + + /** Event hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + + /** + * Creates a new Event instance using the specified properties. + * @param [properties] Properties to set + * @returns Event instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IEvent): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Event message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Verifies an Event message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Event + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @param message Event + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.Event, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Event to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Event + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RiskAnalysis. */ + interface IRiskAnalysis { + + /** RiskAnalysis score */ + score?: (number|null); + + /** RiskAnalysis reasons */ + reasons?: (google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[]|null); + } + + /** Represents a RiskAnalysis. */ + class RiskAnalysis implements IRiskAnalysis { + + /** + * Constructs a new RiskAnalysis. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRiskAnalysis); + + /** RiskAnalysis score. */ + public score: number; + + /** RiskAnalysis reasons. */ + public reasons: google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[]; + + /** + * Creates a new RiskAnalysis instance using the specified properties. + * @param [properties] Properties to set + * @returns RiskAnalysis instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRiskAnalysis): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Encodes the specified RiskAnalysis message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @param message RiskAnalysis message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRiskAnalysis, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RiskAnalysis message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @param message RiskAnalysis message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRiskAnalysis, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Verifies a RiskAnalysis message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RiskAnalysis message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RiskAnalysis + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Creates a plain object from a RiskAnalysis message. Also converts values to other types if specified. + * @param message RiskAnalysis + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RiskAnalysis, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RiskAnalysis to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RiskAnalysis + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace RiskAnalysis { + + /** ClassificationReason enum. */ + enum ClassificationReason { + CLASSIFICATION_REASON_UNSPECIFIED = 0, + AUTOMATION = 1, + UNEXPECTED_ENVIRONMENT = 2, + TOO_MUCH_TRAFFIC = 3, + UNEXPECTED_USAGE_PATTERNS = 4, + LOW_CONFIDENCE_SCORE = 5 + } + } + + /** Properties of a TokenProperties. */ + interface ITokenProperties { + + /** TokenProperties valid */ + valid?: (boolean|null); + + /** TokenProperties invalidReason */ + invalidReason?: (google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|keyof typeof google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|null); + + /** TokenProperties createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname */ + hostname?: (string|null); + + /** TokenProperties action */ + action?: (string|null); + } + + /** Represents a TokenProperties. */ + class TokenProperties implements ITokenProperties { + + /** + * Constructs a new TokenProperties. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ITokenProperties); + + /** TokenProperties valid. */ + public valid: boolean; + + /** TokenProperties invalidReason. */ + public invalidReason: (google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|keyof typeof google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason); + + /** TokenProperties createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname. */ + public hostname: string; + + /** TokenProperties action. */ + public action: string; + + /** + * Creates a new TokenProperties instance using the specified properties. + * @param [properties] Properties to set + * @returns TokenProperties instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ITokenProperties): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TokenProperties message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Verifies a TokenProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TokenProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * @param message TokenProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.TokenProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TokenProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TokenProperties + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TokenProperties { + + /** InvalidReason enum. */ + enum InvalidReason { + INVALID_REASON_UNSPECIFIED = 0, + UNKNOWN_INVALID_REASON = 1, + MALFORMED = 2, + EXPIRED = 3, + DUPE = 4, + MISSING = 5, + BROWSER_ERROR = 6 + } + } + + /** Properties of an AccountDefenderAssessment. */ + interface IAccountDefenderAssessment { + + /** AccountDefenderAssessment labels */ + labels?: (google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel[]|null); + } + + /** Represents an AccountDefenderAssessment. */ + class AccountDefenderAssessment implements IAccountDefenderAssessment { + + /** + * Constructs a new AccountDefenderAssessment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment); + + /** AccountDefenderAssessment labels. */ + public labels: google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel[]; + + /** + * Creates a new AccountDefenderAssessment instance using the specified properties. + * @param [properties] Properties to set + * @returns AccountDefenderAssessment instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment): google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment; + + /** + * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. + * @param message AccountDefenderAssessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. + * @param message AccountDefenderAssessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment; + + /** + * Verifies an AccountDefenderAssessment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AccountDefenderAssessment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment; + + /** + * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. + * @param message AccountDefenderAssessment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AccountDefenderAssessment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AccountDefenderAssessment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AccountDefenderAssessment { + + /** AccountDefenderLabel enum. */ + enum AccountDefenderLabel { + ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0, + PROFILE_MATCH = 1, + SUSPICIOUS_LOGIN_ACTIVITY = 2, + SUSPICIOUS_ACCOUNT_CREATION = 3, + RELATED_ACCOUNTS_NUMBER_HIGH = 4 + } + } + + /** Properties of a CreateKeyRequest. */ + interface ICreateKeyRequest { + + /** CreateKeyRequest parent */ + parent?: (string|null); + + /** CreateKeyRequest key */ + key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + } + + /** Represents a CreateKeyRequest. */ + class CreateKeyRequest implements ICreateKeyRequest { + + /** + * Constructs a new CreateKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest); + + /** CreateKeyRequest parent. */ + public parent: string; + + /** CreateKeyRequest key. */ + public key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + + /** + * Creates a new CreateKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Encodes the specified CreateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @param message CreateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @param message CreateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Verifies a CreateKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. + * @param message CreateKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.CreateKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListKeysRequest. */ + interface IListKeysRequest { + + /** ListKeysRequest parent */ + parent?: (string|null); + + /** ListKeysRequest pageSize */ + pageSize?: (number|null); + + /** ListKeysRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListKeysRequest. */ + class ListKeysRequest implements IListKeysRequest { + + /** + * Constructs a new ListKeysRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListKeysRequest); + + /** ListKeysRequest parent. */ + public parent: string; + + /** ListKeysRequest pageSize. */ + public pageSize: number; + + /** ListKeysRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListKeysRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKeysRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListKeysRequest): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Encodes the specified ListKeysRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @param message ListKeysRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListKeysRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKeysRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @param message ListKeysRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListKeysRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Verifies a ListKeysRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKeysRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKeysRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Creates a plain object from a ListKeysRequest message. Also converts values to other types if specified. + * @param message ListKeysRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListKeysRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKeysRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKeysRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListKeysResponse. */ + interface IListKeysResponse { + + /** ListKeysResponse keys */ + keys?: (google.cloud.recaptchaenterprise.v1.IKey[]|null); + + /** ListKeysResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListKeysResponse. */ + class ListKeysResponse implements IListKeysResponse { + + /** + * Constructs a new ListKeysResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListKeysResponse); + + /** ListKeysResponse keys. */ + public keys: google.cloud.recaptchaenterprise.v1.IKey[]; + + /** ListKeysResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListKeysResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKeysResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListKeysResponse): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @param message ListKeysResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListKeysResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @param message ListKeysResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListKeysResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Verifies a ListKeysResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKeysResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKeysResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Creates a plain object from a ListKeysResponse message. Also converts values to other types if specified. + * @param message ListKeysResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListKeysResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKeysResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKeysResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RetrieveLegacySecretKeyRequest. */ + interface IRetrieveLegacySecretKeyRequest { + + /** RetrieveLegacySecretKeyRequest key */ + key?: (string|null); + } + + /** Represents a RetrieveLegacySecretKeyRequest. */ + class RetrieveLegacySecretKeyRequest implements IRetrieveLegacySecretKeyRequest { + + /** + * Constructs a new RetrieveLegacySecretKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest); + + /** RetrieveLegacySecretKeyRequest key. */ + public key: string; + + /** + * Creates a new RetrieveLegacySecretKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RetrieveLegacySecretKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Encodes the specified RetrieveLegacySecretKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. + * @param message RetrieveLegacySecretKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RetrieveLegacySecretKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. + * @param message RetrieveLegacySecretKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RetrieveLegacySecretKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RetrieveLegacySecretKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Verifies a RetrieveLegacySecretKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RetrieveLegacySecretKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RetrieveLegacySecretKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest; + + /** + * Creates a plain object from a RetrieveLegacySecretKeyRequest message. Also converts values to other types if specified. + * @param message RetrieveLegacySecretKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RetrieveLegacySecretKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RetrieveLegacySecretKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetKeyRequest. */ + interface IGetKeyRequest { + + /** GetKeyRequest name */ + name?: (string|null); + } + + /** Represents a GetKeyRequest. */ + class GetKeyRequest implements IGetKeyRequest { + + /** + * Constructs a new GetKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IGetKeyRequest); + + /** GetKeyRequest name. */ + public name: string; + + /** + * Creates a new GetKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IGetKeyRequest): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Encodes the specified GetKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @param message GetKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IGetKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @param message GetKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IGetKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Decodes a GetKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Verifies a GetKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Creates a plain object from a GetKeyRequest message. Also converts values to other types if specified. + * @param message GetKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.GetKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateKeyRequest. */ + interface IUpdateKeyRequest { + + /** UpdateKeyRequest key */ + key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + + /** UpdateKeyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateKeyRequest. */ + class UpdateKeyRequest implements IUpdateKeyRequest { + + /** + * Constructs a new UpdateKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest); + + /** UpdateKeyRequest key. */ + public key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + + /** UpdateKeyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Encodes the specified UpdateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @param message UpdateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @param message UpdateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Verifies an UpdateKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Creates a plain object from an UpdateKeyRequest message. Also converts values to other types if specified. + * @param message UpdateKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.UpdateKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteKeyRequest. */ + interface IDeleteKeyRequest { + + /** DeleteKeyRequest name */ + name?: (string|null); + } + + /** Represents a DeleteKeyRequest. */ + class DeleteKeyRequest implements IDeleteKeyRequest { + + /** + * Constructs a new DeleteKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest); + + /** DeleteKeyRequest name. */ + public name: string; + + /** + * Creates a new DeleteKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Encodes the specified DeleteKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @param message DeleteKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @param message DeleteKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Decodes a DeleteKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Verifies a DeleteKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Creates a plain object from a DeleteKeyRequest message. Also converts values to other types if specified. + * @param message DeleteKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.DeleteKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MigrateKeyRequest. */ + interface IMigrateKeyRequest { + + /** MigrateKeyRequest name */ + name?: (string|null); + } + + /** Represents a MigrateKeyRequest. */ + class MigrateKeyRequest implements IMigrateKeyRequest { + + /** + * Constructs a new MigrateKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest); + + /** MigrateKeyRequest name. */ + public name: string; + + /** + * Creates a new MigrateKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns MigrateKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest): google.cloud.recaptchaenterprise.v1.MigrateKeyRequest; + + /** + * Encodes the specified MigrateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.MigrateKeyRequest.verify|verify} messages. + * @param message MigrateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MigrateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.MigrateKeyRequest.verify|verify} messages. + * @param message MigrateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MigrateKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MigrateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.MigrateKeyRequest; + + /** + * Decodes a MigrateKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MigrateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.MigrateKeyRequest; + + /** + * Verifies a MigrateKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MigrateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MigrateKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.MigrateKeyRequest; + + /** + * Creates a plain object from a MigrateKeyRequest message. Also converts values to other types if specified. + * @param message MigrateKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.MigrateKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MigrateKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MigrateKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetMetricsRequest. */ + interface IGetMetricsRequest { + + /** GetMetricsRequest name */ + name?: (string|null); + } + + /** Represents a GetMetricsRequest. */ + class GetMetricsRequest implements IGetMetricsRequest { + + /** + * Constructs a new GetMetricsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IGetMetricsRequest); + + /** GetMetricsRequest name. */ + public name: string; + + /** + * Creates a new GetMetricsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetMetricsRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IGetMetricsRequest): google.cloud.recaptchaenterprise.v1.GetMetricsRequest; + + /** + * Encodes the specified GetMetricsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetMetricsRequest.verify|verify} messages. + * @param message GetMetricsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IGetMetricsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetMetricsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetMetricsRequest.verify|verify} messages. + * @param message GetMetricsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IGetMetricsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetMetricsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.GetMetricsRequest; + + /** + * Decodes a GetMetricsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.GetMetricsRequest; + + /** + * Verifies a GetMetricsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetMetricsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetMetricsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.GetMetricsRequest; + + /** + * Creates a plain object from a GetMetricsRequest message. Also converts values to other types if specified. + * @param message GetMetricsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.GetMetricsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetMetricsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetMetricsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Metrics. */ + interface IMetrics { + + /** Metrics name */ + name?: (string|null); + + /** Metrics startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** Metrics scoreMetrics */ + scoreMetrics?: (google.cloud.recaptchaenterprise.v1.IScoreMetrics[]|null); + + /** Metrics challengeMetrics */ + challengeMetrics?: (google.cloud.recaptchaenterprise.v1.IChallengeMetrics[]|null); + } + + /** Represents a Metrics. */ + class Metrics implements IMetrics { + + /** + * Constructs a new Metrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IMetrics); + + /** Metrics name. */ + public name: string; + + /** Metrics startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** Metrics scoreMetrics. */ + public scoreMetrics: google.cloud.recaptchaenterprise.v1.IScoreMetrics[]; + + /** Metrics challengeMetrics. */ + public challengeMetrics: google.cloud.recaptchaenterprise.v1.IChallengeMetrics[]; + + /** + * Creates a new Metrics instance using the specified properties. + * @param [properties] Properties to set + * @returns Metrics instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IMetrics): google.cloud.recaptchaenterprise.v1.Metrics; + + /** + * Encodes the specified Metrics message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Metrics.verify|verify} messages. + * @param message Metrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Metrics message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Metrics.verify|verify} messages. + * @param message Metrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.Metrics; + + /** + * Decodes a Metrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.Metrics; + + /** + * Verifies a Metrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Metrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Metrics + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.Metrics; + + /** + * Creates a plain object from a Metrics message. Also converts values to other types if specified. + * @param message Metrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.Metrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Metrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Metrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RetrieveLegacySecretKeyResponse. */ + interface IRetrieveLegacySecretKeyResponse { + + /** RetrieveLegacySecretKeyResponse legacySecretKey */ + legacySecretKey?: (string|null); + } + + /** Represents a RetrieveLegacySecretKeyResponse. */ + class RetrieveLegacySecretKeyResponse implements IRetrieveLegacySecretKeyResponse { + + /** + * Constructs a new RetrieveLegacySecretKeyResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse); + + /** RetrieveLegacySecretKeyResponse legacySecretKey. */ + public legacySecretKey: string; + + /** + * Creates a new RetrieveLegacySecretKeyResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RetrieveLegacySecretKeyResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @param message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @param message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Verifies a RetrieveLegacySecretKeyResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RetrieveLegacySecretKeyResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RetrieveLegacySecretKeyResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse; + + /** + * Creates a plain object from a RetrieveLegacySecretKeyResponse message. Also converts values to other types if specified. + * @param message RetrieveLegacySecretKeyResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RetrieveLegacySecretKeyResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RetrieveLegacySecretKeyResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Key. */ + interface IKey { + + /** Key name */ + name?: (string|null); + + /** Key displayName */ + displayName?: (string|null); + + /** Key webSettings */ + webSettings?: (google.cloud.recaptchaenterprise.v1.IWebKeySettings|null); + + /** Key androidSettings */ + androidSettings?: (google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null); + + /** Key iosSettings */ + iosSettings?: (google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null); + + /** Key labels */ + labels?: ({ [k: string]: string }|null); + + /** Key createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Key testingOptions */ + testingOptions?: (google.cloud.recaptchaenterprise.v1.ITestingOptions|null); + + /** Key wafSettings */ + wafSettings?: (google.cloud.recaptchaenterprise.v1.IWafSettings|null); + } + + /** Represents a Key. */ + class Key implements IKey { + + /** + * Constructs a new Key. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IKey); + + /** Key name. */ + public name: string; + + /** Key displayName. */ + public displayName: string; + + /** Key webSettings. */ + public webSettings?: (google.cloud.recaptchaenterprise.v1.IWebKeySettings|null); + + /** Key androidSettings. */ + public androidSettings?: (google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null); + + /** Key iosSettings. */ + public iosSettings?: (google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null); + + /** Key labels. */ + public labels: { [k: string]: string }; + + /** Key createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Key testingOptions. */ + public testingOptions?: (google.cloud.recaptchaenterprise.v1.ITestingOptions|null); + + /** Key wafSettings. */ + public wafSettings?: (google.cloud.recaptchaenterprise.v1.IWafSettings|null); + + /** Key platformSettings. */ + public platformSettings?: ("webSettings"|"androidSettings"|"iosSettings"); + + /** + * Creates a new Key instance using the specified properties. + * @param [properties] Properties to set + * @returns Key instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IKey): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Encodes the specified Key message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @param message Key message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Key message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @param message Key message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Key message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Decodes a Key message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Verifies a Key message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Key message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Key + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Creates a plain object from a Key message. Also converts values to other types if specified. + * @param message Key + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.Key, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Key to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Key + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TestingOptions. */ + interface ITestingOptions { + + /** TestingOptions testingScore */ + testingScore?: (number|null); + + /** TestingOptions testingChallenge */ + testingChallenge?: (google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge|keyof typeof google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge|null); + } + + /** Represents a TestingOptions. */ + class TestingOptions implements ITestingOptions { + + /** + * Constructs a new TestingOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ITestingOptions); + + /** TestingOptions testingScore. */ + public testingScore: number; + + /** TestingOptions testingChallenge. */ + public testingChallenge: (google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge|keyof typeof google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge); + + /** + * Creates a new TestingOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns TestingOptions instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ITestingOptions): google.cloud.recaptchaenterprise.v1.TestingOptions; + + /** + * Encodes the specified TestingOptions message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TestingOptions.verify|verify} messages. + * @param message TestingOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ITestingOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TestingOptions message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TestingOptions.verify|verify} messages. + * @param message TestingOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ITestingOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TestingOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TestingOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.TestingOptions; + + /** + * Decodes a TestingOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TestingOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.TestingOptions; + + /** + * Verifies a TestingOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TestingOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TestingOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.TestingOptions; + + /** + * Creates a plain object from a TestingOptions message. Also converts values to other types if specified. + * @param message TestingOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.TestingOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TestingOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TestingOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TestingOptions { + + /** TestingChallenge enum. */ + enum TestingChallenge { + TESTING_CHALLENGE_UNSPECIFIED = 0, + NOCAPTCHA = 1, + UNSOLVABLE_CHALLENGE = 2 + } + } + + /** Properties of a WebKeySettings. */ + interface IWebKeySettings { + + /** WebKeySettings allowAllDomains */ + allowAllDomains?: (boolean|null); + + /** WebKeySettings allowedDomains */ + allowedDomains?: (string[]|null); + + /** WebKeySettings allowAmpTraffic */ + allowAmpTraffic?: (boolean|null); + + /** WebKeySettings integrationType */ + integrationType?: (google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|null); + + /** WebKeySettings challengeSecurityPreference */ + challengeSecurityPreference?: (google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|null); + } + + /** Represents a WebKeySettings. */ + class WebKeySettings implements IWebKeySettings { + + /** + * Constructs a new WebKeySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IWebKeySettings); + + /** WebKeySettings allowAllDomains. */ + public allowAllDomains: boolean; + + /** WebKeySettings allowedDomains. */ + public allowedDomains: string[]; + + /** WebKeySettings allowAmpTraffic. */ + public allowAmpTraffic: boolean; + + /** WebKeySettings integrationType. */ + public integrationType: (google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType); + + /** WebKeySettings challengeSecurityPreference. */ + public challengeSecurityPreference: (google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference); + + /** + * Creates a new WebKeySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns WebKeySettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IWebKeySettings): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Encodes the specified WebKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @param message WebKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IWebKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @param message WebKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IWebKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Verifies a WebKeySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebKeySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebKeySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Creates a plain object from a WebKeySettings message. Also converts values to other types if specified. + * @param message WebKeySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.WebKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebKeySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WebKeySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace WebKeySettings { + + /** IntegrationType enum. */ + enum IntegrationType { + INTEGRATION_TYPE_UNSPECIFIED = 0, + SCORE = 1, + CHECKBOX = 2, + INVISIBLE = 3 + } + + /** ChallengeSecurityPreference enum. */ + enum ChallengeSecurityPreference { + CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0, + USABILITY = 1, + BALANCE = 2, + SECURITY = 3 + } + } + + /** Properties of an AndroidKeySettings. */ + interface IAndroidKeySettings { + + /** AndroidKeySettings allowAllPackageNames */ + allowAllPackageNames?: (boolean|null); + + /** AndroidKeySettings allowedPackageNames */ + allowedPackageNames?: (string[]|null); + } + + /** Represents an AndroidKeySettings. */ + class AndroidKeySettings implements IAndroidKeySettings { + + /** + * Constructs a new AndroidKeySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings); + + /** AndroidKeySettings allowAllPackageNames. */ + public allowAllPackageNames: boolean; + + /** AndroidKeySettings allowedPackageNames. */ + public allowedPackageNames: string[]; + + /** + * Creates a new AndroidKeySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns AndroidKeySettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Encodes the specified AndroidKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @param message AndroidKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AndroidKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @param message AndroidKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Verifies an AndroidKeySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AndroidKeySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AndroidKeySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Creates a plain object from an AndroidKeySettings message. Also converts values to other types if specified. + * @param message AndroidKeySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AndroidKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AndroidKeySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AndroidKeySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a IOSKeySettings. */ + interface IIOSKeySettings { + + /** IOSKeySettings allowAllBundleIds */ + allowAllBundleIds?: (boolean|null); + + /** IOSKeySettings allowedBundleIds */ + allowedBundleIds?: (string[]|null); + } + + /** Represents a IOSKeySettings. */ + class IOSKeySettings implements IIOSKeySettings { + + /** + * Constructs a new IOSKeySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IIOSKeySettings); + + /** IOSKeySettings allowAllBundleIds. */ + public allowAllBundleIds: boolean; + + /** IOSKeySettings allowedBundleIds. */ + public allowedBundleIds: string[]; + + /** + * Creates a new IOSKeySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns IOSKeySettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IIOSKeySettings): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Encodes the specified IOSKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @param message IOSKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IIOSKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IOSKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @param message IOSKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IIOSKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Verifies a IOSKeySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a IOSKeySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IOSKeySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Creates a plain object from a IOSKeySettings message. Also converts values to other types if specified. + * @param message IOSKeySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.IOSKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IOSKeySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IOSKeySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ScoreDistribution. */ + interface IScoreDistribution { + + /** ScoreDistribution scoreBuckets */ + scoreBuckets?: ({ [k: string]: (number|Long|string) }|null); + } + + /** Represents a ScoreDistribution. */ + class ScoreDistribution implements IScoreDistribution { + + /** + * Constructs a new ScoreDistribution. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IScoreDistribution); + + /** ScoreDistribution scoreBuckets. */ + public scoreBuckets: { [k: string]: (number|Long|string) }; + + /** + * Creates a new ScoreDistribution instance using the specified properties. + * @param [properties] Properties to set + * @returns ScoreDistribution instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IScoreDistribution): google.cloud.recaptchaenterprise.v1.ScoreDistribution; + + /** + * Encodes the specified ScoreDistribution message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreDistribution.verify|verify} messages. + * @param message ScoreDistribution message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IScoreDistribution, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ScoreDistribution message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreDistribution.verify|verify} messages. + * @param message ScoreDistribution message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IScoreDistribution, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ScoreDistribution message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ScoreDistribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ScoreDistribution; + + /** + * Decodes a ScoreDistribution message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ScoreDistribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ScoreDistribution; + + /** + * Verifies a ScoreDistribution message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ScoreDistribution message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ScoreDistribution + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ScoreDistribution; + + /** + * Creates a plain object from a ScoreDistribution message. Also converts values to other types if specified. + * @param message ScoreDistribution + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ScoreDistribution, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ScoreDistribution to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ScoreDistribution + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ScoreMetrics. */ + interface IScoreMetrics { + + /** ScoreMetrics overallMetrics */ + overallMetrics?: (google.cloud.recaptchaenterprise.v1.IScoreDistribution|null); + + /** ScoreMetrics actionMetrics */ + actionMetrics?: ({ [k: string]: google.cloud.recaptchaenterprise.v1.IScoreDistribution }|null); + } + + /** Represents a ScoreMetrics. */ + class ScoreMetrics implements IScoreMetrics { + + /** + * Constructs a new ScoreMetrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IScoreMetrics); + + /** ScoreMetrics overallMetrics. */ + public overallMetrics?: (google.cloud.recaptchaenterprise.v1.IScoreDistribution|null); + + /** ScoreMetrics actionMetrics. */ + public actionMetrics: { [k: string]: google.cloud.recaptchaenterprise.v1.IScoreDistribution }; + + /** + * Creates a new ScoreMetrics instance using the specified properties. + * @param [properties] Properties to set + * @returns ScoreMetrics instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IScoreMetrics): google.cloud.recaptchaenterprise.v1.ScoreMetrics; + + /** + * Encodes the specified ScoreMetrics message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreMetrics.verify|verify} messages. + * @param message ScoreMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IScoreMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ScoreMetrics message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreMetrics.verify|verify} messages. + * @param message ScoreMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IScoreMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ScoreMetrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ScoreMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ScoreMetrics; + + /** + * Decodes a ScoreMetrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ScoreMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ScoreMetrics; + + /** + * Verifies a ScoreMetrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ScoreMetrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ScoreMetrics + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ScoreMetrics; + + /** + * Creates a plain object from a ScoreMetrics message. Also converts values to other types if specified. + * @param message ScoreMetrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ScoreMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ScoreMetrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ScoreMetrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ChallengeMetrics. */ + interface IChallengeMetrics { + + /** ChallengeMetrics pageloadCount */ + pageloadCount?: (number|Long|string|null); + + /** ChallengeMetrics nocaptchaCount */ + nocaptchaCount?: (number|Long|string|null); + + /** ChallengeMetrics failedCount */ + failedCount?: (number|Long|string|null); + + /** ChallengeMetrics passedCount */ + passedCount?: (number|Long|string|null); + } + + /** Represents a ChallengeMetrics. */ + class ChallengeMetrics implements IChallengeMetrics { + + /** + * Constructs a new ChallengeMetrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IChallengeMetrics); + + /** ChallengeMetrics pageloadCount. */ + public pageloadCount: (number|Long|string); + + /** ChallengeMetrics nocaptchaCount. */ + public nocaptchaCount: (number|Long|string); + + /** ChallengeMetrics failedCount. */ + public failedCount: (number|Long|string); + + /** ChallengeMetrics passedCount. */ + public passedCount: (number|Long|string); + + /** + * Creates a new ChallengeMetrics instance using the specified properties. + * @param [properties] Properties to set + * @returns ChallengeMetrics instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IChallengeMetrics): google.cloud.recaptchaenterprise.v1.ChallengeMetrics; + + /** + * Encodes the specified ChallengeMetrics message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ChallengeMetrics.verify|verify} messages. + * @param message ChallengeMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IChallengeMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChallengeMetrics message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ChallengeMetrics.verify|verify} messages. + * @param message ChallengeMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IChallengeMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChallengeMetrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChallengeMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ChallengeMetrics; + + /** + * Decodes a ChallengeMetrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChallengeMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ChallengeMetrics; + + /** + * Verifies a ChallengeMetrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ChallengeMetrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChallengeMetrics + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ChallengeMetrics; + + /** + * Creates a plain object from a ChallengeMetrics message. Also converts values to other types if specified. + * @param message ChallengeMetrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ChallengeMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChallengeMetrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ChallengeMetrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRelatedAccountGroupMembershipsRequest. */ + interface IListRelatedAccountGroupMembershipsRequest { + + /** ListRelatedAccountGroupMembershipsRequest parent */ + parent?: (string|null); + + /** ListRelatedAccountGroupMembershipsRequest pageSize */ + pageSize?: (number|null); + + /** ListRelatedAccountGroupMembershipsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListRelatedAccountGroupMembershipsRequest. */ + class ListRelatedAccountGroupMembershipsRequest implements IListRelatedAccountGroupMembershipsRequest { + + /** + * Constructs a new ListRelatedAccountGroupMembershipsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest); + + /** ListRelatedAccountGroupMembershipsRequest parent. */ + public parent: string; + + /** ListRelatedAccountGroupMembershipsRequest pageSize. */ + public pageSize: number; + + /** ListRelatedAccountGroupMembershipsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListRelatedAccountGroupMembershipsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRelatedAccountGroupMembershipsRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest; + + /** + * Encodes the specified ListRelatedAccountGroupMembershipsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @param message ListRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRelatedAccountGroupMembershipsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @param message ListRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRelatedAccountGroupMembershipsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest; + + /** + * Decodes a ListRelatedAccountGroupMembershipsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest; + + /** + * Verifies a ListRelatedAccountGroupMembershipsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRelatedAccountGroupMembershipsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRelatedAccountGroupMembershipsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest; + + /** + * Creates a plain object from a ListRelatedAccountGroupMembershipsRequest message. Also converts values to other types if specified. + * @param message ListRelatedAccountGroupMembershipsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRelatedAccountGroupMembershipsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRelatedAccountGroupMembershipsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRelatedAccountGroupMembershipsResponse. */ + interface IListRelatedAccountGroupMembershipsResponse { + + /** ListRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships */ + relatedAccountGroupMemberships?: (google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[]|null); + + /** ListRelatedAccountGroupMembershipsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListRelatedAccountGroupMembershipsResponse. */ + class ListRelatedAccountGroupMembershipsResponse implements IListRelatedAccountGroupMembershipsResponse { + + /** + * Constructs a new ListRelatedAccountGroupMembershipsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse); + + /** ListRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships. */ + public relatedAccountGroupMemberships: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[]; + + /** ListRelatedAccountGroupMembershipsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListRelatedAccountGroupMembershipsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRelatedAccountGroupMembershipsResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse; + + /** + * Encodes the specified ListRelatedAccountGroupMembershipsResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @param message ListRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRelatedAccountGroupMembershipsResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @param message ListRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRelatedAccountGroupMembershipsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse; + + /** + * Decodes a ListRelatedAccountGroupMembershipsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse; + + /** + * Verifies a ListRelatedAccountGroupMembershipsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRelatedAccountGroupMembershipsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRelatedAccountGroupMembershipsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse; + + /** + * Creates a plain object from a ListRelatedAccountGroupMembershipsResponse message. Also converts values to other types if specified. + * @param message ListRelatedAccountGroupMembershipsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRelatedAccountGroupMembershipsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRelatedAccountGroupMembershipsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRelatedAccountGroupsRequest. */ + interface IListRelatedAccountGroupsRequest { + + /** ListRelatedAccountGroupsRequest parent */ + parent?: (string|null); + + /** ListRelatedAccountGroupsRequest pageSize */ + pageSize?: (number|null); + + /** ListRelatedAccountGroupsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListRelatedAccountGroupsRequest. */ + class ListRelatedAccountGroupsRequest implements IListRelatedAccountGroupsRequest { + + /** + * Constructs a new ListRelatedAccountGroupsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest); + + /** ListRelatedAccountGroupsRequest parent. */ + public parent: string; + + /** ListRelatedAccountGroupsRequest pageSize. */ + public pageSize: number; + + /** ListRelatedAccountGroupsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListRelatedAccountGroupsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRelatedAccountGroupsRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest; + + /** + * Encodes the specified ListRelatedAccountGroupsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest.verify|verify} messages. + * @param message ListRelatedAccountGroupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRelatedAccountGroupsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest.verify|verify} messages. + * @param message ListRelatedAccountGroupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRelatedAccountGroupsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRelatedAccountGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest; + + /** + * Decodes a ListRelatedAccountGroupsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRelatedAccountGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest; + + /** + * Verifies a ListRelatedAccountGroupsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRelatedAccountGroupsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRelatedAccountGroupsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest; + + /** + * Creates a plain object from a ListRelatedAccountGroupsRequest message. Also converts values to other types if specified. + * @param message ListRelatedAccountGroupsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRelatedAccountGroupsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRelatedAccountGroupsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListRelatedAccountGroupsResponse. */ + interface IListRelatedAccountGroupsResponse { + + /** ListRelatedAccountGroupsResponse relatedAccountGroups */ + relatedAccountGroups?: (google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup[]|null); + + /** ListRelatedAccountGroupsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListRelatedAccountGroupsResponse. */ + class ListRelatedAccountGroupsResponse implements IListRelatedAccountGroupsResponse { + + /** + * Constructs a new ListRelatedAccountGroupsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse); + + /** ListRelatedAccountGroupsResponse relatedAccountGroups. */ + public relatedAccountGroups: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup[]; + + /** ListRelatedAccountGroupsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListRelatedAccountGroupsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListRelatedAccountGroupsResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse; + + /** + * Encodes the specified ListRelatedAccountGroupsResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse.verify|verify} messages. + * @param message ListRelatedAccountGroupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListRelatedAccountGroupsResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse.verify|verify} messages. + * @param message ListRelatedAccountGroupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListRelatedAccountGroupsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListRelatedAccountGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse; + + /** + * Decodes a ListRelatedAccountGroupsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListRelatedAccountGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse; + + /** + * Verifies a ListRelatedAccountGroupsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListRelatedAccountGroupsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListRelatedAccountGroupsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse; + + /** + * Creates a plain object from a ListRelatedAccountGroupsResponse message. Also converts values to other types if specified. + * @param message ListRelatedAccountGroupsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListRelatedAccountGroupsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListRelatedAccountGroupsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchRelatedAccountGroupMembershipsRequest. */ + interface ISearchRelatedAccountGroupMembershipsRequest { + + /** SearchRelatedAccountGroupMembershipsRequest project */ + project?: (string|null); + + /** SearchRelatedAccountGroupMembershipsRequest hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); + + /** SearchRelatedAccountGroupMembershipsRequest pageSize */ + pageSize?: (number|null); + + /** SearchRelatedAccountGroupMembershipsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a SearchRelatedAccountGroupMembershipsRequest. */ + class SearchRelatedAccountGroupMembershipsRequest implements ISearchRelatedAccountGroupMembershipsRequest { + + /** + * Constructs a new SearchRelatedAccountGroupMembershipsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest); + + /** SearchRelatedAccountGroupMembershipsRequest project. */ + public project: string; + + /** SearchRelatedAccountGroupMembershipsRequest hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + + /** SearchRelatedAccountGroupMembershipsRequest pageSize. */ + public pageSize: number; + + /** SearchRelatedAccountGroupMembershipsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new SearchRelatedAccountGroupMembershipsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchRelatedAccountGroupMembershipsRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest; + + /** + * Encodes the specified SearchRelatedAccountGroupMembershipsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @param message SearchRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchRelatedAccountGroupMembershipsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @param message SearchRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest; + + /** + * Verifies a SearchRelatedAccountGroupMembershipsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchRelatedAccountGroupMembershipsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchRelatedAccountGroupMembershipsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest; + + /** + * Creates a plain object from a SearchRelatedAccountGroupMembershipsRequest message. Also converts values to other types if specified. + * @param message SearchRelatedAccountGroupMembershipsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchRelatedAccountGroupMembershipsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchRelatedAccountGroupMembershipsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchRelatedAccountGroupMembershipsResponse. */ + interface ISearchRelatedAccountGroupMembershipsResponse { + + /** SearchRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships */ + relatedAccountGroupMemberships?: (google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[]|null); + + /** SearchRelatedAccountGroupMembershipsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a SearchRelatedAccountGroupMembershipsResponse. */ + class SearchRelatedAccountGroupMembershipsResponse implements ISearchRelatedAccountGroupMembershipsResponse { + + /** + * Constructs a new SearchRelatedAccountGroupMembershipsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse); + + /** SearchRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships. */ + public relatedAccountGroupMemberships: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[]; + + /** SearchRelatedAccountGroupMembershipsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new SearchRelatedAccountGroupMembershipsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchRelatedAccountGroupMembershipsResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse; + + /** + * Encodes the specified SearchRelatedAccountGroupMembershipsResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @param message SearchRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchRelatedAccountGroupMembershipsResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @param message SearchRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse; + + /** + * Verifies a SearchRelatedAccountGroupMembershipsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchRelatedAccountGroupMembershipsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchRelatedAccountGroupMembershipsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse; + + /** + * Creates a plain object from a SearchRelatedAccountGroupMembershipsResponse message. Also converts values to other types if specified. + * @param message SearchRelatedAccountGroupMembershipsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchRelatedAccountGroupMembershipsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchRelatedAccountGroupMembershipsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RelatedAccountGroupMembership. */ + interface IRelatedAccountGroupMembership { + + /** RelatedAccountGroupMembership name */ + name?: (string|null); + + /** RelatedAccountGroupMembership hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); + } + + /** Represents a RelatedAccountGroupMembership. */ + class RelatedAccountGroupMembership implements IRelatedAccountGroupMembership { + + /** + * Constructs a new RelatedAccountGroupMembership. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership); + + /** RelatedAccountGroupMembership name. */ + public name: string; + + /** RelatedAccountGroupMembership hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + + /** + * Creates a new RelatedAccountGroupMembership instance using the specified properties. + * @param [properties] Properties to set + * @returns RelatedAccountGroupMembership instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership): google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership; + + /** + * Encodes the specified RelatedAccountGroupMembership message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.verify|verify} messages. + * @param message RelatedAccountGroupMembership message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RelatedAccountGroupMembership message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.verify|verify} messages. + * @param message RelatedAccountGroupMembership message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RelatedAccountGroupMembership message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RelatedAccountGroupMembership + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership; + + /** + * Decodes a RelatedAccountGroupMembership message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RelatedAccountGroupMembership + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership; + + /** + * Verifies a RelatedAccountGroupMembership message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RelatedAccountGroupMembership message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RelatedAccountGroupMembership + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership; + + /** + * Creates a plain object from a RelatedAccountGroupMembership message. Also converts values to other types if specified. + * @param message RelatedAccountGroupMembership + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RelatedAccountGroupMembership to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RelatedAccountGroupMembership + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RelatedAccountGroup. */ + interface IRelatedAccountGroup { + + /** RelatedAccountGroup name */ + name?: (string|null); + } + + /** Represents a RelatedAccountGroup. */ + class RelatedAccountGroup implements IRelatedAccountGroup { + + /** + * Constructs a new RelatedAccountGroup. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup); + + /** RelatedAccountGroup name. */ + public name: string; + + /** + * Creates a new RelatedAccountGroup instance using the specified properties. + * @param [properties] Properties to set + * @returns RelatedAccountGroup instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup): google.cloud.recaptchaenterprise.v1.RelatedAccountGroup; + + /** + * Encodes the specified RelatedAccountGroup message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.verify|verify} messages. + * @param message RelatedAccountGroup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RelatedAccountGroup message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.verify|verify} messages. + * @param message RelatedAccountGroup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RelatedAccountGroup message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RelatedAccountGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RelatedAccountGroup; + + /** + * Decodes a RelatedAccountGroup message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RelatedAccountGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RelatedAccountGroup; + + /** + * Verifies a RelatedAccountGroup message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RelatedAccountGroup message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RelatedAccountGroup + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RelatedAccountGroup; + + /** + * Creates a plain object from a RelatedAccountGroup message. Also converts values to other types if specified. + * @param message RelatedAccountGroup + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RelatedAccountGroup, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RelatedAccountGroup to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RelatedAccountGroup + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WafSettings. */ + interface IWafSettings { + + /** WafSettings wafService */ + wafService?: (google.cloud.recaptchaenterprise.v1.WafSettings.WafService|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafService|null); + + /** WafSettings wafFeature */ + wafFeature?: (google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|null); + } + + /** Represents a WafSettings. */ + class WafSettings implements IWafSettings { + + /** + * Constructs a new WafSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IWafSettings); + + /** WafSettings wafService. */ + public wafService: (google.cloud.recaptchaenterprise.v1.WafSettings.WafService|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafService); + + /** WafSettings wafFeature. */ + public wafFeature: (google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature); + + /** + * Creates a new WafSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns WafSettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IWafSettings): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Encodes the specified WafSettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @param message WafSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IWafSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WafSettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @param message WafSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IWafSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WafSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Decodes a WafSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Verifies a WafSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WafSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WafSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Creates a plain object from a WafSettings message. Also converts values to other types if specified. + * @param message WafSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.WafSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WafSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WafSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace WafSettings { + + /** WafFeature enum. */ + enum WafFeature { + WAF_FEATURE_UNSPECIFIED = 0, + CHALLENGE_PAGE = 1, + SESSION_TOKEN = 2, + ACTION_TOKEN = 3 + } + + /** WafService enum. */ + enum WafService { + WAF_SERVICE_UNSPECIFIED = 0, + CA = 1 + } + } + } + + /** Namespace v1beta1. */ + namespace v1beta1 { + + /** Represents a RecaptchaEnterpriseServiceV1Beta1 */ + class RecaptchaEnterpriseServiceV1Beta1 extends $protobuf.rpc.Service { + + /** + * Constructs a new RecaptchaEnterpriseServiceV1Beta1 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 RecaptchaEnterpriseServiceV1Beta1 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): RecaptchaEnterpriseServiceV1Beta1; + + /** + * Calls CreateAssessment. + * @param request CreateAssessmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Assessment + */ + public createAssessment(request: google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, callback: google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateAssessmentCallback): void; + + /** + * Calls CreateAssessment. + * @param request CreateAssessmentRequest message or plain object + * @returns Promise + */ + public createAssessment(request: google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest): Promise; + + /** + * Calls AnnotateAssessment. + * @param request AnnotateAssessmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnnotateAssessmentResponse + */ + public annotateAssessment(request: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, callback: google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.AnnotateAssessmentCallback): void; + + /** + * Calls AnnotateAssessment. + * @param request AnnotateAssessmentRequest message or plain object + * @returns Promise + */ + public annotateAssessment(request: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest): Promise; + } + + namespace RecaptchaEnterpriseServiceV1Beta1 { + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1|createAssessment}. + * @param error Error, if any + * @param [response] Assessment + */ + type CreateAssessmentCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1beta1.Assessment) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1|annotateAssessment}. + * @param error Error, if any + * @param [response] AnnotateAssessmentResponse + */ + type AnnotateAssessmentCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse) => void; + } + + /** Properties of a CreateAssessmentRequest. */ + interface ICreateAssessmentRequest { + + /** CreateAssessmentRequest parent */ + parent?: (string|null); + + /** CreateAssessmentRequest assessment */ + assessment?: (google.cloud.recaptchaenterprise.v1beta1.IAssessment|null); + } + + /** Represents a CreateAssessmentRequest. */ + class CreateAssessmentRequest implements ICreateAssessmentRequest { + + /** + * Constructs a new CreateAssessmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest); + + /** CreateAssessmentRequest parent. */ + public parent: string; + + /** CreateAssessmentRequest assessment. */ + public assessment?: (google.cloud.recaptchaenterprise.v1beta1.IAssessment|null); + + /** + * Creates a new CreateAssessmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateAssessmentRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest): google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest; + + /** + * Encodes the specified CreateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest.verify|verify} messages. + * @param message CreateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest.verify|verify} messages. + * @param message CreateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest; + + /** + * Verifies a CreateAssessmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateAssessmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest; + + /** + * Creates a plain object from a CreateAssessmentRequest message. Also converts values to other types if specified. + * @param message CreateAssessmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateAssessmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateAssessmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnnotateAssessmentRequest. */ + interface IAnnotateAssessmentRequest { + + /** AnnotateAssessmentRequest name */ + name?: (string|null); + + /** AnnotateAssessmentRequest annotation */ + annotation?: (google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|null); + + /** AnnotateAssessmentRequest reasons */ + reasons?: (google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason[]|null); + + /** AnnotateAssessmentRequest hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); + } + + /** Represents an AnnotateAssessmentRequest. */ + class AnnotateAssessmentRequest implements IAnnotateAssessmentRequest { + + /** + * Constructs a new AnnotateAssessmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest); + + /** AnnotateAssessmentRequest name. */ + public name: string; + + /** AnnotateAssessmentRequest annotation. */ + public annotation: (google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation); + + /** AnnotateAssessmentRequest reasons. */ + public reasons: google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason[]; + + /** AnnotateAssessmentRequest hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + + /** + * Creates a new AnnotateAssessmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotateAssessmentRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; + + /** + * Encodes the specified AnnotateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.verify|verify} messages. + * @param message AnnotateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.verify|verify} messages. + * @param message AnnotateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; + + /** + * Verifies an AnnotateAssessmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AnnotateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotateAssessmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; + + /** + * Creates a plain object from an AnnotateAssessmentRequest message. Also converts values to other types if specified. + * @param message AnnotateAssessmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotateAssessmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnnotateAssessmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AnnotateAssessmentRequest { + + /** Annotation enum. */ + enum Annotation { + ANNOTATION_UNSPECIFIED = 0, + LEGITIMATE = 1, + FRAUDULENT = 2, + PASSWORD_CORRECT = 3, + PASSWORD_INCORRECT = 4 + } + + /** Reason enum. */ + enum Reason { + REASON_UNSPECIFIED = 0, + CHARGEBACK = 1, + CHARGEBACK_FRAUD = 8, + CHARGEBACK_DISPUTE = 9, + PAYMENT_HEURISTICS = 2, + INITIATED_TWO_FACTOR = 7, + PASSED_TWO_FACTOR = 3, + FAILED_TWO_FACTOR = 4, + CORRECT_PASSWORD = 5, + INCORRECT_PASSWORD = 6 + } + } + + /** Properties of an AnnotateAssessmentResponse. */ + interface IAnnotateAssessmentResponse { + } + + /** Represents an AnnotateAssessmentResponse. */ + class AnnotateAssessmentResponse implements IAnnotateAssessmentResponse { + + /** + * Constructs a new AnnotateAssessmentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse); + + /** + * Creates a new AnnotateAssessmentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotateAssessmentResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; + + /** + * Encodes the specified AnnotateAssessmentResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse.verify|verify} messages. + * @param message AnnotateAssessmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotateAssessmentResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse.verify|verify} messages. + * @param message AnnotateAssessmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; + + /** + * Verifies an AnnotateAssessmentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AnnotateAssessmentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotateAssessmentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; + + /** + * Creates a plain object from an AnnotateAssessmentResponse message. Also converts values to other types if specified. + * @param message AnnotateAssessmentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotateAssessmentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnnotateAssessmentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PasswordLeakVerification. */ + interface IPasswordLeakVerification { + + /** PasswordLeakVerification hashedUserCredentials */ + hashedUserCredentials?: (Uint8Array|string|null); + + /** PasswordLeakVerification credentialsLeaked */ + credentialsLeaked?: (boolean|null); + + /** PasswordLeakVerification canonicalizedUsername */ + canonicalizedUsername?: (string|null); + } + + /** Represents a PasswordLeakVerification. */ + class PasswordLeakVerification implements IPasswordLeakVerification { + + /** + * Constructs a new PasswordLeakVerification. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification); + + /** PasswordLeakVerification hashedUserCredentials. */ + public hashedUserCredentials: (Uint8Array|string); + + /** PasswordLeakVerification credentialsLeaked. */ + public credentialsLeaked: boolean; + + /** PasswordLeakVerification canonicalizedUsername. */ + public canonicalizedUsername: string; + + /** + * Creates a new PasswordLeakVerification instance using the specified properties. + * @param [properties] Properties to set + * @returns PasswordLeakVerification instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Encodes the specified PasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @param message PasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @param message PasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Verifies a PasswordLeakVerification message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PasswordLeakVerification + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Creates a plain object from a PasswordLeakVerification message. Also converts values to other types if specified. + * @param message PasswordLeakVerification + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PasswordLeakVerification to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PasswordLeakVerification + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Assessment. */ + interface IAssessment { + + /** Assessment name */ + name?: (string|null); + + /** Assessment event */ + event?: (google.cloud.recaptchaenterprise.v1beta1.IEvent|null); + + /** Assessment score */ + score?: (number|null); + + /** Assessment tokenProperties */ + tokenProperties?: (google.cloud.recaptchaenterprise.v1beta1.ITokenProperties|null); + + /** Assessment reasons */ + reasons?: (google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[]|null); + + /** Assessment passwordLeakVerification */ + passwordLeakVerification?: (google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null); + + /** Assessment accountDefenderAssessment */ + accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null); + } + + /** Represents an Assessment. */ + class Assessment implements IAssessment { + + /** + * Constructs a new Assessment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IAssessment); + + /** Assessment name. */ + public name: string; + + /** Assessment event. */ + public event?: (google.cloud.recaptchaenterprise.v1beta1.IEvent|null); + + /** Assessment score. */ + public score: number; + + /** Assessment tokenProperties. */ + public tokenProperties?: (google.cloud.recaptchaenterprise.v1beta1.ITokenProperties|null); + + /** Assessment reasons. */ + public reasons: google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[]; + + /** Assessment passwordLeakVerification. */ + public passwordLeakVerification?: (google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null); + + /** Assessment accountDefenderAssessment. */ + public accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null); + + /** + * Creates a new Assessment instance using the specified properties. + * @param [properties] Properties to set + * @returns Assessment instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAssessment): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Assessment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Decodes an Assessment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Verifies an Assessment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Assessment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * @param message Assessment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.Assessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Assessment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Assessment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Assessment { + + /** ClassificationReason enum. */ + enum ClassificationReason { + CLASSIFICATION_REASON_UNSPECIFIED = 0, + AUTOMATION = 1, + UNEXPECTED_ENVIRONMENT = 2, + TOO_MUCH_TRAFFIC = 3, + UNEXPECTED_USAGE_PATTERNS = 4, + LOW_CONFIDENCE_SCORE = 5 + } + } + + /** Properties of an Event. */ + interface IEvent { + + /** Event token */ + token?: (string|null); + + /** Event siteKey */ + siteKey?: (string|null); + + /** Event userAgent */ + userAgent?: (string|null); + + /** Event userIpAddress */ + userIpAddress?: (string|null); + + /** Event expectedAction */ + expectedAction?: (string|null); + + /** Event hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); + } + + /** Represents an Event. */ + class Event implements IEvent { + + /** + * Constructs a new Event. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IEvent); + + /** Event token. */ + public token: string; + + /** Event siteKey. */ + public siteKey: string; + + /** Event userAgent. */ + public userAgent: string; + + /** Event userIpAddress. */ + public userIpAddress: string; + + /** Event expectedAction. */ + public expectedAction: string; + + /** Event hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + + /** + * Creates a new Event instance using the specified properties. + * @param [properties] Properties to set + * @returns Event instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IEvent): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Event message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Verifies an Event message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Event + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @param message Event + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.Event, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Event to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Event + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TokenProperties. */ + interface ITokenProperties { + + /** TokenProperties valid */ + valid?: (boolean|null); + + /** TokenProperties invalidReason */ + invalidReason?: (google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason|keyof typeof google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason|null); + + /** TokenProperties createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname */ + hostname?: (string|null); + + /** TokenProperties action */ + action?: (string|null); + } + + /** Represents a TokenProperties. */ + class TokenProperties implements ITokenProperties { + + /** + * Constructs a new TokenProperties. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties); + + /** TokenProperties valid. */ + public valid: boolean; + + /** TokenProperties invalidReason. */ + public invalidReason: (google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason|keyof typeof google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason); + + /** TokenProperties createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname. */ + public hostname: string; + + /** TokenProperties action. */ + public action: string; + + /** + * Creates a new TokenProperties instance using the specified properties. + * @param [properties] Properties to set + * @returns TokenProperties instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TokenProperties message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Verifies a TokenProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TokenProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * @param message TokenProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.TokenProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TokenProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TokenProperties + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TokenProperties { + + /** InvalidReason enum. */ + enum InvalidReason { + INVALID_REASON_UNSPECIFIED = 0, + UNKNOWN_INVALID_REASON = 1, + MALFORMED = 2, + EXPIRED = 3, + DUPE = 4, + SITE_MISMATCH = 5, + MISSING = 6, + BROWSER_ERROR = 7 + } + } + + /** Properties of an AccountDefenderAssessment. */ + interface IAccountDefenderAssessment { + + /** AccountDefenderAssessment labels */ + labels?: (google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel[]|null); + } + + /** Represents an AccountDefenderAssessment. */ + class AccountDefenderAssessment implements IAccountDefenderAssessment { + + /** + * Constructs a new AccountDefenderAssessment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment); + + /** AccountDefenderAssessment labels. */ + public labels: google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel[]; + + /** + * Creates a new AccountDefenderAssessment instance using the specified properties. + * @param [properties] Properties to set + * @returns AccountDefenderAssessment instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; + + /** + * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. + * @param message AccountDefenderAssessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. + * @param message AccountDefenderAssessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; + + /** + * Verifies an AccountDefenderAssessment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AccountDefenderAssessment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; + + /** + * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. + * @param message AccountDefenderAssessment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AccountDefenderAssessment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AccountDefenderAssessment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AccountDefenderAssessment { + + /** AccountDefenderLabel enum. */ + enum AccountDefenderLabel { + ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0, + PROFILE_MATCH = 1, + SUSPICIOUS_LOGIN_ACTIVITY = 2, + SUSPICIOUS_ACCOUNT_CREATION = 3, + RELATED_ACCOUNTS_NUMBER_HIGH = 4 + } + } + } + } + } + + /** 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); + } + + /** 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 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 FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of 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; + } + } +} diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.js b/packages/google-cloud-recaptchaenterprise/protos/protos.js new file mode 100644 index 00000000000..479c0761672 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.js @@ -0,0 +1,25039 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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_recaptcha_enterprise_protos || ($protobuf.roots._google_cloud_recaptcha_enterprise_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.recaptchaenterprise = (function() { + + /** + * Namespace recaptchaenterprise. + * @memberof google.cloud + * @namespace + */ + var recaptchaenterprise = {}; + + recaptchaenterprise.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.recaptchaenterprise + * @namespace + */ + var v1 = {}; + + v1.RecaptchaEnterpriseService = (function() { + + /** + * Constructs a new RecaptchaEnterpriseService service. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RecaptchaEnterpriseService + * @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 RecaptchaEnterpriseService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (RecaptchaEnterpriseService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = RecaptchaEnterpriseService; + + /** + * Creates new RecaptchaEnterpriseService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @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 {RecaptchaEnterpriseService} RPC service. Useful where requests and/or responses are streamed. + */ + RecaptchaEnterpriseService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|createAssessment}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef CreateAssessmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Assessment} [response] Assessment + */ + + /** + * Calls CreateAssessment. + * @function createAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} request CreateAssessmentRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateAssessmentCallback} callback Node-style callback called with the error, if any, and Assessment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.createAssessment = function createAssessment(request, callback) { + return this.rpcCall(createAssessment, $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest, $root.google.cloud.recaptchaenterprise.v1.Assessment, request, callback); + }, "name", { value: "CreateAssessment" }); + + /** + * Calls CreateAssessment. + * @function createAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} request CreateAssessmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|annotateAssessment}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef AnnotateAssessmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} [response] AnnotateAssessmentResponse + */ + + /** + * Calls AnnotateAssessment. + * @function annotateAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} request AnnotateAssessmentRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.AnnotateAssessmentCallback} callback Node-style callback called with the error, if any, and AnnotateAssessmentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.annotateAssessment = function annotateAssessment(request, callback) { + return this.rpcCall(annotateAssessment, $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest, $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse, request, callback); + }, "name", { value: "AnnotateAssessment" }); + + /** + * Calls AnnotateAssessment. + * @function annotateAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} request AnnotateAssessmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|createKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef CreateKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Key} [response] Key + */ + + /** + * Calls CreateKey. + * @function createKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} request CreateKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateKeyCallback} callback Node-style callback called with the error, if any, and Key + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.createKey = function createKey(request, callback) { + return this.rpcCall(createKey, $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest, $root.google.cloud.recaptchaenterprise.v1.Key, request, callback); + }, "name", { value: "CreateKey" }); + + /** + * Calls CreateKey. + * @function createKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} request CreateKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|listKeys}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef ListKeysCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.ListKeysResponse} [response] ListKeysResponse + */ + + /** + * Calls ListKeys. + * @function listKeys + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} request ListKeysRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListKeysCallback} callback Node-style callback called with the error, if any, and ListKeysResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.listKeys = function listKeys(request, callback) { + return this.rpcCall(listKeys, $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest, $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse, request, callback); + }, "name", { value: "ListKeys" }); + + /** + * Calls ListKeys. + * @function listKeys + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} request ListKeysRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|retrieveLegacySecretKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef RetrieveLegacySecretKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} [response] RetrieveLegacySecretKeyResponse + */ + + /** + * Calls RetrieveLegacySecretKey. + * @function retrieveLegacySecretKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} request RetrieveLegacySecretKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKeyCallback} callback Node-style callback called with the error, if any, and RetrieveLegacySecretKeyResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.retrieveLegacySecretKey = function retrieveLegacySecretKey(request, callback) { + return this.rpcCall(retrieveLegacySecretKey, $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest, $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse, request, callback); + }, "name", { value: "RetrieveLegacySecretKey" }); + + /** + * Calls RetrieveLegacySecretKey. + * @function retrieveLegacySecretKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} request RetrieveLegacySecretKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|getKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef GetKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Key} [response] Key + */ + + /** + * Calls GetKey. + * @function getKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} request GetKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetKeyCallback} callback Node-style callback called with the error, if any, and Key + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.getKey = function getKey(request, callback) { + return this.rpcCall(getKey, $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest, $root.google.cloud.recaptchaenterprise.v1.Key, request, callback); + }, "name", { value: "GetKey" }); + + /** + * Calls GetKey. + * @function getKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} request GetKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|updateKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef UpdateKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Key} [response] Key + */ + + /** + * Calls UpdateKey. + * @function updateKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} request UpdateKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.UpdateKeyCallback} callback Node-style callback called with the error, if any, and Key + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.updateKey = function updateKey(request, callback) { + return this.rpcCall(updateKey, $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest, $root.google.cloud.recaptchaenterprise.v1.Key, request, callback); + }, "name", { value: "UpdateKey" }); + + /** + * Calls UpdateKey. + * @function updateKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} request UpdateKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|deleteKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef DeleteKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteKey. + * @function deleteKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} request DeleteKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.DeleteKeyCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.deleteKey = function deleteKey(request, callback) { + return this.rpcCall(deleteKey, $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteKey" }); + + /** + * Calls DeleteKey. + * @function deleteKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} request DeleteKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|migrateKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef MigrateKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Key} [response] Key + */ + + /** + * Calls MigrateKey. + * @function migrateKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest} request MigrateKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKeyCallback} callback Node-style callback called with the error, if any, and Key + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.migrateKey = function migrateKey(request, callback) { + return this.rpcCall(migrateKey, $root.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest, $root.google.cloud.recaptchaenterprise.v1.Key, request, callback); + }, "name", { value: "MigrateKey" }); + + /** + * Calls MigrateKey. + * @function migrateKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest} request MigrateKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|getMetrics}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef GetMetricsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Metrics} [response] Metrics + */ + + /** + * Calls GetMetrics. + * @function getMetrics + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IGetMetricsRequest} request GetMetricsRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetMetricsCallback} callback Node-style callback called with the error, if any, and Metrics + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.getMetrics = function getMetrics(request, callback) { + return this.rpcCall(getMetrics, $root.google.cloud.recaptchaenterprise.v1.GetMetricsRequest, $root.google.cloud.recaptchaenterprise.v1.Metrics, request, callback); + }, "name", { value: "GetMetrics" }); + + /** + * Calls GetMetrics. + * @function getMetrics + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IGetMetricsRequest} request GetMetricsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|listRelatedAccountGroups}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef ListRelatedAccountGroupsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse} [response] ListRelatedAccountGroupsResponse + */ + + /** + * Calls ListRelatedAccountGroups. + * @function listRelatedAccountGroups + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest} request ListRelatedAccountGroupsRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroupsCallback} callback Node-style callback called with the error, if any, and ListRelatedAccountGroupsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.listRelatedAccountGroups = function listRelatedAccountGroups(request, callback) { + return this.rpcCall(listRelatedAccountGroups, $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest, $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse, request, callback); + }, "name", { value: "ListRelatedAccountGroups" }); + + /** + * Calls ListRelatedAccountGroups. + * @function listRelatedAccountGroups + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest} request ListRelatedAccountGroupsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|listRelatedAccountGroupMemberships}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef ListRelatedAccountGroupMembershipsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse} [response] ListRelatedAccountGroupMembershipsResponse + */ + + /** + * Calls ListRelatedAccountGroupMemberships. + * @function listRelatedAccountGroupMemberships + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest} request ListRelatedAccountGroupMembershipsRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroupMembershipsCallback} callback Node-style callback called with the error, if any, and ListRelatedAccountGroupMembershipsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.listRelatedAccountGroupMemberships = function listRelatedAccountGroupMemberships(request, callback) { + return this.rpcCall(listRelatedAccountGroupMemberships, $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest, $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse, request, callback); + }, "name", { value: "ListRelatedAccountGroupMemberships" }); + + /** + * Calls ListRelatedAccountGroupMemberships. + * @function listRelatedAccountGroupMemberships + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest} request ListRelatedAccountGroupMembershipsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService|searchRelatedAccountGroupMemberships}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef SearchRelatedAccountGroupMembershipsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse} [response] SearchRelatedAccountGroupMembershipsResponse + */ + + /** + * Calls SearchRelatedAccountGroupMemberships. + * @function searchRelatedAccountGroupMemberships + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest} request SearchRelatedAccountGroupMembershipsRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.SearchRelatedAccountGroupMembershipsCallback} callback Node-style callback called with the error, if any, and SearchRelatedAccountGroupMembershipsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.searchRelatedAccountGroupMemberships = function searchRelatedAccountGroupMemberships(request, callback) { + return this.rpcCall(searchRelatedAccountGroupMemberships, $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest, $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse, request, callback); + }, "name", { value: "SearchRelatedAccountGroupMemberships" }); + + /** + * Calls SearchRelatedAccountGroupMemberships. + * @function searchRelatedAccountGroupMemberships + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest} request SearchRelatedAccountGroupMembershipsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return RecaptchaEnterpriseService; + })(); + + v1.CreateAssessmentRequest = (function() { + + /** + * Properties of a CreateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ICreateAssessmentRequest + * @property {string|null} [parent] CreateAssessmentRequest parent + * @property {google.cloud.recaptchaenterprise.v1.IAssessment|null} [assessment] CreateAssessmentRequest assessment + */ + + /** + * Constructs a new CreateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a CreateAssessmentRequest. + * @implements ICreateAssessmentRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest=} [properties] Properties to set + */ + function CreateAssessmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateAssessmentRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @instance + */ + CreateAssessmentRequest.prototype.parent = ""; + + /** + * CreateAssessmentRequest assessment. + * @member {google.cloud.recaptchaenterprise.v1.IAssessment|null|undefined} assessment + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @instance + */ + CreateAssessmentRequest.prototype.assessment = null; + + /** + * Creates a new CreateAssessmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest instance + */ + CreateAssessmentRequest.create = function create(properties) { + return new CreateAssessmentRequest(properties); + }; + + /** + * Encodes the specified CreateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} message CreateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAssessmentRequest.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.assessment != null && Object.hasOwnProperty.call(message, "assessment")) + $root.google.cloud.recaptchaenterprise.v1.Assessment.encode(message.assessment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} message CreateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAssessmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAssessmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.assessment = $root.google.cloud.recaptchaenterprise.v1.Assessment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAssessmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateAssessmentRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateAssessmentRequest.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.assessment != null && message.hasOwnProperty("assessment")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Assessment.verify(message.assessment); + if (error) + return "assessment." + error; + } + return null; + }; + + /** + * Creates a CreateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest + */ + CreateAssessmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.assessment != null) { + if (typeof object.assessment !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.assessment: object expected"); + message.assessment = $root.google.cloud.recaptchaenterprise.v1.Assessment.fromObject(object.assessment); + } + return message; + }; + + /** + * Creates a plain object from a CreateAssessmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} message CreateAssessmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateAssessmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.assessment = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.assessment != null && message.hasOwnProperty("assessment")) + object.assessment = $root.google.cloud.recaptchaenterprise.v1.Assessment.toObject(message.assessment, options); + return object; + }; + + /** + * Converts this CreateAssessmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateAssessmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateAssessmentRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateAssessmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest"; + }; + + return CreateAssessmentRequest; + })(); + + v1.AnnotateAssessmentRequest = (function() { + + /** + * Properties of an AnnotateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAnnotateAssessmentRequest + * @property {string|null} [name] AnnotateAssessmentRequest name + * @property {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|null} [annotation] AnnotateAssessmentRequest annotation + * @property {Array.|null} [reasons] AnnotateAssessmentRequest reasons + * @property {Uint8Array|null} [hashedAccountId] AnnotateAssessmentRequest hashedAccountId + */ + + /** + * Constructs a new AnnotateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AnnotateAssessmentRequest. + * @implements IAnnotateAssessmentRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest=} [properties] Properties to set + */ + function AnnotateAssessmentRequest(properties) { + this.reasons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnnotateAssessmentRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.name = ""; + + /** + * AnnotateAssessmentRequest annotation. + * @member {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation} annotation + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.annotation = 0; + + /** + * AnnotateAssessmentRequest reasons. + * @member {Array.} reasons + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.reasons = $util.emptyArray; + + /** + * AnnotateAssessmentRequest hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.hashedAccountId = $util.newBuffer([]); + + /** + * Creates a new AnnotateAssessmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest instance + */ + AnnotateAssessmentRequest.create = function create(properties) { + return new AnnotateAssessmentRequest(properties); + }; + + /** + * Encodes the specified AnnotateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} message AnnotateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentRequest.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.annotation != null && Object.hasOwnProperty.call(message, "annotation")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.annotation); + if (message.reasons != null && message.reasons.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.reasons.length; ++i) + writer.int32(message.reasons[i]); + writer.ldelim(); + } + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hashedAccountId); + return writer; + }; + + /** + * Encodes the specified AnnotateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} message AnnotateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.annotation = reader.int32(); + break; + } + case 3: { + if (!(message.reasons && message.reasons.length)) + message.reasons = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.reasons.push(reader.int32()); + } else + message.reasons.push(reader.int32()); + break; + } + case 4: { + message.hashedAccountId = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotateAssessmentRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotateAssessmentRequest.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.annotation != null && message.hasOwnProperty("annotation")) + switch (message.annotation) { + default: + return "annotation: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.reasons != null && message.hasOwnProperty("reasons")) { + if (!Array.isArray(message.reasons)) + return "reasons: array expected"; + for (var i = 0; i < message.reasons.length; ++i) + switch (message.reasons[i]) { + default: + return "reasons: enum value[] expected"; + case 0: + case 1: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 2: + case 7: + case 3: + case 4: + case 5: + case 6: + case 14: + break; + } + } + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; + return null; + }; + + /** + * Creates an AnnotateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + */ + AnnotateAssessmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest(); + if (object.name != null) + message.name = String(object.name); + switch (object.annotation) { + default: + if (typeof object.annotation === "number") { + message.annotation = object.annotation; + break; + } + break; + case "ANNOTATION_UNSPECIFIED": + case 0: + message.annotation = 0; + break; + case "LEGITIMATE": + case 1: + message.annotation = 1; + break; + case "FRAUDULENT": + case 2: + message.annotation = 2; + break; + case "PASSWORD_CORRECT": + case 3: + message.annotation = 3; + break; + case "PASSWORD_INCORRECT": + case 4: + message.annotation = 4; + break; + } + if (object.reasons) { + if (!Array.isArray(object.reasons)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.reasons: array expected"); + message.reasons = []; + for (var i = 0; i < object.reasons.length; ++i) + switch (object.reasons[i]) { + default: + if (typeof object.reasons[i] === "number") { + message.reasons[i] = object.reasons[i]; + break; + } + case "REASON_UNSPECIFIED": + case 0: + message.reasons[i] = 0; + break; + case "CHARGEBACK": + case 1: + message.reasons[i] = 1; + break; + case "CHARGEBACK_FRAUD": + case 8: + message.reasons[i] = 8; + break; + case "CHARGEBACK_DISPUTE": + case 9: + message.reasons[i] = 9; + break; + case "REFUND": + case 10: + message.reasons[i] = 10; + break; + case "REFUND_FRAUD": + case 11: + message.reasons[i] = 11; + break; + case "TRANSACTION_ACCEPTED": + case 12: + message.reasons[i] = 12; + break; + case "TRANSACTION_DECLINED": + case 13: + message.reasons[i] = 13; + break; + case "PAYMENT_HEURISTICS": + case 2: + message.reasons[i] = 2; + break; + case "INITIATED_TWO_FACTOR": + case 7: + message.reasons[i] = 7; + break; + case "PASSED_TWO_FACTOR": + case 3: + message.reasons[i] = 3; + break; + case "FAILED_TWO_FACTOR": + case 4: + message.reasons[i] = 4; + break; + case "CORRECT_PASSWORD": + case 5: + message.reasons[i] = 5; + break; + case "INCORRECT_PASSWORD": + case 6: + message.reasons[i] = 6; + break; + case "SOCIAL_SPAM": + case 14: + message.reasons[i] = 14; + break; + } + } + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length >= 0) + message.hashedAccountId = object.hashedAccountId; + return message; + }; + + /** + * Creates a plain object from an AnnotateAssessmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} message AnnotateAssessmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotateAssessmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.reasons = []; + if (options.defaults) { + object.name = ""; + object.annotation = options.enums === String ? "ANNOTATION_UNSPECIFIED" : 0; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.annotation != null && message.hasOwnProperty("annotation")) + object.annotation = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation[message.annotation] === undefined ? message.annotation : $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation[message.annotation] : message.annotation; + if (message.reasons && message.reasons.length) { + object.reasons = []; + for (var j = 0; j < message.reasons.length; ++j) + object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason[message.reasons[j]] === undefined ? message.reasons[j] : $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason[message.reasons[j]] : message.reasons[j]; + } + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + return object; + }; + + /** + * Converts this AnnotateAssessmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + * @returns {Object.} JSON object + */ + AnnotateAssessmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnnotateAssessmentRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnnotateAssessmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest"; + }; + + /** + * Annotation enum. + * @name google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation + * @enum {number} + * @property {number} ANNOTATION_UNSPECIFIED=0 ANNOTATION_UNSPECIFIED value + * @property {number} LEGITIMATE=1 LEGITIMATE value + * @property {number} FRAUDULENT=2 FRAUDULENT value + * @property {number} PASSWORD_CORRECT=3 PASSWORD_CORRECT value + * @property {number} PASSWORD_INCORRECT=4 PASSWORD_INCORRECT value + */ + AnnotateAssessmentRequest.Annotation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ANNOTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "LEGITIMATE"] = 1; + values[valuesById[2] = "FRAUDULENT"] = 2; + values[valuesById[3] = "PASSWORD_CORRECT"] = 3; + values[valuesById[4] = "PASSWORD_INCORRECT"] = 4; + return values; + })(); + + /** + * Reason enum. + * @name google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason + * @enum {number} + * @property {number} REASON_UNSPECIFIED=0 REASON_UNSPECIFIED value + * @property {number} CHARGEBACK=1 CHARGEBACK value + * @property {number} CHARGEBACK_FRAUD=8 CHARGEBACK_FRAUD value + * @property {number} CHARGEBACK_DISPUTE=9 CHARGEBACK_DISPUTE value + * @property {number} REFUND=10 REFUND value + * @property {number} REFUND_FRAUD=11 REFUND_FRAUD value + * @property {number} TRANSACTION_ACCEPTED=12 TRANSACTION_ACCEPTED value + * @property {number} TRANSACTION_DECLINED=13 TRANSACTION_DECLINED value + * @property {number} PAYMENT_HEURISTICS=2 PAYMENT_HEURISTICS value + * @property {number} INITIATED_TWO_FACTOR=7 INITIATED_TWO_FACTOR value + * @property {number} PASSED_TWO_FACTOR=3 PASSED_TWO_FACTOR value + * @property {number} FAILED_TWO_FACTOR=4 FAILED_TWO_FACTOR value + * @property {number} CORRECT_PASSWORD=5 CORRECT_PASSWORD value + * @property {number} INCORRECT_PASSWORD=6 INCORRECT_PASSWORD value + * @property {number} SOCIAL_SPAM=14 SOCIAL_SPAM value + */ + AnnotateAssessmentRequest.Reason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "CHARGEBACK"] = 1; + values[valuesById[8] = "CHARGEBACK_FRAUD"] = 8; + values[valuesById[9] = "CHARGEBACK_DISPUTE"] = 9; + values[valuesById[10] = "REFUND"] = 10; + values[valuesById[11] = "REFUND_FRAUD"] = 11; + values[valuesById[12] = "TRANSACTION_ACCEPTED"] = 12; + values[valuesById[13] = "TRANSACTION_DECLINED"] = 13; + values[valuesById[2] = "PAYMENT_HEURISTICS"] = 2; + values[valuesById[7] = "INITIATED_TWO_FACTOR"] = 7; + values[valuesById[3] = "PASSED_TWO_FACTOR"] = 3; + values[valuesById[4] = "FAILED_TWO_FACTOR"] = 4; + values[valuesById[5] = "CORRECT_PASSWORD"] = 5; + values[valuesById[6] = "INCORRECT_PASSWORD"] = 6; + values[valuesById[14] = "SOCIAL_SPAM"] = 14; + return values; + })(); + + return AnnotateAssessmentRequest; + })(); + + v1.AnnotateAssessmentResponse = (function() { + + /** + * Properties of an AnnotateAssessmentResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAnnotateAssessmentResponse + */ + + /** + * Constructs a new AnnotateAssessmentResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AnnotateAssessmentResponse. + * @implements IAnnotateAssessmentResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse=} [properties] Properties to set + */ + function AnnotateAssessmentResponse(properties) { + if (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 AnnotateAssessmentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse instance + */ + AnnotateAssessmentResponse.create = function create(properties) { + return new AnnotateAssessmentResponse(properties); + }; + + /** + * Encodes the specified AnnotateAssessmentResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse} message AnnotateAssessmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AnnotateAssessmentResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse} message AnnotateAssessmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotateAssessmentResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotateAssessmentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AnnotateAssessmentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + */ + AnnotateAssessmentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse) + return object; + return new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse(); + }; + + /** + * Creates a plain object from an AnnotateAssessmentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} message AnnotateAssessmentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotateAssessmentResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AnnotateAssessmentResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @instance + * @returns {Object.} JSON object + */ + AnnotateAssessmentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnnotateAssessmentResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnnotateAssessmentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse"; + }; + + return AnnotateAssessmentResponse; + })(); + + v1.PrivatePasswordLeakVerification = (function() { + + /** + * Properties of a PrivatePasswordLeakVerification. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IPrivatePasswordLeakVerification + * @property {Uint8Array|null} [lookupHashPrefix] PrivatePasswordLeakVerification lookupHashPrefix + * @property {Uint8Array|null} [encryptedUserCredentialsHash] PrivatePasswordLeakVerification encryptedUserCredentialsHash + * @property {Array.|null} [encryptedLeakMatchPrefixes] PrivatePasswordLeakVerification encryptedLeakMatchPrefixes + * @property {Uint8Array|null} [reencryptedUserCredentialsHash] PrivatePasswordLeakVerification reencryptedUserCredentialsHash + */ + + /** + * Constructs a new PrivatePasswordLeakVerification. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a PrivatePasswordLeakVerification. + * @implements IPrivatePasswordLeakVerification + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification=} [properties] Properties to set + */ + function PrivatePasswordLeakVerification(properties) { + this.encryptedLeakMatchPrefixes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PrivatePasswordLeakVerification lookupHashPrefix. + * @member {Uint8Array} lookupHashPrefix + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @instance + */ + PrivatePasswordLeakVerification.prototype.lookupHashPrefix = $util.newBuffer([]); + + /** + * PrivatePasswordLeakVerification encryptedUserCredentialsHash. + * @member {Uint8Array} encryptedUserCredentialsHash + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @instance + */ + PrivatePasswordLeakVerification.prototype.encryptedUserCredentialsHash = $util.newBuffer([]); + + /** + * PrivatePasswordLeakVerification encryptedLeakMatchPrefixes. + * @member {Array.} encryptedLeakMatchPrefixes + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @instance + */ + PrivatePasswordLeakVerification.prototype.encryptedLeakMatchPrefixes = $util.emptyArray; + + /** + * PrivatePasswordLeakVerification reencryptedUserCredentialsHash. + * @member {Uint8Array} reencryptedUserCredentialsHash + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @instance + */ + PrivatePasswordLeakVerification.prototype.reencryptedUserCredentialsHash = $util.newBuffer([]); + + /** + * Creates a new PrivatePasswordLeakVerification instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification instance + */ + PrivatePasswordLeakVerification.create = function create(properties) { + return new PrivatePasswordLeakVerification(properties); + }; + + /** + * Encodes the specified PrivatePasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification} message PrivatePasswordLeakVerification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrivatePasswordLeakVerification.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lookupHashPrefix != null && Object.hasOwnProperty.call(message, "lookupHashPrefix")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.lookupHashPrefix); + if (message.encryptedUserCredentialsHash != null && Object.hasOwnProperty.call(message, "encryptedUserCredentialsHash")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.encryptedUserCredentialsHash); + if (message.encryptedLeakMatchPrefixes != null && message.encryptedLeakMatchPrefixes.length) + for (var i = 0; i < message.encryptedLeakMatchPrefixes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.encryptedLeakMatchPrefixes[i]); + if (message.reencryptedUserCredentialsHash != null && Object.hasOwnProperty.call(message, "reencryptedUserCredentialsHash")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.reencryptedUserCredentialsHash); + return writer; + }; + + /** + * Encodes the specified PrivatePasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification} message PrivatePasswordLeakVerification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrivatePasswordLeakVerification.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrivatePasswordLeakVerification.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.lookupHashPrefix = reader.bytes(); + break; + } + case 2: { + message.encryptedUserCredentialsHash = reader.bytes(); + break; + } + case 3: { + if (!(message.encryptedLeakMatchPrefixes && message.encryptedLeakMatchPrefixes.length)) + message.encryptedLeakMatchPrefixes = []; + message.encryptedLeakMatchPrefixes.push(reader.bytes()); + break; + } + case 4: { + message.reencryptedUserCredentialsHash = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PrivatePasswordLeakVerification message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrivatePasswordLeakVerification.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PrivatePasswordLeakVerification message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PrivatePasswordLeakVerification.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lookupHashPrefix != null && message.hasOwnProperty("lookupHashPrefix")) + if (!(message.lookupHashPrefix && typeof message.lookupHashPrefix.length === "number" || $util.isString(message.lookupHashPrefix))) + return "lookupHashPrefix: buffer expected"; + if (message.encryptedUserCredentialsHash != null && message.hasOwnProperty("encryptedUserCredentialsHash")) + if (!(message.encryptedUserCredentialsHash && typeof message.encryptedUserCredentialsHash.length === "number" || $util.isString(message.encryptedUserCredentialsHash))) + return "encryptedUserCredentialsHash: buffer expected"; + if (message.encryptedLeakMatchPrefixes != null && message.hasOwnProperty("encryptedLeakMatchPrefixes")) { + if (!Array.isArray(message.encryptedLeakMatchPrefixes)) + return "encryptedLeakMatchPrefixes: array expected"; + for (var i = 0; i < message.encryptedLeakMatchPrefixes.length; ++i) + if (!(message.encryptedLeakMatchPrefixes[i] && typeof message.encryptedLeakMatchPrefixes[i].length === "number" || $util.isString(message.encryptedLeakMatchPrefixes[i]))) + return "encryptedLeakMatchPrefixes: buffer[] expected"; + } + if (message.reencryptedUserCredentialsHash != null && message.hasOwnProperty("reencryptedUserCredentialsHash")) + if (!(message.reencryptedUserCredentialsHash && typeof message.reencryptedUserCredentialsHash.length === "number" || $util.isString(message.reencryptedUserCredentialsHash))) + return "reencryptedUserCredentialsHash: buffer expected"; + return null; + }; + + /** + * Creates a PrivatePasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} PrivatePasswordLeakVerification + */ + PrivatePasswordLeakVerification.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification(); + if (object.lookupHashPrefix != null) + if (typeof object.lookupHashPrefix === "string") + $util.base64.decode(object.lookupHashPrefix, message.lookupHashPrefix = $util.newBuffer($util.base64.length(object.lookupHashPrefix)), 0); + else if (object.lookupHashPrefix.length >= 0) + message.lookupHashPrefix = object.lookupHashPrefix; + if (object.encryptedUserCredentialsHash != null) + if (typeof object.encryptedUserCredentialsHash === "string") + $util.base64.decode(object.encryptedUserCredentialsHash, message.encryptedUserCredentialsHash = $util.newBuffer($util.base64.length(object.encryptedUserCredentialsHash)), 0); + else if (object.encryptedUserCredentialsHash.length >= 0) + message.encryptedUserCredentialsHash = object.encryptedUserCredentialsHash; + if (object.encryptedLeakMatchPrefixes) { + if (!Array.isArray(object.encryptedLeakMatchPrefixes)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.encryptedLeakMatchPrefixes: array expected"); + message.encryptedLeakMatchPrefixes = []; + for (var i = 0; i < object.encryptedLeakMatchPrefixes.length; ++i) + if (typeof object.encryptedLeakMatchPrefixes[i] === "string") + $util.base64.decode(object.encryptedLeakMatchPrefixes[i], message.encryptedLeakMatchPrefixes[i] = $util.newBuffer($util.base64.length(object.encryptedLeakMatchPrefixes[i])), 0); + else if (object.encryptedLeakMatchPrefixes[i].length >= 0) + message.encryptedLeakMatchPrefixes[i] = object.encryptedLeakMatchPrefixes[i]; + } + if (object.reencryptedUserCredentialsHash != null) + if (typeof object.reencryptedUserCredentialsHash === "string") + $util.base64.decode(object.reencryptedUserCredentialsHash, message.reencryptedUserCredentialsHash = $util.newBuffer($util.base64.length(object.reencryptedUserCredentialsHash)), 0); + else if (object.reencryptedUserCredentialsHash.length >= 0) + message.reencryptedUserCredentialsHash = object.reencryptedUserCredentialsHash; + return message; + }; + + /** + * Creates a plain object from a PrivatePasswordLeakVerification message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification} message PrivatePasswordLeakVerification + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PrivatePasswordLeakVerification.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.encryptedLeakMatchPrefixes = []; + if (options.defaults) { + if (options.bytes === String) + object.lookupHashPrefix = ""; + else { + object.lookupHashPrefix = []; + if (options.bytes !== Array) + object.lookupHashPrefix = $util.newBuffer(object.lookupHashPrefix); + } + if (options.bytes === String) + object.encryptedUserCredentialsHash = ""; + else { + object.encryptedUserCredentialsHash = []; + if (options.bytes !== Array) + object.encryptedUserCredentialsHash = $util.newBuffer(object.encryptedUserCredentialsHash); + } + if (options.bytes === String) + object.reencryptedUserCredentialsHash = ""; + else { + object.reencryptedUserCredentialsHash = []; + if (options.bytes !== Array) + object.reencryptedUserCredentialsHash = $util.newBuffer(object.reencryptedUserCredentialsHash); + } + } + if (message.lookupHashPrefix != null && message.hasOwnProperty("lookupHashPrefix")) + object.lookupHashPrefix = options.bytes === String ? $util.base64.encode(message.lookupHashPrefix, 0, message.lookupHashPrefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.lookupHashPrefix) : message.lookupHashPrefix; + if (message.encryptedUserCredentialsHash != null && message.hasOwnProperty("encryptedUserCredentialsHash")) + object.encryptedUserCredentialsHash = options.bytes === String ? $util.base64.encode(message.encryptedUserCredentialsHash, 0, message.encryptedUserCredentialsHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.encryptedUserCredentialsHash) : message.encryptedUserCredentialsHash; + if (message.encryptedLeakMatchPrefixes && message.encryptedLeakMatchPrefixes.length) { + object.encryptedLeakMatchPrefixes = []; + for (var j = 0; j < message.encryptedLeakMatchPrefixes.length; ++j) + object.encryptedLeakMatchPrefixes[j] = options.bytes === String ? $util.base64.encode(message.encryptedLeakMatchPrefixes[j], 0, message.encryptedLeakMatchPrefixes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.encryptedLeakMatchPrefixes[j]) : message.encryptedLeakMatchPrefixes[j]; + } + if (message.reencryptedUserCredentialsHash != null && message.hasOwnProperty("reencryptedUserCredentialsHash")) + object.reencryptedUserCredentialsHash = options.bytes === String ? $util.base64.encode(message.reencryptedUserCredentialsHash, 0, message.reencryptedUserCredentialsHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.reencryptedUserCredentialsHash) : message.reencryptedUserCredentialsHash; + return object; + }; + + /** + * Converts this PrivatePasswordLeakVerification to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @instance + * @returns {Object.} JSON object + */ + PrivatePasswordLeakVerification.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PrivatePasswordLeakVerification + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PrivatePasswordLeakVerification.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification"; + }; + + return PrivatePasswordLeakVerification; + })(); + + v1.Assessment = (function() { + + /** + * Properties of an Assessment. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAssessment + * @property {string|null} [name] Assessment name + * @property {google.cloud.recaptchaenterprise.v1.IEvent|null} [event] Assessment event + * @property {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null} [riskAnalysis] Assessment riskAnalysis + * @property {google.cloud.recaptchaenterprise.v1.ITokenProperties|null} [tokenProperties] Assessment tokenProperties + * @property {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null} [accountDefenderAssessment] Assessment accountDefenderAssessment + * @property {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null} [privatePasswordLeakVerification] Assessment privatePasswordLeakVerification + */ + + /** + * Constructs a new Assessment. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an Assessment. + * @implements IAssessment + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set + */ + function Assessment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Assessment name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.name = ""; + + /** + * Assessment event. + * @member {google.cloud.recaptchaenterprise.v1.IEvent|null|undefined} event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.event = null; + + /** + * Assessment riskAnalysis. + * @member {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null|undefined} riskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.riskAnalysis = null; + + /** + * Assessment tokenProperties. + * @member {google.cloud.recaptchaenterprise.v1.ITokenProperties|null|undefined} tokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.tokenProperties = null; + + /** + * Assessment accountDefenderAssessment. + * @member {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null|undefined} accountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.accountDefenderAssessment = null; + + /** + * Assessment privatePasswordLeakVerification. + * @member {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null|undefined} privatePasswordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.privatePasswordLeakVerification = null; + + /** + * Creates a new Assessment instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment instance + */ + Assessment.create = function create(properties) { + return new Assessment(properties); + }; + + /** + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Assessment.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.event != null && Object.hasOwnProperty.call(message, "event")) + $root.google.cloud.recaptchaenterprise.v1.Event.encode(message.event, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.riskAnalysis != null && Object.hasOwnProperty.call(message, "riskAnalysis")) + $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.encode(message.riskAnalysis, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.tokenProperties != null && Object.hasOwnProperty.call(message, "tokenProperties")) + $root.google.cloud.recaptchaenterprise.v1.TokenProperties.encode(message.tokenProperties, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.accountDefenderAssessment != null && Object.hasOwnProperty.call(message, "accountDefenderAssessment")) + $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.encode(message.accountDefenderAssessment, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.privatePasswordLeakVerification != null && Object.hasOwnProperty.call(message, "privatePasswordLeakVerification")) + $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.encode(message.privatePasswordLeakVerification, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Assessment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Assessment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Assessment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.event = $root.google.cloud.recaptchaenterprise.v1.Event.decode(reader, reader.uint32()); + break; + } + case 3: { + message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.decode(reader, reader.uint32()); + break; + } + case 4: { + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.decode(reader, reader.uint32()); + break; + } + case 6: { + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.decode(reader, reader.uint32()); + break; + } + case 8: { + message.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Assessment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Assessment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Assessment message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Assessment.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.event != null && message.hasOwnProperty("event")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Event.verify(message.event); + if (error) + return "event." + error; + } + if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) { + var error = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify(message.riskAnalysis); + if (error) + return "riskAnalysis." + error; + } + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) { + var error = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.verify(message.tokenProperties); + if (error) + return "tokenProperties." + error; + } + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) { + var error = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify(message.accountDefenderAssessment); + if (error) + return "accountDefenderAssessment." + error; + } + if (message.privatePasswordLeakVerification != null && message.hasOwnProperty("privatePasswordLeakVerification")) { + var error = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.verify(message.privatePasswordLeakVerification); + if (error) + return "privatePasswordLeakVerification." + error; + } + return null; + }; + + /** + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + */ + Assessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Assessment) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); + if (object.name != null) + message.name = String(object.name); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.event: object expected"); + message.event = $root.google.cloud.recaptchaenterprise.v1.Event.fromObject(object.event); + } + if (object.riskAnalysis != null) { + if (typeof object.riskAnalysis !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.riskAnalysis: object expected"); + message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.fromObject(object.riskAnalysis); + } + if (object.tokenProperties != null) { + if (typeof object.tokenProperties !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.tokenProperties: object expected"); + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.fromObject(object.tokenProperties); + } + if (object.accountDefenderAssessment != null) { + if (typeof object.accountDefenderAssessment !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.accountDefenderAssessment: object expected"); + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.fromObject(object.accountDefenderAssessment); + } + if (object.privatePasswordLeakVerification != null) { + if (typeof object.privatePasswordLeakVerification !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.privatePasswordLeakVerification: object expected"); + message.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.fromObject(object.privatePasswordLeakVerification); + } + return message; + }; + + /** + * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.Assessment} message Assessment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Assessment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.event = null; + object.riskAnalysis = null; + object.tokenProperties = null; + object.accountDefenderAssessment = null; + object.privatePasswordLeakVerification = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.google.cloud.recaptchaenterprise.v1.Event.toObject(message.event, options); + if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) + object.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.toObject(message.riskAnalysis, options); + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) + object.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.toObject(message.tokenProperties, options); + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) + object.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.toObject(message.accountDefenderAssessment, options); + if (message.privatePasswordLeakVerification != null && message.hasOwnProperty("privatePasswordLeakVerification")) + object.privatePasswordLeakVerification = $root.google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification.toObject(message.privatePasswordLeakVerification, options); + return object; + }; + + /** + * Converts this Assessment to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + * @returns {Object.} JSON object + */ + Assessment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Assessment + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Assessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Assessment"; + }; + + return Assessment; + })(); + + v1.Event = (function() { + + /** + * Properties of an Event. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IEvent + * @property {string|null} [token] Event token + * @property {string|null} [siteKey] Event siteKey + * @property {string|null} [userAgent] Event userAgent + * @property {string|null} [userIpAddress] Event userIpAddress + * @property {string|null} [expectedAction] Event expectedAction + * @property {Uint8Array|null} [hashedAccountId] Event hashedAccountId + */ + + /** + * Constructs a new Event. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an Event. + * @implements IEvent + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set + */ + function Event(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Event token. + * @member {string} token + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.token = ""; + + /** + * Event siteKey. + * @member {string} siteKey + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.siteKey = ""; + + /** + * Event userAgent. + * @member {string} userAgent + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.userAgent = ""; + + /** + * Event userIpAddress. + * @member {string} userIpAddress + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.userIpAddress = ""; + + /** + * Event expectedAction. + * @member {string} expectedAction + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.expectedAction = ""; + + /** + * Event hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.hashedAccountId = $util.newBuffer([]); + + /** + * Creates a new Event instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event instance + */ + Event.create = function create(properties) { + return new Event(properties); + }; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.token != null && Object.hasOwnProperty.call(message, "token")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.token); + if (message.siteKey != null && Object.hasOwnProperty.call(message, "siteKey")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.siteKey); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.userIpAddress != null && Object.hasOwnProperty.call(message, "userIpAddress")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.userIpAddress); + if (message.expectedAction != null && Object.hasOwnProperty.call(message, "expectedAction")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.expectedAction); + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.hashedAccountId); + return writer; + }; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Event message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Event(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.token = reader.string(); + break; + } + case 2: { + message.siteKey = reader.string(); + break; + } + case 3: { + message.userAgent = reader.string(); + break; + } + case 4: { + message.userIpAddress = reader.string(); + break; + } + case 5: { + message.expectedAction = reader.string(); + break; + } + case 6: { + message.hashedAccountId = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Event message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Event.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.token != null && message.hasOwnProperty("token")) + if (!$util.isString(message.token)) + return "token: string expected"; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + if (!$util.isString(message.siteKey)) + return "siteKey: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + if (!$util.isString(message.userIpAddress)) + return "userIpAddress: string expected"; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + if (!$util.isString(message.expectedAction)) + return "expectedAction: string expected"; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; + return null; + }; + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + */ + Event.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Event) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.Event(); + if (object.token != null) + message.token = String(object.token); + if (object.siteKey != null) + message.siteKey = String(object.siteKey); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.userIpAddress != null) + message.userIpAddress = String(object.userIpAddress); + if (object.expectedAction != null) + message.expectedAction = String(object.expectedAction); + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length >= 0) + message.hashedAccountId = object.hashedAccountId; + return message; + }; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.Event} message Event + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Event.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.token = ""; + object.siteKey = ""; + object.userAgent = ""; + object.userIpAddress = ""; + object.expectedAction = ""; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } + } + if (message.token != null && message.hasOwnProperty("token")) + object.token = message.token; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + object.siteKey = message.siteKey; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + object.userIpAddress = message.userIpAddress; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + object.expectedAction = message.expectedAction; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + return object; + }; + + /** + * Converts this Event to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + * @returns {Object.} JSON object + */ + Event.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Event + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Event.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Event"; + }; + + return Event; + })(); + + v1.RiskAnalysis = (function() { + + /** + * Properties of a RiskAnalysis. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IRiskAnalysis + * @property {number|null} [score] RiskAnalysis score + * @property {Array.|null} [reasons] RiskAnalysis reasons + */ + + /** + * Constructs a new RiskAnalysis. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RiskAnalysis. + * @implements IRiskAnalysis + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set + */ + function RiskAnalysis(properties) { + this.reasons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RiskAnalysis score. + * @member {number} score + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @instance + */ + RiskAnalysis.prototype.score = 0; + + /** + * RiskAnalysis reasons. + * @member {Array.} reasons + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @instance + */ + RiskAnalysis.prototype.reasons = $util.emptyArray; + + /** + * Creates a new RiskAnalysis instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis instance + */ + RiskAnalysis.create = function create(properties) { + return new RiskAnalysis(properties); + }; + + /** + * Encodes the specified RiskAnalysis message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RiskAnalysis.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.score != null && Object.hasOwnProperty.call(message, "score")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.score); + if (message.reasons != null && message.reasons.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.reasons.length; ++i) + writer.int32(message.reasons[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified RiskAnalysis message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RiskAnalysis.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RiskAnalysis.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.score = reader.float(); + break; + } + case 2: { + if (!(message.reasons && message.reasons.length)) + message.reasons = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.reasons.push(reader.int32()); + } else + message.reasons.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RiskAnalysis.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RiskAnalysis message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RiskAnalysis.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.reasons != null && message.hasOwnProperty("reasons")) { + if (!Array.isArray(message.reasons)) + return "reasons: array expected"; + for (var i = 0; i < message.reasons.length; ++i) + switch (message.reasons[i]) { + default: + return "reasons: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + } + return null; + }; + + /** + * Creates a RiskAnalysis message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + */ + RiskAnalysis.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); + if (object.score != null) + message.score = Number(object.score); + if (object.reasons) { + if (!Array.isArray(object.reasons)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.RiskAnalysis.reasons: array expected"); + message.reasons = []; + for (var i = 0; i < object.reasons.length; ++i) + switch (object.reasons[i]) { + default: + if (typeof object.reasons[i] === "number") { + message.reasons[i] = object.reasons[i]; + break; + } + case "CLASSIFICATION_REASON_UNSPECIFIED": + case 0: + message.reasons[i] = 0; + break; + case "AUTOMATION": + case 1: + message.reasons[i] = 1; + break; + case "UNEXPECTED_ENVIRONMENT": + case 2: + message.reasons[i] = 2; + break; + case "TOO_MUCH_TRAFFIC": + case 3: + message.reasons[i] = 3; + break; + case "UNEXPECTED_USAGE_PATTERNS": + case 4: + message.reasons[i] = 4; + break; + case "LOW_CONFIDENCE_SCORE": + case 5: + message.reasons[i] = 5; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a RiskAnalysis message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.RiskAnalysis} message RiskAnalysis + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RiskAnalysis.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.reasons = []; + if (options.defaults) + object.score = 0; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.reasons && message.reasons.length) { + object.reasons = []; + for (var j = 0; j < message.reasons.length; ++j) + object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[message.reasons[j]] === undefined ? message.reasons[j] : $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[message.reasons[j]] : message.reasons[j]; + } + return object; + }; + + /** + * Converts this RiskAnalysis to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @instance + * @returns {Object.} JSON object + */ + RiskAnalysis.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RiskAnalysis + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RiskAnalysis.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RiskAnalysis"; + }; + + /** + * ClassificationReason enum. + * @name google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason + * @enum {number} + * @property {number} CLASSIFICATION_REASON_UNSPECIFIED=0 CLASSIFICATION_REASON_UNSPECIFIED value + * @property {number} AUTOMATION=1 AUTOMATION value + * @property {number} UNEXPECTED_ENVIRONMENT=2 UNEXPECTED_ENVIRONMENT value + * @property {number} TOO_MUCH_TRAFFIC=3 TOO_MUCH_TRAFFIC value + * @property {number} UNEXPECTED_USAGE_PATTERNS=4 UNEXPECTED_USAGE_PATTERNS value + * @property {number} LOW_CONFIDENCE_SCORE=5 LOW_CONFIDENCE_SCORE value + */ + RiskAnalysis.ClassificationReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLASSIFICATION_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATION"] = 1; + values[valuesById[2] = "UNEXPECTED_ENVIRONMENT"] = 2; + values[valuesById[3] = "TOO_MUCH_TRAFFIC"] = 3; + values[valuesById[4] = "UNEXPECTED_USAGE_PATTERNS"] = 4; + values[valuesById[5] = "LOW_CONFIDENCE_SCORE"] = 5; + return values; + })(); + + return RiskAnalysis; + })(); + + v1.TokenProperties = (function() { + + /** + * Properties of a TokenProperties. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ITokenProperties + * @property {boolean|null} [valid] TokenProperties valid + * @property {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|null} [invalidReason] TokenProperties invalidReason + * @property {google.protobuf.ITimestamp|null} [createTime] TokenProperties createTime + * @property {string|null} [hostname] TokenProperties hostname + * @property {string|null} [action] TokenProperties action + */ + + /** + * Constructs a new TokenProperties. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a TokenProperties. + * @implements ITokenProperties + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set + */ + function TokenProperties(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TokenProperties valid. + * @member {boolean} valid + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.valid = false; + + /** + * TokenProperties invalidReason. + * @member {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason} invalidReason + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.invalidReason = 0; + + /** + * TokenProperties createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.createTime = null; + + /** + * TokenProperties hostname. + * @member {string} hostname + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.hostname = ""; + + /** + * TokenProperties action. + * @member {string} action + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.action = ""; + + /** + * Creates a new TokenProperties instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties instance + */ + TokenProperties.create = function create(properties) { + return new TokenProperties(properties); + }; + + /** + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TokenProperties.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.valid != null && Object.hasOwnProperty.call(message, "valid")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.valid); + if (message.invalidReason != null && Object.hasOwnProperty.call(message, "invalidReason")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.invalidReason); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.hostname != null && Object.hasOwnProperty.call(message, "hostname")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.hostname); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.action); + return writer; + }; + + /** + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TokenProperties.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TokenProperties message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TokenProperties.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.valid = reader.bool(); + break; + } + case 2: { + message.invalidReason = reader.int32(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.hostname = reader.string(); + break; + } + case 5: { + message.action = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TokenProperties.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TokenProperties message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TokenProperties.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.valid != null && message.hasOwnProperty("valid")) + if (typeof message.valid !== "boolean") + return "valid: boolean expected"; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + switch (message.invalidReason) { + default: + return "invalidReason: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.hostname != null && message.hasOwnProperty("hostname")) + if (!$util.isString(message.hostname)) + return "hostname: string expected"; + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; + return null; + }; + + /** + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + */ + TokenProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.TokenProperties) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); + if (object.valid != null) + message.valid = Boolean(object.valid); + switch (object.invalidReason) { + default: + if (typeof object.invalidReason === "number") { + message.invalidReason = object.invalidReason; + break; + } + break; + case "INVALID_REASON_UNSPECIFIED": + case 0: + message.invalidReason = 0; + break; + case "UNKNOWN_INVALID_REASON": + case 1: + message.invalidReason = 1; + break; + case "MALFORMED": + case 2: + message.invalidReason = 2; + break; + case "EXPIRED": + case 3: + message.invalidReason = 3; + break; + case "DUPE": + case 4: + message.invalidReason = 4; + break; + case "MISSING": + case 5: + message.invalidReason = 5; + break; + case "BROWSER_ERROR": + case 6: + message.invalidReason = 6; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.TokenProperties.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.hostname != null) + message.hostname = String(object.hostname); + if (object.action != null) + message.action = String(object.action); + return message; + }; + + /** + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.TokenProperties} message TokenProperties + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TokenProperties.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.valid = false; + object.invalidReason = options.enums === String ? "INVALID_REASON_UNSPECIFIED" : 0; + object.createTime = null; + object.hostname = ""; + object.action = ""; + } + if (message.valid != null && message.hasOwnProperty("valid")) + object.valid = message.valid; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + object.invalidReason = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason[message.invalidReason] === undefined ? message.invalidReason : $root.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason[message.invalidReason] : message.invalidReason; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.hostname != null && message.hasOwnProperty("hostname")) + object.hostname = message.hostname; + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; + return object; + }; + + /** + * Converts this TokenProperties to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + * @returns {Object.} JSON object + */ + TokenProperties.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TokenProperties + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TokenProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.TokenProperties"; + }; + + /** + * InvalidReason enum. + * @name google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason + * @enum {number} + * @property {number} INVALID_REASON_UNSPECIFIED=0 INVALID_REASON_UNSPECIFIED value + * @property {number} UNKNOWN_INVALID_REASON=1 UNKNOWN_INVALID_REASON value + * @property {number} MALFORMED=2 MALFORMED value + * @property {number} EXPIRED=3 EXPIRED value + * @property {number} DUPE=4 DUPE value + * @property {number} MISSING=5 MISSING value + * @property {number} BROWSER_ERROR=6 BROWSER_ERROR value + */ + TokenProperties.InvalidReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INVALID_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "UNKNOWN_INVALID_REASON"] = 1; + values[valuesById[2] = "MALFORMED"] = 2; + values[valuesById[3] = "EXPIRED"] = 3; + values[valuesById[4] = "DUPE"] = 4; + values[valuesById[5] = "MISSING"] = 5; + values[valuesById[6] = "BROWSER_ERROR"] = 6; + return values; + })(); + + return TokenProperties; + })(); + + v1.AccountDefenderAssessment = (function() { + + /** + * Properties of an AccountDefenderAssessment. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAccountDefenderAssessment + * @property {Array.|null} [labels] AccountDefenderAssessment labels + */ + + /** + * Constructs a new AccountDefenderAssessment. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AccountDefenderAssessment. + * @implements IAccountDefenderAssessment + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment=} [properties] Properties to set + */ + function AccountDefenderAssessment(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]]; + } + + /** + * AccountDefenderAssessment labels. + * @member {Array.} labels + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @instance + */ + AccountDefenderAssessment.prototype.labels = $util.emptyArray; + + /** + * Creates a new AccountDefenderAssessment instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment instance + */ + AccountDefenderAssessment.create = function create(properties) { + return new AccountDefenderAssessment(properties); + }; + + /** + * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccountDefenderAssessment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labels != null && message.labels.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.labels.length; ++i) + writer.int32(message.labels[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccountDefenderAssessment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccountDefenderAssessment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.labels && message.labels.length)) + message.labels = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.labels.push(reader.int32()); + } else + message.labels.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccountDefenderAssessment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AccountDefenderAssessment message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AccountDefenderAssessment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) + switch (message.labels[i]) { + default: + return "labels: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + return null; + }; + + /** + * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} AccountDefenderAssessment + */ + AccountDefenderAssessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment(); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) + switch (object.labels[i]) { + default: + if (typeof object.labels[i] === "number") { + message.labels[i] = object.labels[i]; + break; + } + case "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": + case 0: + message.labels[i] = 0; + break; + case "PROFILE_MATCH": + case 1: + message.labels[i] = 1; + break; + case "SUSPICIOUS_LOGIN_ACTIVITY": + case 2: + message.labels[i] = 2; + break; + case "SUSPICIOUS_ACCOUNT_CREATION": + case 3: + message.labels[i] = 3; + break; + case "RELATED_ACCOUNTS_NUMBER_HIGH": + case 4: + message.labels[i] = 4; + break; + } + } + return message; + }; + + /** + * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment} message AccountDefenderAssessment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AccountDefenderAssessment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.labels = []; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel[message.labels[j]] === undefined ? message.labels[j] : $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel[message.labels[j]] : message.labels[j]; + } + return object; + }; + + /** + * Converts this AccountDefenderAssessment to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @instance + * @returns {Object.} JSON object + */ + AccountDefenderAssessment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AccountDefenderAssessment + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AccountDefenderAssessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment"; + }; + + /** + * AccountDefenderLabel enum. + * @name google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel + * @enum {number} + * @property {number} ACCOUNT_DEFENDER_LABEL_UNSPECIFIED=0 ACCOUNT_DEFENDER_LABEL_UNSPECIFIED value + * @property {number} PROFILE_MATCH=1 PROFILE_MATCH value + * @property {number} SUSPICIOUS_LOGIN_ACTIVITY=2 SUSPICIOUS_LOGIN_ACTIVITY value + * @property {number} SUSPICIOUS_ACCOUNT_CREATION=3 SUSPICIOUS_ACCOUNT_CREATION value + * @property {number} RELATED_ACCOUNTS_NUMBER_HIGH=4 RELATED_ACCOUNTS_NUMBER_HIGH value + */ + AccountDefenderAssessment.AccountDefenderLabel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROFILE_MATCH"] = 1; + values[valuesById[2] = "SUSPICIOUS_LOGIN_ACTIVITY"] = 2; + values[valuesById[3] = "SUSPICIOUS_ACCOUNT_CREATION"] = 3; + values[valuesById[4] = "RELATED_ACCOUNTS_NUMBER_HIGH"] = 4; + return values; + })(); + + return AccountDefenderAssessment; + })(); + + v1.CreateKeyRequest = (function() { + + /** + * Properties of a CreateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ICreateKeyRequest + * @property {string|null} [parent] CreateKeyRequest parent + * @property {google.cloud.recaptchaenterprise.v1.IKey|null} [key] CreateKeyRequest key + */ + + /** + * Constructs a new CreateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a CreateKeyRequest. + * @implements ICreateKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest=} [properties] Properties to set + */ + function CreateKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateKeyRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @instance + */ + CreateKeyRequest.prototype.parent = ""; + + /** + * CreateKeyRequest key. + * @member {google.cloud.recaptchaenterprise.v1.IKey|null|undefined} key + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @instance + */ + CreateKeyRequest.prototype.key = null; + + /** + * Creates a new CreateKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest instance + */ + CreateKeyRequest.create = function create(properties) { + return new CreateKeyRequest(properties); + }; + + /** + * Encodes the specified CreateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRequest.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.key != null && Object.hasOwnProperty.call(message, "key")) + $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateKeyRequest.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.key != null && message.hasOwnProperty("key")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.key); + if (error) + return "key." + error; + } + return null; + }; + + /** + * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest + */ + CreateKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.CreateKeyRequest.key: object expected"); + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.key); + } + return message; + }; + + /** + * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} message CreateKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.key = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.key, options); + return object; + }; + + /** + * Converts this CreateKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @instance + * @returns {Object.} JSON object + */ + CreateKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateKeyRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.CreateKeyRequest"; + }; + + return CreateKeyRequest; + })(); + + v1.ListKeysRequest = (function() { + + /** + * Properties of a ListKeysRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListKeysRequest + * @property {string|null} [parent] ListKeysRequest parent + * @property {number|null} [pageSize] ListKeysRequest pageSize + * @property {string|null} [pageToken] ListKeysRequest pageToken + */ + + /** + * Constructs a new ListKeysRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListKeysRequest. + * @implements IListKeysRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest=} [properties] Properties to set + */ + function ListKeysRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKeysRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + */ + ListKeysRequest.prototype.parent = ""; + + /** + * ListKeysRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + */ + ListKeysRequest.prototype.pageSize = 0; + + /** + * ListKeysRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + */ + ListKeysRequest.prototype.pageToken = ""; + + /** + * Creates a new ListKeysRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest instance + */ + ListKeysRequest.create = function create(properties) { + return new ListKeysRequest(properties); + }; + + /** + * Encodes the specified ListKeysRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} message ListKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListKeysRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} message ListKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKeysRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKeysRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListKeysRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest + */ + ListKeysRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListKeysRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListKeysRequest} message ListKeysRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKeysRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListKeysRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + * @returns {Object.} JSON object + */ + ListKeysRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKeysRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKeysRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListKeysRequest"; + }; + + return ListKeysRequest; + })(); + + v1.ListKeysResponse = (function() { + + /** + * Properties of a ListKeysResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListKeysResponse + * @property {Array.|null} [keys] ListKeysResponse keys + * @property {string|null} [nextPageToken] ListKeysResponse nextPageToken + */ + + /** + * Constructs a new ListKeysResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListKeysResponse. + * @implements IListKeysResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set + */ + function ListKeysResponse(properties) { + this.keys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKeysResponse keys. + * @member {Array.} keys + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + */ + ListKeysResponse.prototype.keys = $util.emptyArray; + + /** + * ListKeysResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + */ + ListKeysResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListKeysResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse instance + */ + ListKeysResponse.create = function create(properties) { + return new ListKeysResponse(properties); + }; + + /** + * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.keys[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 ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push($root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKeysResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKeysResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.keys[i]); + if (error) + return "keys." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListKeysResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + */ + ListKeysResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) { + if (typeof object.keys[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: object expected"); + message.keys[i] = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.keys[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListKeysResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListKeysResponse} message ListKeysResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKeysResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keys = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.keys[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListKeysResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + * @returns {Object.} JSON object + */ + ListKeysResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKeysResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKeysResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListKeysResponse"; + }; + + return ListKeysResponse; + })(); + + v1.RetrieveLegacySecretKeyRequest = (function() { + + /** + * Properties of a RetrieveLegacySecretKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IRetrieveLegacySecretKeyRequest + * @property {string|null} [key] RetrieveLegacySecretKeyRequest key + */ + + /** + * Constructs a new RetrieveLegacySecretKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RetrieveLegacySecretKeyRequest. + * @implements IRetrieveLegacySecretKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest=} [properties] Properties to set + */ + function RetrieveLegacySecretKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RetrieveLegacySecretKeyRequest key. + * @member {string} key + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @instance + */ + RetrieveLegacySecretKeyRequest.prototype.key = ""; + + /** + * Creates a new RetrieveLegacySecretKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest instance + */ + RetrieveLegacySecretKeyRequest.create = function create(properties) { + return new RetrieveLegacySecretKeyRequest(properties); + }; + + /** + * Encodes the specified RetrieveLegacySecretKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} message RetrieveLegacySecretKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrieveLegacySecretKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + return writer; + }; + + /** + * Encodes the specified RetrieveLegacySecretKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest} message RetrieveLegacySecretKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrieveLegacySecretKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrieveLegacySecretKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RetrieveLegacySecretKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrieveLegacySecretKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RetrieveLegacySecretKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RetrieveLegacySecretKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + return null; + }; + + /** + * Creates a RetrieveLegacySecretKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} RetrieveLegacySecretKeyRequest + */ + RetrieveLegacySecretKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest(); + if (object.key != null) + message.key = String(object.key); + return message; + }; + + /** + * Creates a plain object from a RetrieveLegacySecretKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest} message RetrieveLegacySecretKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RetrieveLegacySecretKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.key = ""; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + return object; + }; + + /** + * Converts this RetrieveLegacySecretKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @instance + * @returns {Object.} JSON object + */ + RetrieveLegacySecretKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RetrieveLegacySecretKeyRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RetrieveLegacySecretKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest"; + }; + + return RetrieveLegacySecretKeyRequest; + })(); + + v1.GetKeyRequest = (function() { + + /** + * Properties of a GetKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IGetKeyRequest + * @property {string|null} [name] GetKeyRequest name + */ + + /** + * Constructs a new GetKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a GetKeyRequest. + * @implements IGetKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest=} [properties] Properties to set + */ + function GetKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetKeyRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @instance + */ + GetKeyRequest.prototype.name = ""; + + /** + * Creates a new GetKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest instance + */ + GetKeyRequest.create = function create(properties) { + return new GetKeyRequest(properties); + }; + + /** + * Encodes the specified GetKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} message GetKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKeyRequest.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 GetKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} message GetKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest(); + 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 GetKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetKeyRequest.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 GetKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest + */ + GetKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.GetKeyRequest} message GetKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetKeyRequest.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 GetKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @instance + * @returns {Object.} JSON object + */ + GetKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetKeyRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.GetKeyRequest"; + }; + + return GetKeyRequest; + })(); + + v1.UpdateKeyRequest = (function() { + + /** + * Properties of an UpdateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IUpdateKeyRequest + * @property {google.cloud.recaptchaenterprise.v1.IKey|null} [key] UpdateKeyRequest key + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateKeyRequest updateMask + */ + + /** + * Constructs a new UpdateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an UpdateKeyRequest. + * @implements IUpdateKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest=} [properties] Properties to set + */ + function UpdateKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateKeyRequest key. + * @member {google.cloud.recaptchaenterprise.v1.IKey|null|undefined} key + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @instance + */ + UpdateKeyRequest.prototype.key = null; + + /** + * UpdateKeyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @instance + */ + UpdateKeyRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest instance + */ + UpdateKeyRequest.create = function create(properties) { + return new UpdateKeyRequest(properties); + }; + + /** + * Encodes the specified UpdateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} message UpdateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} message UpdateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.key); + if (error) + return "key." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest + */ + UpdateKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.key: object expected"); + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.key); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} message UpdateKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.updateMask = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.key, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateKeyRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.UpdateKeyRequest"; + }; + + return UpdateKeyRequest; + })(); + + v1.DeleteKeyRequest = (function() { + + /** + * Properties of a DeleteKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IDeleteKeyRequest + * @property {string|null} [name] DeleteKeyRequest name + */ + + /** + * Constructs a new DeleteKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a DeleteKeyRequest. + * @implements IDeleteKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest=} [properties] Properties to set + */ + function DeleteKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteKeyRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @instance + */ + DeleteKeyRequest.prototype.name = ""; + + /** + * Creates a new DeleteKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest instance + */ + DeleteKeyRequest.create = function create(properties) { + return new DeleteKeyRequest(properties); + }; + + /** + * Encodes the specified DeleteKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} message DeleteKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKeyRequest.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 DeleteKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} message DeleteKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest(); + 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 DeleteKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteKeyRequest.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 DeleteKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest + */ + DeleteKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} message DeleteKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteKeyRequest.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 DeleteKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteKeyRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.DeleteKeyRequest"; + }; + + return DeleteKeyRequest; + })(); + + v1.MigrateKeyRequest = (function() { + + /** + * Properties of a MigrateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IMigrateKeyRequest + * @property {string|null} [name] MigrateKeyRequest name + */ + + /** + * Constructs a new MigrateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a MigrateKeyRequest. + * @implements IMigrateKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest=} [properties] Properties to set + */ + function MigrateKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MigrateKeyRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @instance + */ + MigrateKeyRequest.prototype.name = ""; + + /** + * Creates a new MigrateKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.MigrateKeyRequest} MigrateKeyRequest instance + */ + MigrateKeyRequest.create = function create(properties) { + return new MigrateKeyRequest(properties); + }; + + /** + * Encodes the specified MigrateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.MigrateKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest} message MigrateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MigrateKeyRequest.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 MigrateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.MigrateKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest} message MigrateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MigrateKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MigrateKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.MigrateKeyRequest} MigrateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MigrateKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest(); + 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 MigrateKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.MigrateKeyRequest} MigrateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MigrateKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MigrateKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MigrateKeyRequest.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 MigrateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.MigrateKeyRequest} MigrateKeyRequest + */ + MigrateKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a MigrateKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.MigrateKeyRequest} message MigrateKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MigrateKeyRequest.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 MigrateKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @instance + * @returns {Object.} JSON object + */ + MigrateKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MigrateKeyRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MigrateKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.MigrateKeyRequest"; + }; + + return MigrateKeyRequest; + })(); + + v1.GetMetricsRequest = (function() { + + /** + * Properties of a GetMetricsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IGetMetricsRequest + * @property {string|null} [name] GetMetricsRequest name + */ + + /** + * Constructs a new GetMetricsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a GetMetricsRequest. + * @implements IGetMetricsRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IGetMetricsRequest=} [properties] Properties to set + */ + function GetMetricsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetMetricsRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @instance + */ + GetMetricsRequest.prototype.name = ""; + + /** + * Creates a new GetMetricsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetMetricsRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.GetMetricsRequest} GetMetricsRequest instance + */ + GetMetricsRequest.create = function create(properties) { + return new GetMetricsRequest(properties); + }; + + /** + * Encodes the specified GetMetricsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetMetricsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetMetricsRequest} message GetMetricsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMetricsRequest.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 GetMetricsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetMetricsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetMetricsRequest} message GetMetricsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMetricsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetMetricsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.GetMetricsRequest} GetMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMetricsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.GetMetricsRequest(); + 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 GetMetricsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.GetMetricsRequest} GetMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMetricsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetMetricsRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMetricsRequest.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 GetMetricsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.GetMetricsRequest} GetMetricsRequest + */ + GetMetricsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.GetMetricsRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.GetMetricsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetMetricsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.GetMetricsRequest} message GetMetricsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMetricsRequest.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 GetMetricsRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @instance + * @returns {Object.} JSON object + */ + GetMetricsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetMetricsRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.GetMetricsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetMetricsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.GetMetricsRequest"; + }; + + return GetMetricsRequest; + })(); + + v1.Metrics = (function() { + + /** + * Properties of a Metrics. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IMetrics + * @property {string|null} [name] Metrics name + * @property {google.protobuf.ITimestamp|null} [startTime] Metrics startTime + * @property {Array.|null} [scoreMetrics] Metrics scoreMetrics + * @property {Array.|null} [challengeMetrics] Metrics challengeMetrics + */ + + /** + * Constructs a new Metrics. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a Metrics. + * @implements IMetrics + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IMetrics=} [properties] Properties to set + */ + function Metrics(properties) { + this.scoreMetrics = []; + this.challengeMetrics = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metrics name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @instance + */ + Metrics.prototype.name = ""; + + /** + * Metrics startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @instance + */ + Metrics.prototype.startTime = null; + + /** + * Metrics scoreMetrics. + * @member {Array.} scoreMetrics + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @instance + */ + Metrics.prototype.scoreMetrics = $util.emptyArray; + + /** + * Metrics challengeMetrics. + * @member {Array.} challengeMetrics + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @instance + */ + Metrics.prototype.challengeMetrics = $util.emptyArray; + + /** + * Creates a new Metrics instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IMetrics=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Metrics} Metrics instance + */ + Metrics.create = function create(properties) { + return new Metrics(properties); + }; + + /** + * Encodes the specified Metrics message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Metrics.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IMetrics} message Metrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metrics.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.scoreMetrics != null && message.scoreMetrics.length) + for (var i = 0; i < message.scoreMetrics.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.ScoreMetrics.encode(message.scoreMetrics[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.challengeMetrics != null && message.challengeMetrics.length) + for (var i = 0; i < message.challengeMetrics.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics.encode(message.challengeMetrics[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified Metrics message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Metrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IMetrics} message Metrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metrics message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.Metrics} Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metrics.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Metrics(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.name = reader.string(); + break; + } + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.scoreMetrics && message.scoreMetrics.length)) + message.scoreMetrics = []; + message.scoreMetrics.push($root.google.cloud.recaptchaenterprise.v1.ScoreMetrics.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.challengeMetrics && message.challengeMetrics.length)) + message.challengeMetrics = []; + message.challengeMetrics.push($root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.Metrics} Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metrics message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metrics.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.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.scoreMetrics != null && message.hasOwnProperty("scoreMetrics")) { + if (!Array.isArray(message.scoreMetrics)) + return "scoreMetrics: array expected"; + for (var i = 0; i < message.scoreMetrics.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.ScoreMetrics.verify(message.scoreMetrics[i]); + if (error) + return "scoreMetrics." + error; + } + } + if (message.challengeMetrics != null && message.hasOwnProperty("challengeMetrics")) { + if (!Array.isArray(message.challengeMetrics)) + return "challengeMetrics: array expected"; + for (var i = 0; i < message.challengeMetrics.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics.verify(message.challengeMetrics[i]); + if (error) + return "challengeMetrics." + error; + } + } + return null; + }; + + /** + * Creates a Metrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.Metrics} Metrics + */ + Metrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Metrics) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.Metrics(); + if (object.name != null) + message.name = String(object.name); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Metrics.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.scoreMetrics) { + if (!Array.isArray(object.scoreMetrics)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.Metrics.scoreMetrics: array expected"); + message.scoreMetrics = []; + for (var i = 0; i < object.scoreMetrics.length; ++i) { + if (typeof object.scoreMetrics[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Metrics.scoreMetrics: object expected"); + message.scoreMetrics[i] = $root.google.cloud.recaptchaenterprise.v1.ScoreMetrics.fromObject(object.scoreMetrics[i]); + } + } + if (object.challengeMetrics) { + if (!Array.isArray(object.challengeMetrics)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.Metrics.challengeMetrics: array expected"); + message.challengeMetrics = []; + for (var i = 0; i < object.challengeMetrics.length; ++i) { + if (typeof object.challengeMetrics[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Metrics.challengeMetrics: object expected"); + message.challengeMetrics[i] = $root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics.fromObject(object.challengeMetrics[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Metrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.Metrics} message Metrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metrics.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.scoreMetrics = []; + object.challengeMetrics = []; + } + if (options.defaults) { + object.startTime = null; + object.name = ""; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.scoreMetrics && message.scoreMetrics.length) { + object.scoreMetrics = []; + for (var j = 0; j < message.scoreMetrics.length; ++j) + object.scoreMetrics[j] = $root.google.cloud.recaptchaenterprise.v1.ScoreMetrics.toObject(message.scoreMetrics[j], options); + } + if (message.challengeMetrics && message.challengeMetrics.length) { + object.challengeMetrics = []; + for (var j = 0; j < message.challengeMetrics.length; ++j) + object.challengeMetrics[j] = $root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics.toObject(message.challengeMetrics[j], options); + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this Metrics to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @instance + * @returns {Object.} JSON object + */ + Metrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Metrics + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.Metrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Metrics"; + }; + + return Metrics; + })(); + + v1.RetrieveLegacySecretKeyResponse = (function() { + + /** + * Properties of a RetrieveLegacySecretKeyResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IRetrieveLegacySecretKeyResponse + * @property {string|null} [legacySecretKey] RetrieveLegacySecretKeyResponse legacySecretKey + */ + + /** + * Constructs a new RetrieveLegacySecretKeyResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RetrieveLegacySecretKeyResponse. + * @implements IRetrieveLegacySecretKeyResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse=} [properties] Properties to set + */ + function RetrieveLegacySecretKeyResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RetrieveLegacySecretKeyResponse legacySecretKey. + * @member {string} legacySecretKey + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @instance + */ + RetrieveLegacySecretKeyResponse.prototype.legacySecretKey = ""; + + /** + * Creates a new RetrieveLegacySecretKeyResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse instance + */ + RetrieveLegacySecretKeyResponse.create = function create(properties) { + return new RetrieveLegacySecretKeyResponse(properties); + }; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse} message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrieveLegacySecretKeyResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.legacySecretKey != null && Object.hasOwnProperty.call(message, "legacySecretKey")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.legacySecretKey); + return writer; + }; + + /** + * Encodes the specified RetrieveLegacySecretKeyResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse} message RetrieveLegacySecretKeyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrieveLegacySecretKeyResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrieveLegacySecretKeyResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.legacySecretKey = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RetrieveLegacySecretKeyResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrieveLegacySecretKeyResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RetrieveLegacySecretKeyResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RetrieveLegacySecretKeyResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.legacySecretKey != null && message.hasOwnProperty("legacySecretKey")) + if (!$util.isString(message.legacySecretKey)) + return "legacySecretKey: string expected"; + return null; + }; + + /** + * Creates a RetrieveLegacySecretKeyResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} RetrieveLegacySecretKeyResponse + */ + RetrieveLegacySecretKeyResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse(); + if (object.legacySecretKey != null) + message.legacySecretKey = String(object.legacySecretKey); + return message; + }; + + /** + * Creates a plain object from a RetrieveLegacySecretKeyResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse} message RetrieveLegacySecretKeyResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RetrieveLegacySecretKeyResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.legacySecretKey = ""; + if (message.legacySecretKey != null && message.hasOwnProperty("legacySecretKey")) + object.legacySecretKey = message.legacySecretKey; + return object; + }; + + /** + * Converts this RetrieveLegacySecretKeyResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @instance + * @returns {Object.} JSON object + */ + RetrieveLegacySecretKeyResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RetrieveLegacySecretKeyResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RetrieveLegacySecretKeyResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse"; + }; + + return RetrieveLegacySecretKeyResponse; + })(); + + v1.Key = (function() { + + /** + * Properties of a Key. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IKey + * @property {string|null} [name] Key name + * @property {string|null} [displayName] Key displayName + * @property {google.cloud.recaptchaenterprise.v1.IWebKeySettings|null} [webSettings] Key webSettings + * @property {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null} [androidSettings] Key androidSettings + * @property {google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null} [iosSettings] Key iosSettings + * @property {Object.|null} [labels] Key labels + * @property {google.protobuf.ITimestamp|null} [createTime] Key createTime + * @property {google.cloud.recaptchaenterprise.v1.ITestingOptions|null} [testingOptions] Key testingOptions + * @property {google.cloud.recaptchaenterprise.v1.IWafSettings|null} [wafSettings] Key wafSettings + */ + + /** + * Constructs a new Key. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a Key. + * @implements IKey + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IKey=} [properties] Properties to set + */ + function Key(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]]; + } + + /** + * Key name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.name = ""; + + /** + * Key displayName. + * @member {string} displayName + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.displayName = ""; + + /** + * Key webSettings. + * @member {google.cloud.recaptchaenterprise.v1.IWebKeySettings|null|undefined} webSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.webSettings = null; + + /** + * Key androidSettings. + * @member {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null|undefined} androidSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.androidSettings = null; + + /** + * Key iosSettings. + * @member {google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null|undefined} iosSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.iosSettings = null; + + /** + * Key labels. + * @member {Object.} labels + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.labels = $util.emptyObject; + + /** + * Key createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.createTime = null; + + /** + * Key testingOptions. + * @member {google.cloud.recaptchaenterprise.v1.ITestingOptions|null|undefined} testingOptions + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.testingOptions = null; + + /** + * Key wafSettings. + * @member {google.cloud.recaptchaenterprise.v1.IWafSettings|null|undefined} wafSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.wafSettings = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Key platformSettings. + * @member {"webSettings"|"androidSettings"|"iosSettings"|undefined} platformSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Object.defineProperty(Key.prototype, "platformSettings", { + get: $util.oneOfGetter($oneOfFields = ["webSettings", "androidSettings", "iosSettings"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Key instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.IKey=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key instance + */ + Key.create = function create(properties) { + return new Key(properties); + }; + + /** + * Encodes the specified Key message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.IKey} message Key message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Key.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.webSettings != null && Object.hasOwnProperty.call(message, "webSettings")) + $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.encode(message.webSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.androidSettings != null && Object.hasOwnProperty.call(message, "androidSettings")) + $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.encode(message.androidSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.iosSettings != null && Object.hasOwnProperty.call(message, "iosSettings")) + $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.encode(message.iosSettings, writer.uint32(/* id 5, wireType 2 =*/42).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 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(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.testingOptions != null && Object.hasOwnProperty.call(message, "testingOptions")) + $root.google.cloud.recaptchaenterprise.v1.TestingOptions.encode(message.testingOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.wafSettings != null && Object.hasOwnProperty.call(message, "wafSettings")) + $root.google.cloud.recaptchaenterprise.v1.WafSettings.encode(message.wafSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Key message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.IKey} message Key message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Key.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Key message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Key.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Key(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.webSettings = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.decode(reader, reader.uint32()); + break; + } + case 4: { + message.androidSettings = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.decode(reader, reader.uint32()); + break; + } + case 5: { + message.iosSettings = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.decode(reader, reader.uint32()); + 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; + } + case 7: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 9: { + message.testingOptions = $root.google.cloud.recaptchaenterprise.v1.TestingOptions.decode(reader, reader.uint32()); + break; + } + case 10: { + message.wafSettings = $root.google.cloud.recaptchaenterprise.v1.WafSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Key message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Key.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Key message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Key.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.webSettings != null && message.hasOwnProperty("webSettings")) { + properties.platformSettings = 1; + { + var error = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.verify(message.webSettings); + if (error) + return "webSettings." + error; + } + } + if (message.androidSettings != null && message.hasOwnProperty("androidSettings")) { + if (properties.platformSettings === 1) + return "platformSettings: multiple values"; + properties.platformSettings = 1; + { + var error = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify(message.androidSettings); + if (error) + return "androidSettings." + error; + } + } + if (message.iosSettings != null && message.hasOwnProperty("iosSettings")) { + if (properties.platformSettings === 1) + return "platformSettings: multiple values"; + properties.platformSettings = 1; + { + var error = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify(message.iosSettings); + if (error) + return "iosSettings." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.testingOptions != null && message.hasOwnProperty("testingOptions")) { + var error = $root.google.cloud.recaptchaenterprise.v1.TestingOptions.verify(message.testingOptions); + if (error) + return "testingOptions." + error; + } + if (message.wafSettings != null && message.hasOwnProperty("wafSettings")) { + var error = $root.google.cloud.recaptchaenterprise.v1.WafSettings.verify(message.wafSettings); + if (error) + return "wafSettings." + error; + } + return null; + }; + + /** + * Creates a Key message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key + */ + Key.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Key) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.Key(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.webSettings != null) { + if (typeof object.webSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.webSettings: object expected"); + message.webSettings = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.fromObject(object.webSettings); + } + if (object.androidSettings != null) { + if (typeof object.androidSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.androidSettings: object expected"); + message.androidSettings = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.fromObject(object.androidSettings); + } + if (object.iosSettings != null) { + if (typeof object.iosSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.iosSettings: object expected"); + message.iosSettings = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.fromObject(object.iosSettings); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.testingOptions != null) { + if (typeof object.testingOptions !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.testingOptions: object expected"); + message.testingOptions = $root.google.cloud.recaptchaenterprise.v1.TestingOptions.fromObject(object.testingOptions); + } + if (object.wafSettings != null) { + if (typeof object.wafSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.wafSettings: object expected"); + message.wafSettings = $root.google.cloud.recaptchaenterprise.v1.WafSettings.fromObject(object.wafSettings); + } + return message; + }; + + /** + * Creates a plain object from a Key message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.Key} message Key + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Key.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.createTime = null; + object.testingOptions = null; + object.wafSettings = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.webSettings != null && message.hasOwnProperty("webSettings")) { + object.webSettings = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.toObject(message.webSettings, options); + if (options.oneofs) + object.platformSettings = "webSettings"; + } + if (message.androidSettings != null && message.hasOwnProperty("androidSettings")) { + object.androidSettings = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.toObject(message.androidSettings, options); + if (options.oneofs) + object.platformSettings = "androidSettings"; + } + if (message.iosSettings != null && message.hasOwnProperty("iosSettings")) { + object.iosSettings = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.toObject(message.iosSettings, options); + if (options.oneofs) + object.platformSettings = "iosSettings"; + } + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.testingOptions != null && message.hasOwnProperty("testingOptions")) + object.testingOptions = $root.google.cloud.recaptchaenterprise.v1.TestingOptions.toObject(message.testingOptions, options); + if (message.wafSettings != null && message.hasOwnProperty("wafSettings")) + object.wafSettings = $root.google.cloud.recaptchaenterprise.v1.WafSettings.toObject(message.wafSettings, options); + return object; + }; + + /** + * Converts this Key to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + * @returns {Object.} JSON object + */ + Key.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Key + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Key.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.Key"; + }; + + return Key; + })(); + + v1.TestingOptions = (function() { + + /** + * Properties of a TestingOptions. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ITestingOptions + * @property {number|null} [testingScore] TestingOptions testingScore + * @property {google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge|null} [testingChallenge] TestingOptions testingChallenge + */ + + /** + * Constructs a new TestingOptions. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a TestingOptions. + * @implements ITestingOptions + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ITestingOptions=} [properties] Properties to set + */ + function TestingOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TestingOptions testingScore. + * @member {number} testingScore + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @instance + */ + TestingOptions.prototype.testingScore = 0; + + /** + * TestingOptions testingChallenge. + * @member {google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge} testingChallenge + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @instance + */ + TestingOptions.prototype.testingChallenge = 0; + + /** + * Creates a new TestingOptions instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITestingOptions=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.TestingOptions} TestingOptions instance + */ + TestingOptions.create = function create(properties) { + return new TestingOptions(properties); + }; + + /** + * Encodes the specified TestingOptions message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TestingOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITestingOptions} message TestingOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestingOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.testingScore != null && Object.hasOwnProperty.call(message, "testingScore")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.testingScore); + if (message.testingChallenge != null && Object.hasOwnProperty.call(message, "testingChallenge")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.testingChallenge); + return writer; + }; + + /** + * Encodes the specified TestingOptions message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TestingOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITestingOptions} message TestingOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestingOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TestingOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.TestingOptions} TestingOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestingOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.TestingOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.testingScore = reader.float(); + break; + } + case 2: { + message.testingChallenge = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TestingOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.TestingOptions} TestingOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestingOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TestingOptions message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TestingOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.testingScore != null && message.hasOwnProperty("testingScore")) + if (typeof message.testingScore !== "number") + return "testingScore: number expected"; + if (message.testingChallenge != null && message.hasOwnProperty("testingChallenge")) + switch (message.testingChallenge) { + default: + return "testingChallenge: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a TestingOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.TestingOptions} TestingOptions + */ + TestingOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.TestingOptions) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.TestingOptions(); + if (object.testingScore != null) + message.testingScore = Number(object.testingScore); + switch (object.testingChallenge) { + default: + if (typeof object.testingChallenge === "number") { + message.testingChallenge = object.testingChallenge; + break; + } + break; + case "TESTING_CHALLENGE_UNSPECIFIED": + case 0: + message.testingChallenge = 0; + break; + case "NOCAPTCHA": + case 1: + message.testingChallenge = 1; + break; + case "UNSOLVABLE_CHALLENGE": + case 2: + message.testingChallenge = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a TestingOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {google.cloud.recaptchaenterprise.v1.TestingOptions} message TestingOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TestingOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.testingScore = 0; + object.testingChallenge = options.enums === String ? "TESTING_CHALLENGE_UNSPECIFIED" : 0; + } + if (message.testingScore != null && message.hasOwnProperty("testingScore")) + object.testingScore = options.json && !isFinite(message.testingScore) ? String(message.testingScore) : message.testingScore; + if (message.testingChallenge != null && message.hasOwnProperty("testingChallenge")) + object.testingChallenge = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge[message.testingChallenge] === undefined ? message.testingChallenge : $root.google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge[message.testingChallenge] : message.testingChallenge; + return object; + }; + + /** + * Converts this TestingOptions to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @instance + * @returns {Object.} JSON object + */ + TestingOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TestingOptions + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.TestingOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TestingOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.TestingOptions"; + }; + + /** + * TestingChallenge enum. + * @name google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge + * @enum {number} + * @property {number} TESTING_CHALLENGE_UNSPECIFIED=0 TESTING_CHALLENGE_UNSPECIFIED value + * @property {number} NOCAPTCHA=1 NOCAPTCHA value + * @property {number} UNSOLVABLE_CHALLENGE=2 UNSOLVABLE_CHALLENGE value + */ + TestingOptions.TestingChallenge = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TESTING_CHALLENGE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOCAPTCHA"] = 1; + values[valuesById[2] = "UNSOLVABLE_CHALLENGE"] = 2; + return values; + })(); + + return TestingOptions; + })(); + + v1.WebKeySettings = (function() { + + /** + * Properties of a WebKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IWebKeySettings + * @property {boolean|null} [allowAllDomains] WebKeySettings allowAllDomains + * @property {Array.|null} [allowedDomains] WebKeySettings allowedDomains + * @property {boolean|null} [allowAmpTraffic] WebKeySettings allowAmpTraffic + * @property {google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|null} [integrationType] WebKeySettings integrationType + * @property {google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|null} [challengeSecurityPreference] WebKeySettings challengeSecurityPreference + */ + + /** + * Constructs a new WebKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a WebKeySettings. + * @implements IWebKeySettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings=} [properties] Properties to set + */ + function WebKeySettings(properties) { + this.allowedDomains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebKeySettings allowAllDomains. + * @member {boolean} allowAllDomains + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.allowAllDomains = false; + + /** + * WebKeySettings allowedDomains. + * @member {Array.} allowedDomains + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.allowedDomains = $util.emptyArray; + + /** + * WebKeySettings allowAmpTraffic. + * @member {boolean} allowAmpTraffic + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.allowAmpTraffic = false; + + /** + * WebKeySettings integrationType. + * @member {google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType} integrationType + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.integrationType = 0; + + /** + * WebKeySettings challengeSecurityPreference. + * @member {google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference} challengeSecurityPreference + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.challengeSecurityPreference = 0; + + /** + * Creates a new WebKeySettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings instance + */ + WebKeySettings.create = function create(properties) { + return new WebKeySettings(properties); + }; + + /** + * Encodes the specified WebKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings} message WebKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebKeySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedDomains != null && message.allowedDomains.length) + for (var i = 0; i < message.allowedDomains.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedDomains[i]); + if (message.allowAmpTraffic != null && Object.hasOwnProperty.call(message, "allowAmpTraffic")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAmpTraffic); + if (message.allowAllDomains != null && Object.hasOwnProperty.call(message, "allowAllDomains")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowAllDomains); + if (message.integrationType != null && Object.hasOwnProperty.call(message, "integrationType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.integrationType); + if (message.challengeSecurityPreference != null && Object.hasOwnProperty.call(message, "challengeSecurityPreference")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.challengeSecurityPreference); + return writer; + }; + + /** + * Encodes the specified WebKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings} message WebKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebKeySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebKeySettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.WebKeySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.allowAllDomains = reader.bool(); + break; + } + case 1: { + if (!(message.allowedDomains && message.allowedDomains.length)) + message.allowedDomains = []; + message.allowedDomains.push(reader.string()); + break; + } + case 2: { + message.allowAmpTraffic = reader.bool(); + break; + } + case 4: { + message.integrationType = reader.int32(); + break; + } + case 5: { + message.challengeSecurityPreference = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebKeySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebKeySettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebKeySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAllDomains != null && message.hasOwnProperty("allowAllDomains")) + if (typeof message.allowAllDomains !== "boolean") + return "allowAllDomains: boolean expected"; + if (message.allowedDomains != null && message.hasOwnProperty("allowedDomains")) { + if (!Array.isArray(message.allowedDomains)) + return "allowedDomains: array expected"; + for (var i = 0; i < message.allowedDomains.length; ++i) + if (!$util.isString(message.allowedDomains[i])) + return "allowedDomains: string[] expected"; + } + if (message.allowAmpTraffic != null && message.hasOwnProperty("allowAmpTraffic")) + if (typeof message.allowAmpTraffic !== "boolean") + return "allowAmpTraffic: boolean expected"; + if (message.integrationType != null && message.hasOwnProperty("integrationType")) + switch (message.integrationType) { + default: + return "integrationType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.challengeSecurityPreference != null && message.hasOwnProperty("challengeSecurityPreference")) + switch (message.challengeSecurityPreference) { + default: + return "challengeSecurityPreference: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a WebKeySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings + */ + WebKeySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.WebKeySettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.WebKeySettings(); + if (object.allowAllDomains != null) + message.allowAllDomains = Boolean(object.allowAllDomains); + if (object.allowedDomains) { + if (!Array.isArray(object.allowedDomains)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.WebKeySettings.allowedDomains: array expected"); + message.allowedDomains = []; + for (var i = 0; i < object.allowedDomains.length; ++i) + message.allowedDomains[i] = String(object.allowedDomains[i]); + } + if (object.allowAmpTraffic != null) + message.allowAmpTraffic = Boolean(object.allowAmpTraffic); + switch (object.integrationType) { + default: + if (typeof object.integrationType === "number") { + message.integrationType = object.integrationType; + break; + } + break; + case "INTEGRATION_TYPE_UNSPECIFIED": + case 0: + message.integrationType = 0; + break; + case "SCORE": + case 1: + message.integrationType = 1; + break; + case "CHECKBOX": + case 2: + message.integrationType = 2; + break; + case "INVISIBLE": + case 3: + message.integrationType = 3; + break; + } + switch (object.challengeSecurityPreference) { + default: + if (typeof object.challengeSecurityPreference === "number") { + message.challengeSecurityPreference = object.challengeSecurityPreference; + break; + } + break; + case "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED": + case 0: + message.challengeSecurityPreference = 0; + break; + case "USABILITY": + case 1: + message.challengeSecurityPreference = 1; + break; + case "BALANCE": + case 2: + message.challengeSecurityPreference = 2; + break; + case "SECURITY": + case 3: + message.challengeSecurityPreference = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a WebKeySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.WebKeySettings} message WebKeySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebKeySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.allowedDomains = []; + if (options.defaults) { + object.allowAmpTraffic = false; + object.allowAllDomains = false; + object.integrationType = options.enums === String ? "INTEGRATION_TYPE_UNSPECIFIED" : 0; + object.challengeSecurityPreference = options.enums === String ? "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED" : 0; + } + if (message.allowedDomains && message.allowedDomains.length) { + object.allowedDomains = []; + for (var j = 0; j < message.allowedDomains.length; ++j) + object.allowedDomains[j] = message.allowedDomains[j]; + } + if (message.allowAmpTraffic != null && message.hasOwnProperty("allowAmpTraffic")) + object.allowAmpTraffic = message.allowAmpTraffic; + if (message.allowAllDomains != null && message.hasOwnProperty("allowAllDomains")) + object.allowAllDomains = message.allowAllDomains; + if (message.integrationType != null && message.hasOwnProperty("integrationType")) + object.integrationType = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType[message.integrationType] === undefined ? message.integrationType : $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType[message.integrationType] : message.integrationType; + if (message.challengeSecurityPreference != null && message.hasOwnProperty("challengeSecurityPreference")) + object.challengeSecurityPreference = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference[message.challengeSecurityPreference] === undefined ? message.challengeSecurityPreference : $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference[message.challengeSecurityPreference] : message.challengeSecurityPreference; + return object; + }; + + /** + * Converts this WebKeySettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + * @returns {Object.} JSON object + */ + WebKeySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WebKeySettings + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WebKeySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.WebKeySettings"; + }; + + /** + * IntegrationType enum. + * @name google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType + * @enum {number} + * @property {number} INTEGRATION_TYPE_UNSPECIFIED=0 INTEGRATION_TYPE_UNSPECIFIED value + * @property {number} SCORE=1 SCORE value + * @property {number} CHECKBOX=2 CHECKBOX value + * @property {number} INVISIBLE=3 INVISIBLE value + */ + WebKeySettings.IntegrationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INTEGRATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SCORE"] = 1; + values[valuesById[2] = "CHECKBOX"] = 2; + values[valuesById[3] = "INVISIBLE"] = 3; + return values; + })(); + + /** + * ChallengeSecurityPreference enum. + * @name google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference + * @enum {number} + * @property {number} CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED=0 CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED value + * @property {number} USABILITY=1 USABILITY value + * @property {number} BALANCE=2 BALANCE value + * @property {number} SECURITY=3 SECURITY value + */ + WebKeySettings.ChallengeSecurityPreference = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED"] = 0; + values[valuesById[1] = "USABILITY"] = 1; + values[valuesById[2] = "BALANCE"] = 2; + values[valuesById[3] = "SECURITY"] = 3; + return values; + })(); + + return WebKeySettings; + })(); + + v1.AndroidKeySettings = (function() { + + /** + * Properties of an AndroidKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAndroidKeySettings + * @property {boolean|null} [allowAllPackageNames] AndroidKeySettings allowAllPackageNames + * @property {Array.|null} [allowedPackageNames] AndroidKeySettings allowedPackageNames + */ + + /** + * Constructs a new AndroidKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AndroidKeySettings. + * @implements IAndroidKeySettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings=} [properties] Properties to set + */ + function AndroidKeySettings(properties) { + this.allowedPackageNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AndroidKeySettings allowAllPackageNames. + * @member {boolean} allowAllPackageNames + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @instance + */ + AndroidKeySettings.prototype.allowAllPackageNames = false; + + /** + * AndroidKeySettings allowedPackageNames. + * @member {Array.} allowedPackageNames + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @instance + */ + AndroidKeySettings.prototype.allowedPackageNames = $util.emptyArray; + + /** + * Creates a new AndroidKeySettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings instance + */ + AndroidKeySettings.create = function create(properties) { + return new AndroidKeySettings(properties); + }; + + /** + * Encodes the specified AndroidKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings} message AndroidKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AndroidKeySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedPackageNames != null && message.allowedPackageNames.length) + for (var i = 0; i < message.allowedPackageNames.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedPackageNames[i]); + if (message.allowAllPackageNames != null && Object.hasOwnProperty.call(message, "allowAllPackageNames")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAllPackageNames); + return writer; + }; + + /** + * Encodes the specified AndroidKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings} message AndroidKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AndroidKeySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AndroidKeySettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.allowAllPackageNames = reader.bool(); + break; + } + case 1: { + if (!(message.allowedPackageNames && message.allowedPackageNames.length)) + message.allowedPackageNames = []; + message.allowedPackageNames.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AndroidKeySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AndroidKeySettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AndroidKeySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAllPackageNames != null && message.hasOwnProperty("allowAllPackageNames")) + if (typeof message.allowAllPackageNames !== "boolean") + return "allowAllPackageNames: boolean expected"; + if (message.allowedPackageNames != null && message.hasOwnProperty("allowedPackageNames")) { + if (!Array.isArray(message.allowedPackageNames)) + return "allowedPackageNames: array expected"; + for (var i = 0; i < message.allowedPackageNames.length; ++i) + if (!$util.isString(message.allowedPackageNames[i])) + return "allowedPackageNames: string[] expected"; + } + return null; + }; + + /** + * Creates an AndroidKeySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings + */ + AndroidKeySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings(); + if (object.allowAllPackageNames != null) + message.allowAllPackageNames = Boolean(object.allowAllPackageNames); + if (object.allowedPackageNames) { + if (!Array.isArray(object.allowedPackageNames)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.AndroidKeySettings.allowedPackageNames: array expected"); + message.allowedPackageNames = []; + for (var i = 0; i < object.allowedPackageNames.length; ++i) + message.allowedPackageNames[i] = String(object.allowedPackageNames[i]); + } + return message; + }; + + /** + * Creates a plain object from an AndroidKeySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} message AndroidKeySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AndroidKeySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.allowedPackageNames = []; + if (options.defaults) + object.allowAllPackageNames = false; + if (message.allowedPackageNames && message.allowedPackageNames.length) { + object.allowedPackageNames = []; + for (var j = 0; j < message.allowedPackageNames.length; ++j) + object.allowedPackageNames[j] = message.allowedPackageNames[j]; + } + if (message.allowAllPackageNames != null && message.hasOwnProperty("allowAllPackageNames")) + object.allowAllPackageNames = message.allowAllPackageNames; + return object; + }; + + /** + * Converts this AndroidKeySettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @instance + * @returns {Object.} JSON object + */ + AndroidKeySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AndroidKeySettings + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AndroidKeySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.AndroidKeySettings"; + }; + + return AndroidKeySettings; + })(); + + v1.IOSKeySettings = (function() { + + /** + * Properties of a IOSKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IIOSKeySettings + * @property {boolean|null} [allowAllBundleIds] IOSKeySettings allowAllBundleIds + * @property {Array.|null} [allowedBundleIds] IOSKeySettings allowedBundleIds + */ + + /** + * Constructs a new IOSKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a IOSKeySettings. + * @implements IIOSKeySettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings=} [properties] Properties to set + */ + function IOSKeySettings(properties) { + this.allowedBundleIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IOSKeySettings allowAllBundleIds. + * @member {boolean} allowAllBundleIds + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @instance + */ + IOSKeySettings.prototype.allowAllBundleIds = false; + + /** + * IOSKeySettings allowedBundleIds. + * @member {Array.} allowedBundleIds + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @instance + */ + IOSKeySettings.prototype.allowedBundleIds = $util.emptyArray; + + /** + * Creates a new IOSKeySettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings instance + */ + IOSKeySettings.create = function create(properties) { + return new IOSKeySettings(properties); + }; + + /** + * Encodes the specified IOSKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings} message IOSKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IOSKeySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedBundleIds != null && message.allowedBundleIds.length) + for (var i = 0; i < message.allowedBundleIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedBundleIds[i]); + if (message.allowAllBundleIds != null && Object.hasOwnProperty.call(message, "allowAllBundleIds")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAllBundleIds); + return writer; + }; + + /** + * Encodes the specified IOSKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings} message IOSKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IOSKeySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IOSKeySettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.allowAllBundleIds = reader.bool(); + break; + } + case 1: { + if (!(message.allowedBundleIds && message.allowedBundleIds.length)) + message.allowedBundleIds = []; + message.allowedBundleIds.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IOSKeySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a IOSKeySettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IOSKeySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAllBundleIds != null && message.hasOwnProperty("allowAllBundleIds")) + if (typeof message.allowAllBundleIds !== "boolean") + return "allowAllBundleIds: boolean expected"; + if (message.allowedBundleIds != null && message.hasOwnProperty("allowedBundleIds")) { + if (!Array.isArray(message.allowedBundleIds)) + return "allowedBundleIds: array expected"; + for (var i = 0; i < message.allowedBundleIds.length; ++i) + if (!$util.isString(message.allowedBundleIds[i])) + return "allowedBundleIds: string[] expected"; + } + return null; + }; + + /** + * Creates a IOSKeySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings + */ + IOSKeySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings(); + if (object.allowAllBundleIds != null) + message.allowAllBundleIds = Boolean(object.allowAllBundleIds); + if (object.allowedBundleIds) { + if (!Array.isArray(object.allowedBundleIds)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.IOSKeySettings.allowedBundleIds: array expected"); + message.allowedBundleIds = []; + for (var i = 0; i < object.allowedBundleIds.length; ++i) + message.allowedBundleIds[i] = String(object.allowedBundleIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a IOSKeySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IOSKeySettings} message IOSKeySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IOSKeySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.allowedBundleIds = []; + if (options.defaults) + object.allowAllBundleIds = false; + if (message.allowedBundleIds && message.allowedBundleIds.length) { + object.allowedBundleIds = []; + for (var j = 0; j < message.allowedBundleIds.length; ++j) + object.allowedBundleIds[j] = message.allowedBundleIds[j]; + } + if (message.allowAllBundleIds != null && message.hasOwnProperty("allowAllBundleIds")) + object.allowAllBundleIds = message.allowAllBundleIds; + return object; + }; + + /** + * Converts this IOSKeySettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @instance + * @returns {Object.} JSON object + */ + IOSKeySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IOSKeySettings + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IOSKeySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.IOSKeySettings"; + }; + + return IOSKeySettings; + })(); + + v1.ScoreDistribution = (function() { + + /** + * Properties of a ScoreDistribution. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IScoreDistribution + * @property {Object.|null} [scoreBuckets] ScoreDistribution scoreBuckets + */ + + /** + * Constructs a new ScoreDistribution. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ScoreDistribution. + * @implements IScoreDistribution + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IScoreDistribution=} [properties] Properties to set + */ + function ScoreDistribution(properties) { + this.scoreBuckets = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ScoreDistribution scoreBuckets. + * @member {Object.} scoreBuckets + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @instance + */ + ScoreDistribution.prototype.scoreBuckets = $util.emptyObject; + + /** + * Creates a new ScoreDistribution instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {google.cloud.recaptchaenterprise.v1.IScoreDistribution=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ScoreDistribution} ScoreDistribution instance + */ + ScoreDistribution.create = function create(properties) { + return new ScoreDistribution(properties); + }; + + /** + * Encodes the specified ScoreDistribution message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreDistribution.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {google.cloud.recaptchaenterprise.v1.IScoreDistribution} message ScoreDistribution message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScoreDistribution.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.scoreBuckets != null && Object.hasOwnProperty.call(message, "scoreBuckets")) + for (var keys = Object.keys(message.scoreBuckets), i = 0; i < keys.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]).uint32(/* id 2, wireType 0 =*/16).int64(message.scoreBuckets[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified ScoreDistribution message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreDistribution.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {google.cloud.recaptchaenterprise.v1.IScoreDistribution} message ScoreDistribution message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScoreDistribution.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ScoreDistribution message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ScoreDistribution} ScoreDistribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScoreDistribution.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (message.scoreBuckets === $util.emptyObject) + message.scoreBuckets = {}; + var end2 = reader.uint32() + reader.pos; + key = 0; + value = 0; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.int32(); + break; + case 2: + value = reader.int64(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.scoreBuckets[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ScoreDistribution message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ScoreDistribution} ScoreDistribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScoreDistribution.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ScoreDistribution message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ScoreDistribution.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.scoreBuckets != null && message.hasOwnProperty("scoreBuckets")) { + if (!$util.isObject(message.scoreBuckets)) + return "scoreBuckets: object expected"; + var key = Object.keys(message.scoreBuckets); + for (var i = 0; i < key.length; ++i) { + if (!$util.key32Re.test(key[i])) + return "scoreBuckets: integer key{k:int32} expected"; + if (!$util.isInteger(message.scoreBuckets[key[i]]) && !(message.scoreBuckets[key[i]] && $util.isInteger(message.scoreBuckets[key[i]].low) && $util.isInteger(message.scoreBuckets[key[i]].high))) + return "scoreBuckets: integer|Long{k:int32} expected"; + } + } + return null; + }; + + /** + * Creates a ScoreDistribution message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ScoreDistribution} ScoreDistribution + */ + ScoreDistribution.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution(); + if (object.scoreBuckets) { + if (typeof object.scoreBuckets !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ScoreDistribution.scoreBuckets: object expected"); + message.scoreBuckets = {}; + for (var keys = Object.keys(object.scoreBuckets), i = 0; i < keys.length; ++i) + if ($util.Long) + (message.scoreBuckets[keys[i]] = $util.Long.fromValue(object.scoreBuckets[keys[i]])).unsigned = false; + else if (typeof object.scoreBuckets[keys[i]] === "string") + message.scoreBuckets[keys[i]] = parseInt(object.scoreBuckets[keys[i]], 10); + else if (typeof object.scoreBuckets[keys[i]] === "number") + message.scoreBuckets[keys[i]] = object.scoreBuckets[keys[i]]; + else if (typeof object.scoreBuckets[keys[i]] === "object") + message.scoreBuckets[keys[i]] = new $util.LongBits(object.scoreBuckets[keys[i]].low >>> 0, object.scoreBuckets[keys[i]].high >>> 0).toNumber(); + } + return message; + }; + + /** + * Creates a plain object from a ScoreDistribution message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {google.cloud.recaptchaenterprise.v1.ScoreDistribution} message ScoreDistribution + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ScoreDistribution.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.scoreBuckets = {}; + var keys2; + if (message.scoreBuckets && (keys2 = Object.keys(message.scoreBuckets)).length) { + object.scoreBuckets = {}; + for (var j = 0; j < keys2.length; ++j) + if (typeof message.scoreBuckets[keys2[j]] === "number") + object.scoreBuckets[keys2[j]] = options.longs === String ? String(message.scoreBuckets[keys2[j]]) : message.scoreBuckets[keys2[j]]; + else + object.scoreBuckets[keys2[j]] = options.longs === String ? $util.Long.prototype.toString.call(message.scoreBuckets[keys2[j]]) : options.longs === Number ? new $util.LongBits(message.scoreBuckets[keys2[j]].low >>> 0, message.scoreBuckets[keys2[j]].high >>> 0).toNumber() : message.scoreBuckets[keys2[j]]; + } + return object; + }; + + /** + * Converts this ScoreDistribution to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @instance + * @returns {Object.} JSON object + */ + ScoreDistribution.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ScoreDistribution + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ScoreDistribution + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ScoreDistribution.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ScoreDistribution"; + }; + + return ScoreDistribution; + })(); + + v1.ScoreMetrics = (function() { + + /** + * Properties of a ScoreMetrics. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IScoreMetrics + * @property {google.cloud.recaptchaenterprise.v1.IScoreDistribution|null} [overallMetrics] ScoreMetrics overallMetrics + * @property {Object.|null} [actionMetrics] ScoreMetrics actionMetrics + */ + + /** + * Constructs a new ScoreMetrics. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ScoreMetrics. + * @implements IScoreMetrics + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IScoreMetrics=} [properties] Properties to set + */ + function ScoreMetrics(properties) { + this.actionMetrics = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ScoreMetrics overallMetrics. + * @member {google.cloud.recaptchaenterprise.v1.IScoreDistribution|null|undefined} overallMetrics + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @instance + */ + ScoreMetrics.prototype.overallMetrics = null; + + /** + * ScoreMetrics actionMetrics. + * @member {Object.} actionMetrics + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @instance + */ + ScoreMetrics.prototype.actionMetrics = $util.emptyObject; + + /** + * Creates a new ScoreMetrics instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IScoreMetrics=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ScoreMetrics} ScoreMetrics instance + */ + ScoreMetrics.create = function create(properties) { + return new ScoreMetrics(properties); + }; + + /** + * Encodes the specified ScoreMetrics message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreMetrics.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IScoreMetrics} message ScoreMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScoreMetrics.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.overallMetrics != null && Object.hasOwnProperty.call(message, "overallMetrics")) + $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.encode(message.overallMetrics, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.actionMetrics != null && Object.hasOwnProperty.call(message, "actionMetrics")) + for (var keys = Object.keys(message.actionMetrics), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.encode(message.actionMetrics[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ScoreMetrics message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ScoreMetrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IScoreMetrics} message ScoreMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScoreMetrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ScoreMetrics message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ScoreMetrics} ScoreMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScoreMetrics.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ScoreMetrics(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.overallMetrics = $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.actionMetrics === $util.emptyObject) + message.actionMetrics = {}; + 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.recaptchaenterprise.v1.ScoreDistribution.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.actionMetrics[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ScoreMetrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ScoreMetrics} ScoreMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScoreMetrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ScoreMetrics message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ScoreMetrics.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.overallMetrics != null && message.hasOwnProperty("overallMetrics")) { + var error = $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.verify(message.overallMetrics); + if (error) + return "overallMetrics." + error; + } + if (message.actionMetrics != null && message.hasOwnProperty("actionMetrics")) { + if (!$util.isObject(message.actionMetrics)) + return "actionMetrics: object expected"; + var key = Object.keys(message.actionMetrics); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.verify(message.actionMetrics[key[i]]); + if (error) + return "actionMetrics." + error; + } + } + return null; + }; + + /** + * Creates a ScoreMetrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ScoreMetrics} ScoreMetrics + */ + ScoreMetrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ScoreMetrics) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ScoreMetrics(); + if (object.overallMetrics != null) { + if (typeof object.overallMetrics !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ScoreMetrics.overallMetrics: object expected"); + message.overallMetrics = $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.fromObject(object.overallMetrics); + } + if (object.actionMetrics) { + if (typeof object.actionMetrics !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ScoreMetrics.actionMetrics: object expected"); + message.actionMetrics = {}; + for (var keys = Object.keys(object.actionMetrics), i = 0; i < keys.length; ++i) { + if (typeof object.actionMetrics[keys[i]] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ScoreMetrics.actionMetrics: object expected"); + message.actionMetrics[keys[i]] = $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.fromObject(object.actionMetrics[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a ScoreMetrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.ScoreMetrics} message ScoreMetrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ScoreMetrics.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.actionMetrics = {}; + if (options.defaults) + object.overallMetrics = null; + if (message.overallMetrics != null && message.hasOwnProperty("overallMetrics")) + object.overallMetrics = $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.toObject(message.overallMetrics, options); + var keys2; + if (message.actionMetrics && (keys2 = Object.keys(message.actionMetrics)).length) { + object.actionMetrics = {}; + for (var j = 0; j < keys2.length; ++j) + object.actionMetrics[keys2[j]] = $root.google.cloud.recaptchaenterprise.v1.ScoreDistribution.toObject(message.actionMetrics[keys2[j]], options); + } + return object; + }; + + /** + * Converts this ScoreMetrics to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @instance + * @returns {Object.} JSON object + */ + ScoreMetrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ScoreMetrics + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ScoreMetrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ScoreMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ScoreMetrics"; + }; + + return ScoreMetrics; + })(); + + v1.ChallengeMetrics = (function() { + + /** + * Properties of a ChallengeMetrics. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IChallengeMetrics + * @property {number|Long|null} [pageloadCount] ChallengeMetrics pageloadCount + * @property {number|Long|null} [nocaptchaCount] ChallengeMetrics nocaptchaCount + * @property {number|Long|null} [failedCount] ChallengeMetrics failedCount + * @property {number|Long|null} [passedCount] ChallengeMetrics passedCount + */ + + /** + * Constructs a new ChallengeMetrics. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ChallengeMetrics. + * @implements IChallengeMetrics + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IChallengeMetrics=} [properties] Properties to set + */ + function ChallengeMetrics(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChallengeMetrics pageloadCount. + * @member {number|Long} pageloadCount + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @instance + */ + ChallengeMetrics.prototype.pageloadCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ChallengeMetrics nocaptchaCount. + * @member {number|Long} nocaptchaCount + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @instance + */ + ChallengeMetrics.prototype.nocaptchaCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ChallengeMetrics failedCount. + * @member {number|Long} failedCount + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @instance + */ + ChallengeMetrics.prototype.failedCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ChallengeMetrics passedCount. + * @member {number|Long} passedCount + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @instance + */ + ChallengeMetrics.prototype.passedCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ChallengeMetrics instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IChallengeMetrics=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ChallengeMetrics} ChallengeMetrics instance + */ + ChallengeMetrics.create = function create(properties) { + return new ChallengeMetrics(properties); + }; + + /** + * Encodes the specified ChallengeMetrics message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ChallengeMetrics.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IChallengeMetrics} message ChallengeMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChallengeMetrics.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageloadCount != null && Object.hasOwnProperty.call(message, "pageloadCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.pageloadCount); + if (message.nocaptchaCount != null && Object.hasOwnProperty.call(message, "nocaptchaCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.nocaptchaCount); + if (message.failedCount != null && Object.hasOwnProperty.call(message, "failedCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.failedCount); + if (message.passedCount != null && Object.hasOwnProperty.call(message, "passedCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.passedCount); + return writer; + }; + + /** + * Encodes the specified ChallengeMetrics message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ChallengeMetrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.IChallengeMetrics} message ChallengeMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChallengeMetrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChallengeMetrics message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ChallengeMetrics} ChallengeMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChallengeMetrics.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.pageloadCount = reader.int64(); + break; + } + case 2: { + message.nocaptchaCount = reader.int64(); + break; + } + case 3: { + message.failedCount = reader.int64(); + break; + } + case 4: { + message.passedCount = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChallengeMetrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ChallengeMetrics} ChallengeMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChallengeMetrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChallengeMetrics message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChallengeMetrics.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageloadCount != null && message.hasOwnProperty("pageloadCount")) + if (!$util.isInteger(message.pageloadCount) && !(message.pageloadCount && $util.isInteger(message.pageloadCount.low) && $util.isInteger(message.pageloadCount.high))) + return "pageloadCount: integer|Long expected"; + if (message.nocaptchaCount != null && message.hasOwnProperty("nocaptchaCount")) + if (!$util.isInteger(message.nocaptchaCount) && !(message.nocaptchaCount && $util.isInteger(message.nocaptchaCount.low) && $util.isInteger(message.nocaptchaCount.high))) + return "nocaptchaCount: integer|Long expected"; + if (message.failedCount != null && message.hasOwnProperty("failedCount")) + if (!$util.isInteger(message.failedCount) && !(message.failedCount && $util.isInteger(message.failedCount.low) && $util.isInteger(message.failedCount.high))) + return "failedCount: integer|Long expected"; + if (message.passedCount != null && message.hasOwnProperty("passedCount")) + if (!$util.isInteger(message.passedCount) && !(message.passedCount && $util.isInteger(message.passedCount.low) && $util.isInteger(message.passedCount.high))) + return "passedCount: integer|Long expected"; + return null; + }; + + /** + * Creates a ChallengeMetrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ChallengeMetrics} ChallengeMetrics + */ + ChallengeMetrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ChallengeMetrics(); + if (object.pageloadCount != null) + if ($util.Long) + (message.pageloadCount = $util.Long.fromValue(object.pageloadCount)).unsigned = false; + else if (typeof object.pageloadCount === "string") + message.pageloadCount = parseInt(object.pageloadCount, 10); + else if (typeof object.pageloadCount === "number") + message.pageloadCount = object.pageloadCount; + else if (typeof object.pageloadCount === "object") + message.pageloadCount = new $util.LongBits(object.pageloadCount.low >>> 0, object.pageloadCount.high >>> 0).toNumber(); + if (object.nocaptchaCount != null) + if ($util.Long) + (message.nocaptchaCount = $util.Long.fromValue(object.nocaptchaCount)).unsigned = false; + else if (typeof object.nocaptchaCount === "string") + message.nocaptchaCount = parseInt(object.nocaptchaCount, 10); + else if (typeof object.nocaptchaCount === "number") + message.nocaptchaCount = object.nocaptchaCount; + else if (typeof object.nocaptchaCount === "object") + message.nocaptchaCount = new $util.LongBits(object.nocaptchaCount.low >>> 0, object.nocaptchaCount.high >>> 0).toNumber(); + if (object.failedCount != null) + if ($util.Long) + (message.failedCount = $util.Long.fromValue(object.failedCount)).unsigned = false; + else if (typeof object.failedCount === "string") + message.failedCount = parseInt(object.failedCount, 10); + else if (typeof object.failedCount === "number") + message.failedCount = object.failedCount; + else if (typeof object.failedCount === "object") + message.failedCount = new $util.LongBits(object.failedCount.low >>> 0, object.failedCount.high >>> 0).toNumber(); + if (object.passedCount != null) + if ($util.Long) + (message.passedCount = $util.Long.fromValue(object.passedCount)).unsigned = false; + else if (typeof object.passedCount === "string") + message.passedCount = parseInt(object.passedCount, 10); + else if (typeof object.passedCount === "number") + message.passedCount = object.passedCount; + else if (typeof object.passedCount === "object") + message.passedCount = new $util.LongBits(object.passedCount.low >>> 0, object.passedCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ChallengeMetrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {google.cloud.recaptchaenterprise.v1.ChallengeMetrics} message ChallengeMetrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChallengeMetrics.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.pageloadCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pageloadCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.nocaptchaCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.nocaptchaCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.failedCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.failedCount = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.passedCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.passedCount = options.longs === String ? "0" : 0; + } + if (message.pageloadCount != null && message.hasOwnProperty("pageloadCount")) + if (typeof message.pageloadCount === "number") + object.pageloadCount = options.longs === String ? String(message.pageloadCount) : message.pageloadCount; + else + object.pageloadCount = options.longs === String ? $util.Long.prototype.toString.call(message.pageloadCount) : options.longs === Number ? new $util.LongBits(message.pageloadCount.low >>> 0, message.pageloadCount.high >>> 0).toNumber() : message.pageloadCount; + if (message.nocaptchaCount != null && message.hasOwnProperty("nocaptchaCount")) + if (typeof message.nocaptchaCount === "number") + object.nocaptchaCount = options.longs === String ? String(message.nocaptchaCount) : message.nocaptchaCount; + else + object.nocaptchaCount = options.longs === String ? $util.Long.prototype.toString.call(message.nocaptchaCount) : options.longs === Number ? new $util.LongBits(message.nocaptchaCount.low >>> 0, message.nocaptchaCount.high >>> 0).toNumber() : message.nocaptchaCount; + if (message.failedCount != null && message.hasOwnProperty("failedCount")) + if (typeof message.failedCount === "number") + object.failedCount = options.longs === String ? String(message.failedCount) : message.failedCount; + else + object.failedCount = options.longs === String ? $util.Long.prototype.toString.call(message.failedCount) : options.longs === Number ? new $util.LongBits(message.failedCount.low >>> 0, message.failedCount.high >>> 0).toNumber() : message.failedCount; + if (message.passedCount != null && message.hasOwnProperty("passedCount")) + if (typeof message.passedCount === "number") + object.passedCount = options.longs === String ? String(message.passedCount) : message.passedCount; + else + object.passedCount = options.longs === String ? $util.Long.prototype.toString.call(message.passedCount) : options.longs === Number ? new $util.LongBits(message.passedCount.low >>> 0, message.passedCount.high >>> 0).toNumber() : message.passedCount; + return object; + }; + + /** + * Converts this ChallengeMetrics to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @instance + * @returns {Object.} JSON object + */ + ChallengeMetrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ChallengeMetrics + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ChallengeMetrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ChallengeMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ChallengeMetrics"; + }; + + return ChallengeMetrics; + })(); + + v1.ListRelatedAccountGroupMembershipsRequest = (function() { + + /** + * Properties of a ListRelatedAccountGroupMembershipsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListRelatedAccountGroupMembershipsRequest + * @property {string|null} [parent] ListRelatedAccountGroupMembershipsRequest parent + * @property {number|null} [pageSize] ListRelatedAccountGroupMembershipsRequest pageSize + * @property {string|null} [pageToken] ListRelatedAccountGroupMembershipsRequest pageToken + */ + + /** + * Constructs a new ListRelatedAccountGroupMembershipsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListRelatedAccountGroupMembershipsRequest. + * @implements IListRelatedAccountGroupMembershipsRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest=} [properties] Properties to set + */ + function ListRelatedAccountGroupMembershipsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRelatedAccountGroupMembershipsRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @instance + */ + ListRelatedAccountGroupMembershipsRequest.prototype.parent = ""; + + /** + * ListRelatedAccountGroupMembershipsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @instance + */ + ListRelatedAccountGroupMembershipsRequest.prototype.pageSize = 0; + + /** + * ListRelatedAccountGroupMembershipsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @instance + */ + ListRelatedAccountGroupMembershipsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListRelatedAccountGroupMembershipsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest} ListRelatedAccountGroupMembershipsRequest instance + */ + ListRelatedAccountGroupMembershipsRequest.create = function create(properties) { + return new ListRelatedAccountGroupMembershipsRequest(properties); + }; + + /** + * Encodes the specified ListRelatedAccountGroupMembershipsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest} message ListRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupMembershipsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListRelatedAccountGroupMembershipsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest} message ListRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupMembershipsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRelatedAccountGroupMembershipsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest} ListRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupMembershipsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRelatedAccountGroupMembershipsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest} ListRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupMembershipsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRelatedAccountGroupMembershipsRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRelatedAccountGroupMembershipsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListRelatedAccountGroupMembershipsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest} ListRelatedAccountGroupMembershipsRequest + */ + ListRelatedAccountGroupMembershipsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListRelatedAccountGroupMembershipsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest} message ListRelatedAccountGroupMembershipsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRelatedAccountGroupMembershipsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListRelatedAccountGroupMembershipsRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @instance + * @returns {Object.} JSON object + */ + ListRelatedAccountGroupMembershipsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRelatedAccountGroupMembershipsRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRelatedAccountGroupMembershipsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest"; + }; + + return ListRelatedAccountGroupMembershipsRequest; + })(); + + v1.ListRelatedAccountGroupMembershipsResponse = (function() { + + /** + * Properties of a ListRelatedAccountGroupMembershipsResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListRelatedAccountGroupMembershipsResponse + * @property {Array.|null} [relatedAccountGroupMemberships] ListRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships + * @property {string|null} [nextPageToken] ListRelatedAccountGroupMembershipsResponse nextPageToken + */ + + /** + * Constructs a new ListRelatedAccountGroupMembershipsResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListRelatedAccountGroupMembershipsResponse. + * @implements IListRelatedAccountGroupMembershipsResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse=} [properties] Properties to set + */ + function ListRelatedAccountGroupMembershipsResponse(properties) { + this.relatedAccountGroupMemberships = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships. + * @member {Array.} relatedAccountGroupMemberships + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @instance + */ + ListRelatedAccountGroupMembershipsResponse.prototype.relatedAccountGroupMemberships = $util.emptyArray; + + /** + * ListRelatedAccountGroupMembershipsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @instance + */ + ListRelatedAccountGroupMembershipsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListRelatedAccountGroupMembershipsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse} ListRelatedAccountGroupMembershipsResponse instance + */ + ListRelatedAccountGroupMembershipsResponse.create = function create(properties) { + return new ListRelatedAccountGroupMembershipsResponse(properties); + }; + + /** + * Encodes the specified ListRelatedAccountGroupMembershipsResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse} message ListRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupMembershipsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.relatedAccountGroupMemberships != null && message.relatedAccountGroupMemberships.length) + for (var i = 0; i < message.relatedAccountGroupMemberships.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.encode(message.relatedAccountGroupMemberships[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 ListRelatedAccountGroupMembershipsResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse} message ListRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupMembershipsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRelatedAccountGroupMembershipsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse} ListRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupMembershipsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.relatedAccountGroupMemberships && message.relatedAccountGroupMemberships.length)) + message.relatedAccountGroupMemberships = []; + message.relatedAccountGroupMemberships.push($root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRelatedAccountGroupMembershipsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse} ListRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupMembershipsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRelatedAccountGroupMembershipsResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRelatedAccountGroupMembershipsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.relatedAccountGroupMemberships != null && message.hasOwnProperty("relatedAccountGroupMemberships")) { + if (!Array.isArray(message.relatedAccountGroupMemberships)) + return "relatedAccountGroupMemberships: array expected"; + for (var i = 0; i < message.relatedAccountGroupMemberships.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.verify(message.relatedAccountGroupMemberships[i]); + if (error) + return "relatedAccountGroupMemberships." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListRelatedAccountGroupMembershipsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse} ListRelatedAccountGroupMembershipsResponse + */ + ListRelatedAccountGroupMembershipsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse(); + if (object.relatedAccountGroupMemberships) { + if (!Array.isArray(object.relatedAccountGroupMemberships)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse.relatedAccountGroupMemberships: array expected"); + message.relatedAccountGroupMemberships = []; + for (var i = 0; i < object.relatedAccountGroupMemberships.length; ++i) { + if (typeof object.relatedAccountGroupMemberships[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse.relatedAccountGroupMemberships: object expected"); + message.relatedAccountGroupMemberships[i] = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.fromObject(object.relatedAccountGroupMemberships[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListRelatedAccountGroupMembershipsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse} message ListRelatedAccountGroupMembershipsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRelatedAccountGroupMembershipsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.relatedAccountGroupMemberships = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.relatedAccountGroupMemberships && message.relatedAccountGroupMemberships.length) { + object.relatedAccountGroupMemberships = []; + for (var j = 0; j < message.relatedAccountGroupMemberships.length; ++j) + object.relatedAccountGroupMemberships[j] = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.toObject(message.relatedAccountGroupMemberships[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListRelatedAccountGroupMembershipsResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @instance + * @returns {Object.} JSON object + */ + ListRelatedAccountGroupMembershipsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRelatedAccountGroupMembershipsResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRelatedAccountGroupMembershipsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse"; + }; + + return ListRelatedAccountGroupMembershipsResponse; + })(); + + v1.ListRelatedAccountGroupsRequest = (function() { + + /** + * Properties of a ListRelatedAccountGroupsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListRelatedAccountGroupsRequest + * @property {string|null} [parent] ListRelatedAccountGroupsRequest parent + * @property {number|null} [pageSize] ListRelatedAccountGroupsRequest pageSize + * @property {string|null} [pageToken] ListRelatedAccountGroupsRequest pageToken + */ + + /** + * Constructs a new ListRelatedAccountGroupsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListRelatedAccountGroupsRequest. + * @implements IListRelatedAccountGroupsRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest=} [properties] Properties to set + */ + function ListRelatedAccountGroupsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRelatedAccountGroupsRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @instance + */ + ListRelatedAccountGroupsRequest.prototype.parent = ""; + + /** + * ListRelatedAccountGroupsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @instance + */ + ListRelatedAccountGroupsRequest.prototype.pageSize = 0; + + /** + * ListRelatedAccountGroupsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @instance + */ + ListRelatedAccountGroupsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListRelatedAccountGroupsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest} ListRelatedAccountGroupsRequest instance + */ + ListRelatedAccountGroupsRequest.create = function create(properties) { + return new ListRelatedAccountGroupsRequest(properties); + }; + + /** + * Encodes the specified ListRelatedAccountGroupsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest} message ListRelatedAccountGroupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListRelatedAccountGroupsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest} message ListRelatedAccountGroupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRelatedAccountGroupsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest} ListRelatedAccountGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRelatedAccountGroupsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest} ListRelatedAccountGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRelatedAccountGroupsRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRelatedAccountGroupsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListRelatedAccountGroupsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest} ListRelatedAccountGroupsRequest + */ + ListRelatedAccountGroupsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListRelatedAccountGroupsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest} message ListRelatedAccountGroupsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRelatedAccountGroupsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListRelatedAccountGroupsRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @instance + * @returns {Object.} JSON object + */ + ListRelatedAccountGroupsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRelatedAccountGroupsRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRelatedAccountGroupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest"; + }; + + return ListRelatedAccountGroupsRequest; + })(); + + v1.ListRelatedAccountGroupsResponse = (function() { + + /** + * Properties of a ListRelatedAccountGroupsResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListRelatedAccountGroupsResponse + * @property {Array.|null} [relatedAccountGroups] ListRelatedAccountGroupsResponse relatedAccountGroups + * @property {string|null} [nextPageToken] ListRelatedAccountGroupsResponse nextPageToken + */ + + /** + * Constructs a new ListRelatedAccountGroupsResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListRelatedAccountGroupsResponse. + * @implements IListRelatedAccountGroupsResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse=} [properties] Properties to set + */ + function ListRelatedAccountGroupsResponse(properties) { + this.relatedAccountGroups = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListRelatedAccountGroupsResponse relatedAccountGroups. + * @member {Array.} relatedAccountGroups + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @instance + */ + ListRelatedAccountGroupsResponse.prototype.relatedAccountGroups = $util.emptyArray; + + /** + * ListRelatedAccountGroupsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @instance + */ + ListRelatedAccountGroupsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListRelatedAccountGroupsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse} ListRelatedAccountGroupsResponse instance + */ + ListRelatedAccountGroupsResponse.create = function create(properties) { + return new ListRelatedAccountGroupsResponse(properties); + }; + + /** + * Encodes the specified ListRelatedAccountGroupsResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse} message ListRelatedAccountGroupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.relatedAccountGroups != null && message.relatedAccountGroups.length) + for (var i = 0; i < message.relatedAccountGroups.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.encode(message.relatedAccountGroups[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 ListRelatedAccountGroupsResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse} message ListRelatedAccountGroupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListRelatedAccountGroupsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListRelatedAccountGroupsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse} ListRelatedAccountGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.relatedAccountGroups && message.relatedAccountGroups.length)) + message.relatedAccountGroups = []; + message.relatedAccountGroups.push($root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListRelatedAccountGroupsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse} ListRelatedAccountGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListRelatedAccountGroupsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListRelatedAccountGroupsResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListRelatedAccountGroupsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.relatedAccountGroups != null && message.hasOwnProperty("relatedAccountGroups")) { + if (!Array.isArray(message.relatedAccountGroups)) + return "relatedAccountGroups: array expected"; + for (var i = 0; i < message.relatedAccountGroups.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.verify(message.relatedAccountGroups[i]); + if (error) + return "relatedAccountGroups." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListRelatedAccountGroupsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse} ListRelatedAccountGroupsResponse + */ + ListRelatedAccountGroupsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse(); + if (object.relatedAccountGroups) { + if (!Array.isArray(object.relatedAccountGroups)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse.relatedAccountGroups: array expected"); + message.relatedAccountGroups = []; + for (var i = 0; i < object.relatedAccountGroups.length; ++i) { + if (typeof object.relatedAccountGroups[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse.relatedAccountGroups: object expected"); + message.relatedAccountGroups[i] = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.fromObject(object.relatedAccountGroups[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListRelatedAccountGroupsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse} message ListRelatedAccountGroupsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListRelatedAccountGroupsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.relatedAccountGroups = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.relatedAccountGroups && message.relatedAccountGroups.length) { + object.relatedAccountGroups = []; + for (var j = 0; j < message.relatedAccountGroups.length; ++j) + object.relatedAccountGroups[j] = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.toObject(message.relatedAccountGroups[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListRelatedAccountGroupsResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @instance + * @returns {Object.} JSON object + */ + ListRelatedAccountGroupsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListRelatedAccountGroupsResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListRelatedAccountGroupsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse"; + }; + + return ListRelatedAccountGroupsResponse; + })(); + + v1.SearchRelatedAccountGroupMembershipsRequest = (function() { + + /** + * Properties of a SearchRelatedAccountGroupMembershipsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ISearchRelatedAccountGroupMembershipsRequest + * @property {string|null} [project] SearchRelatedAccountGroupMembershipsRequest project + * @property {Uint8Array|null} [hashedAccountId] SearchRelatedAccountGroupMembershipsRequest hashedAccountId + * @property {number|null} [pageSize] SearchRelatedAccountGroupMembershipsRequest pageSize + * @property {string|null} [pageToken] SearchRelatedAccountGroupMembershipsRequest pageToken + */ + + /** + * Constructs a new SearchRelatedAccountGroupMembershipsRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a SearchRelatedAccountGroupMembershipsRequest. + * @implements ISearchRelatedAccountGroupMembershipsRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest=} [properties] Properties to set + */ + function SearchRelatedAccountGroupMembershipsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchRelatedAccountGroupMembershipsRequest project. + * @member {string} project + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @instance + */ + SearchRelatedAccountGroupMembershipsRequest.prototype.project = ""; + + /** + * SearchRelatedAccountGroupMembershipsRequest hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @instance + */ + SearchRelatedAccountGroupMembershipsRequest.prototype.hashedAccountId = $util.newBuffer([]); + + /** + * SearchRelatedAccountGroupMembershipsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @instance + */ + SearchRelatedAccountGroupMembershipsRequest.prototype.pageSize = 0; + + /** + * SearchRelatedAccountGroupMembershipsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @instance + */ + SearchRelatedAccountGroupMembershipsRequest.prototype.pageToken = ""; + + /** + * Creates a new SearchRelatedAccountGroupMembershipsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest} SearchRelatedAccountGroupMembershipsRequest instance + */ + SearchRelatedAccountGroupMembershipsRequest.create = function create(properties) { + return new SearchRelatedAccountGroupMembershipsRequest(properties); + }; + + /** + * Encodes the specified SearchRelatedAccountGroupMembershipsRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest} message SearchRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRelatedAccountGroupMembershipsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hashedAccountId); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified SearchRelatedAccountGroupMembershipsRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest} message SearchRelatedAccountGroupMembershipsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRelatedAccountGroupMembershipsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest} SearchRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRelatedAccountGroupMembershipsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.project = reader.string(); + break; + } + case 2: { + message.hashedAccountId = reader.bytes(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest} SearchRelatedAccountGroupMembershipsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRelatedAccountGroupMembershipsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchRelatedAccountGroupMembershipsRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchRelatedAccountGroupMembershipsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer 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 SearchRelatedAccountGroupMembershipsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest} SearchRelatedAccountGroupMembershipsRequest + */ + SearchRelatedAccountGroupMembershipsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest(); + if (object.project != null) + message.project = String(object.project); + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length >= 0) + message.hashedAccountId = object.hashedAccountId; + 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 SearchRelatedAccountGroupMembershipsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest} message SearchRelatedAccountGroupMembershipsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchRelatedAccountGroupMembershipsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.project = ""; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } + object.pageSize = 0; + object.pageToken = ""; + } + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this SearchRelatedAccountGroupMembershipsRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @instance + * @returns {Object.} JSON object + */ + SearchRelatedAccountGroupMembershipsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchRelatedAccountGroupMembershipsRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchRelatedAccountGroupMembershipsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest"; + }; + + return SearchRelatedAccountGroupMembershipsRequest; + })(); + + v1.SearchRelatedAccountGroupMembershipsResponse = (function() { + + /** + * Properties of a SearchRelatedAccountGroupMembershipsResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ISearchRelatedAccountGroupMembershipsResponse + * @property {Array.|null} [relatedAccountGroupMemberships] SearchRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships + * @property {string|null} [nextPageToken] SearchRelatedAccountGroupMembershipsResponse nextPageToken + */ + + /** + * Constructs a new SearchRelatedAccountGroupMembershipsResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a SearchRelatedAccountGroupMembershipsResponse. + * @implements ISearchRelatedAccountGroupMembershipsResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse=} [properties] Properties to set + */ + function SearchRelatedAccountGroupMembershipsResponse(properties) { + this.relatedAccountGroupMemberships = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchRelatedAccountGroupMembershipsResponse relatedAccountGroupMemberships. + * @member {Array.} relatedAccountGroupMemberships + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @instance + */ + SearchRelatedAccountGroupMembershipsResponse.prototype.relatedAccountGroupMemberships = $util.emptyArray; + + /** + * SearchRelatedAccountGroupMembershipsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @instance + */ + SearchRelatedAccountGroupMembershipsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new SearchRelatedAccountGroupMembershipsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse} SearchRelatedAccountGroupMembershipsResponse instance + */ + SearchRelatedAccountGroupMembershipsResponse.create = function create(properties) { + return new SearchRelatedAccountGroupMembershipsResponse(properties); + }; + + /** + * Encodes the specified SearchRelatedAccountGroupMembershipsResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse} message SearchRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRelatedAccountGroupMembershipsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.relatedAccountGroupMemberships != null && message.relatedAccountGroupMemberships.length) + for (var i = 0; i < message.relatedAccountGroupMemberships.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.encode(message.relatedAccountGroupMemberships[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 SearchRelatedAccountGroupMembershipsResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse} message SearchRelatedAccountGroupMembershipsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchRelatedAccountGroupMembershipsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse} SearchRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRelatedAccountGroupMembershipsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.relatedAccountGroupMemberships && message.relatedAccountGroupMemberships.length)) + message.relatedAccountGroupMemberships = []; + message.relatedAccountGroupMemberships.push($root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchRelatedAccountGroupMembershipsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse} SearchRelatedAccountGroupMembershipsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchRelatedAccountGroupMembershipsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchRelatedAccountGroupMembershipsResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchRelatedAccountGroupMembershipsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.relatedAccountGroupMemberships != null && message.hasOwnProperty("relatedAccountGroupMemberships")) { + if (!Array.isArray(message.relatedAccountGroupMemberships)) + return "relatedAccountGroupMemberships: array expected"; + for (var i = 0; i < message.relatedAccountGroupMemberships.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.verify(message.relatedAccountGroupMemberships[i]); + if (error) + return "relatedAccountGroupMemberships." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a SearchRelatedAccountGroupMembershipsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse} SearchRelatedAccountGroupMembershipsResponse + */ + SearchRelatedAccountGroupMembershipsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse(); + if (object.relatedAccountGroupMemberships) { + if (!Array.isArray(object.relatedAccountGroupMemberships)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse.relatedAccountGroupMemberships: array expected"); + message.relatedAccountGroupMemberships = []; + for (var i = 0; i < object.relatedAccountGroupMemberships.length; ++i) { + if (typeof object.relatedAccountGroupMemberships[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse.relatedAccountGroupMemberships: object expected"); + message.relatedAccountGroupMemberships[i] = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.fromObject(object.relatedAccountGroupMemberships[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a SearchRelatedAccountGroupMembershipsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse} message SearchRelatedAccountGroupMembershipsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchRelatedAccountGroupMembershipsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.relatedAccountGroupMemberships = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.relatedAccountGroupMemberships && message.relatedAccountGroupMemberships.length) { + object.relatedAccountGroupMemberships = []; + for (var j = 0; j < message.relatedAccountGroupMemberships.length; ++j) + object.relatedAccountGroupMemberships[j] = $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.toObject(message.relatedAccountGroupMemberships[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this SearchRelatedAccountGroupMembershipsResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @instance + * @returns {Object.} JSON object + */ + SearchRelatedAccountGroupMembershipsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchRelatedAccountGroupMembershipsResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchRelatedAccountGroupMembershipsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse"; + }; + + return SearchRelatedAccountGroupMembershipsResponse; + })(); + + v1.RelatedAccountGroupMembership = (function() { + + /** + * Properties of a RelatedAccountGroupMembership. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IRelatedAccountGroupMembership + * @property {string|null} [name] RelatedAccountGroupMembership name + * @property {Uint8Array|null} [hashedAccountId] RelatedAccountGroupMembership hashedAccountId + */ + + /** + * Constructs a new RelatedAccountGroupMembership. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RelatedAccountGroupMembership. + * @implements IRelatedAccountGroupMembership + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership=} [properties] Properties to set + */ + function RelatedAccountGroupMembership(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RelatedAccountGroupMembership name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @instance + */ + RelatedAccountGroupMembership.prototype.name = ""; + + /** + * RelatedAccountGroupMembership hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @instance + */ + RelatedAccountGroupMembership.prototype.hashedAccountId = $util.newBuffer([]); + + /** + * Creates a new RelatedAccountGroupMembership instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership} RelatedAccountGroupMembership instance + */ + RelatedAccountGroupMembership.create = function create(properties) { + return new RelatedAccountGroupMembership(properties); + }; + + /** + * Encodes the specified RelatedAccountGroupMembership message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership} message RelatedAccountGroupMembership message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RelatedAccountGroupMembership.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.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hashedAccountId); + return writer; + }; + + /** + * Encodes the specified RelatedAccountGroupMembership message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership} message RelatedAccountGroupMembership message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RelatedAccountGroupMembership.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RelatedAccountGroupMembership message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership} RelatedAccountGroupMembership + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RelatedAccountGroupMembership.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.hashedAccountId = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RelatedAccountGroupMembership message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership} RelatedAccountGroupMembership + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RelatedAccountGroupMembership.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RelatedAccountGroupMembership message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RelatedAccountGroupMembership.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.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; + return null; + }; + + /** + * Creates a RelatedAccountGroupMembership message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership} RelatedAccountGroupMembership + */ + RelatedAccountGroupMembership.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership(); + if (object.name != null) + message.name = String(object.name); + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length >= 0) + message.hashedAccountId = object.hashedAccountId; + return message; + }; + + /** + * Creates a plain object from a RelatedAccountGroupMembership message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership} message RelatedAccountGroupMembership + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RelatedAccountGroupMembership.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + return object; + }; + + /** + * Converts this RelatedAccountGroupMembership to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @instance + * @returns {Object.} JSON object + */ + RelatedAccountGroupMembership.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RelatedAccountGroupMembership + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RelatedAccountGroupMembership.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership"; + }; + + return RelatedAccountGroupMembership; + })(); + + v1.RelatedAccountGroup = (function() { + + /** + * Properties of a RelatedAccountGroup. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IRelatedAccountGroup + * @property {string|null} [name] RelatedAccountGroup name + */ + + /** + * Constructs a new RelatedAccountGroup. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RelatedAccountGroup. + * @implements IRelatedAccountGroup + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup=} [properties] Properties to set + */ + function RelatedAccountGroup(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RelatedAccountGroup name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @instance + */ + RelatedAccountGroup.prototype.name = ""; + + /** + * Creates a new RelatedAccountGroup instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroup} RelatedAccountGroup instance + */ + RelatedAccountGroup.create = function create(properties) { + return new RelatedAccountGroup(properties); + }; + + /** + * Encodes the specified RelatedAccountGroup message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup} message RelatedAccountGroup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RelatedAccountGroup.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 RelatedAccountGroup message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroup.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup} message RelatedAccountGroup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RelatedAccountGroup.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RelatedAccountGroup message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroup} RelatedAccountGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RelatedAccountGroup.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup(); + 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 RelatedAccountGroup message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroup} RelatedAccountGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RelatedAccountGroup.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RelatedAccountGroup message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RelatedAccountGroup.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 RelatedAccountGroup message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.RelatedAccountGroup} RelatedAccountGroup + */ + RelatedAccountGroup.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a RelatedAccountGroup message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {google.cloud.recaptchaenterprise.v1.RelatedAccountGroup} message RelatedAccountGroup + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RelatedAccountGroup.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 RelatedAccountGroup to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @instance + * @returns {Object.} JSON object + */ + RelatedAccountGroup.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RelatedAccountGroup + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RelatedAccountGroup.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.RelatedAccountGroup"; + }; + + return RelatedAccountGroup; + })(); + + v1.WafSettings = (function() { + + /** + * Properties of a WafSettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IWafSettings + * @property {google.cloud.recaptchaenterprise.v1.WafSettings.WafService|null} [wafService] WafSettings wafService + * @property {google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|null} [wafFeature] WafSettings wafFeature + */ + + /** + * Constructs a new WafSettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a WafSettings. + * @implements IWafSettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings=} [properties] Properties to set + */ + function WafSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WafSettings wafService. + * @member {google.cloud.recaptchaenterprise.v1.WafSettings.WafService} wafService + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @instance + */ + WafSettings.prototype.wafService = 0; + + /** + * WafSettings wafFeature. + * @member {google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature} wafFeature + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @instance + */ + WafSettings.prototype.wafFeature = 0; + + /** + * Creates a new WafSettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings instance + */ + WafSettings.create = function create(properties) { + return new WafSettings(properties); + }; + + /** + * Encodes the specified WafSettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings} message WafSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WafSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.wafService != null && Object.hasOwnProperty.call(message, "wafService")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.wafService); + if (message.wafFeature != null && Object.hasOwnProperty.call(message, "wafFeature")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.wafFeature); + return writer; + }; + + /** + * Encodes the specified WafSettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings} message WafSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WafSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WafSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WafSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.WafSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.wafService = reader.int32(); + break; + } + case 2: { + message.wafFeature = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WafSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WafSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WafSettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WafSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.wafService != null && message.hasOwnProperty("wafService")) + switch (message.wafService) { + default: + return "wafService: enum value expected"; + case 0: + case 1: + break; + } + if (message.wafFeature != null && message.hasOwnProperty("wafFeature")) + switch (message.wafFeature) { + default: + return "wafFeature: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a WafSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings + */ + WafSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.WafSettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.WafSettings(); + switch (object.wafService) { + default: + if (typeof object.wafService === "number") { + message.wafService = object.wafService; + break; + } + break; + case "WAF_SERVICE_UNSPECIFIED": + case 0: + message.wafService = 0; + break; + case "CA": + case 1: + message.wafService = 1; + break; + } + switch (object.wafFeature) { + default: + if (typeof object.wafFeature === "number") { + message.wafFeature = object.wafFeature; + break; + } + break; + case "WAF_FEATURE_UNSPECIFIED": + case 0: + message.wafFeature = 0; + break; + case "CHALLENGE_PAGE": + case 1: + message.wafFeature = 1; + break; + case "SESSION_TOKEN": + case 2: + message.wafFeature = 2; + break; + case "ACTION_TOKEN": + case 3: + message.wafFeature = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a WafSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.WafSettings} message WafSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WafSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.wafService = options.enums === String ? "WAF_SERVICE_UNSPECIFIED" : 0; + object.wafFeature = options.enums === String ? "WAF_FEATURE_UNSPECIFIED" : 0; + } + if (message.wafService != null && message.hasOwnProperty("wafService")) + object.wafService = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WafSettings.WafService[message.wafService] === undefined ? message.wafService : $root.google.cloud.recaptchaenterprise.v1.WafSettings.WafService[message.wafService] : message.wafService; + if (message.wafFeature != null && message.hasOwnProperty("wafFeature")) + object.wafFeature = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature[message.wafFeature] === undefined ? message.wafFeature : $root.google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature[message.wafFeature] : message.wafFeature; + return object; + }; + + /** + * Converts this WafSettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @instance + * @returns {Object.} JSON object + */ + WafSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WafSettings + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WafSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.WafSettings"; + }; + + /** + * WafFeature enum. + * @name google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature + * @enum {number} + * @property {number} WAF_FEATURE_UNSPECIFIED=0 WAF_FEATURE_UNSPECIFIED value + * @property {number} CHALLENGE_PAGE=1 CHALLENGE_PAGE value + * @property {number} SESSION_TOKEN=2 SESSION_TOKEN value + * @property {number} ACTION_TOKEN=3 ACTION_TOKEN value + */ + WafSettings.WafFeature = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WAF_FEATURE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CHALLENGE_PAGE"] = 1; + values[valuesById[2] = "SESSION_TOKEN"] = 2; + values[valuesById[3] = "ACTION_TOKEN"] = 3; + return values; + })(); + + /** + * WafService enum. + * @name google.cloud.recaptchaenterprise.v1.WafSettings.WafService + * @enum {number} + * @property {number} WAF_SERVICE_UNSPECIFIED=0 WAF_SERVICE_UNSPECIFIED value + * @property {number} CA=1 CA value + */ + WafSettings.WafService = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WAF_SERVICE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CA"] = 1; + return values; + })(); + + return WafSettings; + })(); + + return v1; + })(); + + recaptchaenterprise.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof google.cloud.recaptchaenterprise + * @namespace + */ + var v1beta1 = {}; + + v1beta1.RecaptchaEnterpriseServiceV1Beta1 = (function() { + + /** + * Constructs a new RecaptchaEnterpriseServiceV1Beta1 service. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents a RecaptchaEnterpriseServiceV1Beta1 + * @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 RecaptchaEnterpriseServiceV1Beta1(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (RecaptchaEnterpriseServiceV1Beta1.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = RecaptchaEnterpriseServiceV1Beta1; + + /** + * Creates new RecaptchaEnterpriseServiceV1Beta1 service using the specified rpc implementation. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 + * @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 {RecaptchaEnterpriseServiceV1Beta1} RPC service. Useful where requests and/or responses are streamed. + */ + RecaptchaEnterpriseServiceV1Beta1.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1|createAssessment}. + * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 + * @typedef CreateAssessmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1beta1.Assessment} [response] Assessment + */ + + /** + * Calls CreateAssessment. + * @function createAssessment + * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 + * @instance + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest} request CreateAssessmentRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateAssessmentCallback} callback Node-style callback called with the error, if any, and Assessment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseServiceV1Beta1.prototype.createAssessment = function createAssessment(request, callback) { + return this.rpcCall(createAssessment, $root.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest, $root.google.cloud.recaptchaenterprise.v1beta1.Assessment, request, callback); + }, "name", { value: "CreateAssessment" }); + + /** + * Calls CreateAssessment. + * @function createAssessment + * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 + * @instance + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest} request CreateAssessmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1|annotateAssessment}. + * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 + * @typedef AnnotateAssessmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse} [response] AnnotateAssessmentResponse + */ + + /** + * Calls AnnotateAssessment. + * @function annotateAssessment + * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 + * @instance + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest} request AnnotateAssessmentRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.AnnotateAssessmentCallback} callback Node-style callback called with the error, if any, and AnnotateAssessmentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseServiceV1Beta1.prototype.annotateAssessment = function annotateAssessment(request, callback) { + return this.rpcCall(annotateAssessment, $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest, $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse, request, callback); + }, "name", { value: "AnnotateAssessment" }); + + /** + * Calls AnnotateAssessment. + * @function annotateAssessment + * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 + * @instance + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest} request AnnotateAssessmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return RecaptchaEnterpriseServiceV1Beta1; + })(); + + v1beta1.CreateAssessmentRequest = (function() { + + /** + * Properties of a CreateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface ICreateAssessmentRequest + * @property {string|null} [parent] CreateAssessmentRequest parent + * @property {google.cloud.recaptchaenterprise.v1beta1.IAssessment|null} [assessment] CreateAssessmentRequest assessment + */ + + /** + * Constructs a new CreateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents a CreateAssessmentRequest. + * @implements ICreateAssessmentRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest=} [properties] Properties to set + */ + function CreateAssessmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateAssessmentRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @instance + */ + CreateAssessmentRequest.prototype.parent = ""; + + /** + * CreateAssessmentRequest assessment. + * @member {google.cloud.recaptchaenterprise.v1beta1.IAssessment|null|undefined} assessment + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @instance + */ + CreateAssessmentRequest.prototype.assessment = null; + + /** + * Creates a new CreateAssessmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest} CreateAssessmentRequest instance + */ + CreateAssessmentRequest.create = function create(properties) { + return new CreateAssessmentRequest(properties); + }; + + /** + * Encodes the specified CreateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest} message CreateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAssessmentRequest.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.assessment != null && Object.hasOwnProperty.call(message, "assessment")) + $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.encode(message.assessment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest} message CreateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAssessmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest} CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAssessmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.assessment = $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest} CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAssessmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateAssessmentRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateAssessmentRequest.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.assessment != null && message.hasOwnProperty("assessment")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.verify(message.assessment); + if (error) + return "assessment." + error; + } + return null; + }; + + /** + * Creates a CreateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest} CreateAssessmentRequest + */ + CreateAssessmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.assessment != null) { + if (typeof object.assessment !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest.assessment: object expected"); + message.assessment = $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.fromObject(object.assessment); + } + return message; + }; + + /** + * Creates a plain object from a CreateAssessmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest} message CreateAssessmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateAssessmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.assessment = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.assessment != null && message.hasOwnProperty("assessment")) + object.assessment = $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.toObject(message.assessment, options); + return object; + }; + + /** + * Converts this CreateAssessmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateAssessmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateAssessmentRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateAssessmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest"; + }; + + return CreateAssessmentRequest; + })(); + + v1beta1.AnnotateAssessmentRequest = (function() { + + /** + * Properties of an AnnotateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface IAnnotateAssessmentRequest + * @property {string|null} [name] AnnotateAssessmentRequest name + * @property {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|null} [annotation] AnnotateAssessmentRequest annotation + * @property {Array.|null} [reasons] AnnotateAssessmentRequest reasons + * @property {Uint8Array|null} [hashedAccountId] AnnotateAssessmentRequest hashedAccountId + */ + + /** + * Constructs a new AnnotateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents an AnnotateAssessmentRequest. + * @implements IAnnotateAssessmentRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest=} [properties] Properties to set + */ + function AnnotateAssessmentRequest(properties) { + this.reasons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnnotateAssessmentRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.name = ""; + + /** + * AnnotateAssessmentRequest annotation. + * @member {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation} annotation + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.annotation = 0; + + /** + * AnnotateAssessmentRequest reasons. + * @member {Array.} reasons + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.reasons = $util.emptyArray; + + /** + * AnnotateAssessmentRequest hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.hashedAccountId = $util.newBuffer([]); + + /** + * Creates a new AnnotateAssessmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest} AnnotateAssessmentRequest instance + */ + AnnotateAssessmentRequest.create = function create(properties) { + return new AnnotateAssessmentRequest(properties); + }; + + /** + * Encodes the specified AnnotateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest} message AnnotateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentRequest.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.annotation != null && Object.hasOwnProperty.call(message, "annotation")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.annotation); + if (message.reasons != null && message.reasons.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.reasons.length; ++i) + writer.int32(message.reasons[i]); + writer.ldelim(); + } + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hashedAccountId); + return writer; + }; + + /** + * Encodes the specified AnnotateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest} message AnnotateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.annotation = reader.int32(); + break; + } + case 3: { + if (!(message.reasons && message.reasons.length)) + message.reasons = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.reasons.push(reader.int32()); + } else + message.reasons.push(reader.int32()); + break; + } + case 4: { + message.hashedAccountId = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotateAssessmentRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotateAssessmentRequest.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.annotation != null && message.hasOwnProperty("annotation")) + switch (message.annotation) { + default: + return "annotation: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.reasons != null && message.hasOwnProperty("reasons")) { + if (!Array.isArray(message.reasons)) + return "reasons: array expected"; + for (var i = 0; i < message.reasons.length; ++i) + switch (message.reasons[i]) { + default: + return "reasons: enum value[] expected"; + case 0: + case 1: + case 8: + case 9: + case 2: + case 7: + case 3: + case 4: + case 5: + case 6: + break; + } + } + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; + return null; + }; + + /** + * Creates an AnnotateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + */ + AnnotateAssessmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest(); + if (object.name != null) + message.name = String(object.name); + switch (object.annotation) { + default: + if (typeof object.annotation === "number") { + message.annotation = object.annotation; + break; + } + break; + case "ANNOTATION_UNSPECIFIED": + case 0: + message.annotation = 0; + break; + case "LEGITIMATE": + case 1: + message.annotation = 1; + break; + case "FRAUDULENT": + case 2: + message.annotation = 2; + break; + case "PASSWORD_CORRECT": + case 3: + message.annotation = 3; + break; + case "PASSWORD_INCORRECT": + case 4: + message.annotation = 4; + break; + } + if (object.reasons) { + if (!Array.isArray(object.reasons)) + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.reasons: array expected"); + message.reasons = []; + for (var i = 0; i < object.reasons.length; ++i) + switch (object.reasons[i]) { + default: + if (typeof object.reasons[i] === "number") { + message.reasons[i] = object.reasons[i]; + break; + } + case "REASON_UNSPECIFIED": + case 0: + message.reasons[i] = 0; + break; + case "CHARGEBACK": + case 1: + message.reasons[i] = 1; + break; + case "CHARGEBACK_FRAUD": + case 8: + message.reasons[i] = 8; + break; + case "CHARGEBACK_DISPUTE": + case 9: + message.reasons[i] = 9; + break; + case "PAYMENT_HEURISTICS": + case 2: + message.reasons[i] = 2; + break; + case "INITIATED_TWO_FACTOR": + case 7: + message.reasons[i] = 7; + break; + case "PASSED_TWO_FACTOR": + case 3: + message.reasons[i] = 3; + break; + case "FAILED_TWO_FACTOR": + case 4: + message.reasons[i] = 4; + break; + case "CORRECT_PASSWORD": + case 5: + message.reasons[i] = 5; + break; + case "INCORRECT_PASSWORD": + case 6: + message.reasons[i] = 6; + break; + } + } + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length >= 0) + message.hashedAccountId = object.hashedAccountId; + return message; + }; + + /** + * Creates a plain object from an AnnotateAssessmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest} message AnnotateAssessmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotateAssessmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.reasons = []; + if (options.defaults) { + object.name = ""; + object.annotation = options.enums === String ? "ANNOTATION_UNSPECIFIED" : 0; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.annotation != null && message.hasOwnProperty("annotation")) + object.annotation = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation[message.annotation] === undefined ? message.annotation : $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation[message.annotation] : message.annotation; + if (message.reasons && message.reasons.length) { + object.reasons = []; + for (var j = 0; j < message.reasons.length; ++j) + object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason[message.reasons[j]] === undefined ? message.reasons[j] : $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason[message.reasons[j]] : message.reasons[j]; + } + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + return object; + }; + + /** + * Converts this AnnotateAssessmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @instance + * @returns {Object.} JSON object + */ + AnnotateAssessmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnnotateAssessmentRequest + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnnotateAssessmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest"; + }; + + /** + * Annotation enum. + * @name google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation + * @enum {number} + * @property {number} ANNOTATION_UNSPECIFIED=0 ANNOTATION_UNSPECIFIED value + * @property {number} LEGITIMATE=1 LEGITIMATE value + * @property {number} FRAUDULENT=2 FRAUDULENT value + * @property {number} PASSWORD_CORRECT=3 PASSWORD_CORRECT value + * @property {number} PASSWORD_INCORRECT=4 PASSWORD_INCORRECT value + */ + AnnotateAssessmentRequest.Annotation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ANNOTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "LEGITIMATE"] = 1; + values[valuesById[2] = "FRAUDULENT"] = 2; + values[valuesById[3] = "PASSWORD_CORRECT"] = 3; + values[valuesById[4] = "PASSWORD_INCORRECT"] = 4; + return values; + })(); + + /** + * Reason enum. + * @name google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason + * @enum {number} + * @property {number} REASON_UNSPECIFIED=0 REASON_UNSPECIFIED value + * @property {number} CHARGEBACK=1 CHARGEBACK value + * @property {number} CHARGEBACK_FRAUD=8 CHARGEBACK_FRAUD value + * @property {number} CHARGEBACK_DISPUTE=9 CHARGEBACK_DISPUTE value + * @property {number} PAYMENT_HEURISTICS=2 PAYMENT_HEURISTICS value + * @property {number} INITIATED_TWO_FACTOR=7 INITIATED_TWO_FACTOR value + * @property {number} PASSED_TWO_FACTOR=3 PASSED_TWO_FACTOR value + * @property {number} FAILED_TWO_FACTOR=4 FAILED_TWO_FACTOR value + * @property {number} CORRECT_PASSWORD=5 CORRECT_PASSWORD value + * @property {number} INCORRECT_PASSWORD=6 INCORRECT_PASSWORD value + */ + AnnotateAssessmentRequest.Reason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "CHARGEBACK"] = 1; + values[valuesById[8] = "CHARGEBACK_FRAUD"] = 8; + values[valuesById[9] = "CHARGEBACK_DISPUTE"] = 9; + values[valuesById[2] = "PAYMENT_HEURISTICS"] = 2; + values[valuesById[7] = "INITIATED_TWO_FACTOR"] = 7; + values[valuesById[3] = "PASSED_TWO_FACTOR"] = 3; + values[valuesById[4] = "FAILED_TWO_FACTOR"] = 4; + values[valuesById[5] = "CORRECT_PASSWORD"] = 5; + values[valuesById[6] = "INCORRECT_PASSWORD"] = 6; + return values; + })(); + + return AnnotateAssessmentRequest; + })(); + + v1beta1.AnnotateAssessmentResponse = (function() { + + /** + * Properties of an AnnotateAssessmentResponse. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface IAnnotateAssessmentResponse + */ + + /** + * Constructs a new AnnotateAssessmentResponse. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents an AnnotateAssessmentResponse. + * @implements IAnnotateAssessmentResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse=} [properties] Properties to set + */ + function AnnotateAssessmentResponse(properties) { + if (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 AnnotateAssessmentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse} AnnotateAssessmentResponse instance + */ + AnnotateAssessmentResponse.create = function create(properties) { + return new AnnotateAssessmentResponse(properties); + }; + + /** + * Encodes the specified AnnotateAssessmentResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse} message AnnotateAssessmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AnnotateAssessmentResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse} message AnnotateAssessmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotateAssessmentResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotateAssessmentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AnnotateAssessmentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + */ + AnnotateAssessmentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse) + return object; + return new $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse(); + }; + + /** + * Creates a plain object from an AnnotateAssessmentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse} message AnnotateAssessmentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotateAssessmentResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AnnotateAssessmentResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @instance + * @returns {Object.} JSON object + */ + AnnotateAssessmentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnnotateAssessmentResponse + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnnotateAssessmentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse"; + }; + + return AnnotateAssessmentResponse; + })(); + + v1beta1.PasswordLeakVerification = (function() { + + /** + * Properties of a PasswordLeakVerification. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface IPasswordLeakVerification + * @property {Uint8Array|null} [hashedUserCredentials] PasswordLeakVerification hashedUserCredentials + * @property {boolean|null} [credentialsLeaked] PasswordLeakVerification credentialsLeaked + * @property {string|null} [canonicalizedUsername] PasswordLeakVerification canonicalizedUsername + */ + + /** + * Constructs a new PasswordLeakVerification. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents a PasswordLeakVerification. + * @implements IPasswordLeakVerification + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification=} [properties] Properties to set + */ + function PasswordLeakVerification(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PasswordLeakVerification hashedUserCredentials. + * @member {Uint8Array} hashedUserCredentials + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + */ + PasswordLeakVerification.prototype.hashedUserCredentials = $util.newBuffer([]); + + /** + * PasswordLeakVerification credentialsLeaked. + * @member {boolean} credentialsLeaked + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + */ + PasswordLeakVerification.prototype.credentialsLeaked = false; + + /** + * PasswordLeakVerification canonicalizedUsername. + * @member {string} canonicalizedUsername + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + */ + PasswordLeakVerification.prototype.canonicalizedUsername = ""; + + /** + * Creates a new PasswordLeakVerification instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification instance + */ + PasswordLeakVerification.create = function create(properties) { + return new PasswordLeakVerification(properties); + }; + + /** + * Encodes the specified PasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification} message PasswordLeakVerification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordLeakVerification.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hashedUserCredentials != null && Object.hasOwnProperty.call(message, "hashedUserCredentials")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hashedUserCredentials); + if (message.credentialsLeaked != null && Object.hasOwnProperty.call(message, "credentialsLeaked")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.credentialsLeaked); + if (message.canonicalizedUsername != null && Object.hasOwnProperty.call(message, "canonicalizedUsername")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.canonicalizedUsername); + return writer; + }; + + /** + * Encodes the specified PasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification} message PasswordLeakVerification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordLeakVerification.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordLeakVerification.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.hashedUserCredentials = reader.bytes(); + break; + } + case 2: { + message.credentialsLeaked = reader.bool(); + break; + } + case 3: { + message.canonicalizedUsername = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordLeakVerification.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PasswordLeakVerification message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PasswordLeakVerification.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hashedUserCredentials != null && message.hasOwnProperty("hashedUserCredentials")) + if (!(message.hashedUserCredentials && typeof message.hashedUserCredentials.length === "number" || $util.isString(message.hashedUserCredentials))) + return "hashedUserCredentials: buffer expected"; + if (message.credentialsLeaked != null && message.hasOwnProperty("credentialsLeaked")) + if (typeof message.credentialsLeaked !== "boolean") + return "credentialsLeaked: boolean expected"; + if (message.canonicalizedUsername != null && message.hasOwnProperty("canonicalizedUsername")) + if (!$util.isString(message.canonicalizedUsername)) + return "canonicalizedUsername: string expected"; + return null; + }; + + /** + * Creates a PasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification + */ + PasswordLeakVerification.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification(); + if (object.hashedUserCredentials != null) + if (typeof object.hashedUserCredentials === "string") + $util.base64.decode(object.hashedUserCredentials, message.hashedUserCredentials = $util.newBuffer($util.base64.length(object.hashedUserCredentials)), 0); + else if (object.hashedUserCredentials.length >= 0) + message.hashedUserCredentials = object.hashedUserCredentials; + if (object.credentialsLeaked != null) + message.credentialsLeaked = Boolean(object.credentialsLeaked); + if (object.canonicalizedUsername != null) + message.canonicalizedUsername = String(object.canonicalizedUsername); + return message; + }; + + /** + * Creates a plain object from a PasswordLeakVerification message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} message PasswordLeakVerification + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PasswordLeakVerification.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.hashedUserCredentials = ""; + else { + object.hashedUserCredentials = []; + if (options.bytes !== Array) + object.hashedUserCredentials = $util.newBuffer(object.hashedUserCredentials); + } + object.credentialsLeaked = false; + object.canonicalizedUsername = ""; + } + if (message.hashedUserCredentials != null && message.hasOwnProperty("hashedUserCredentials")) + object.hashedUserCredentials = options.bytes === String ? $util.base64.encode(message.hashedUserCredentials, 0, message.hashedUserCredentials.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedUserCredentials) : message.hashedUserCredentials; + if (message.credentialsLeaked != null && message.hasOwnProperty("credentialsLeaked")) + object.credentialsLeaked = message.credentialsLeaked; + if (message.canonicalizedUsername != null && message.hasOwnProperty("canonicalizedUsername")) + object.canonicalizedUsername = message.canonicalizedUsername; + return object; + }; + + /** + * Converts this PasswordLeakVerification to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + * @returns {Object.} JSON object + */ + PasswordLeakVerification.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PasswordLeakVerification + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PasswordLeakVerification.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification"; + }; + + return PasswordLeakVerification; + })(); + + v1beta1.Assessment = (function() { + + /** + * Properties of an Assessment. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface IAssessment + * @property {string|null} [name] Assessment name + * @property {google.cloud.recaptchaenterprise.v1beta1.IEvent|null} [event] Assessment event + * @property {number|null} [score] Assessment score + * @property {google.cloud.recaptchaenterprise.v1beta1.ITokenProperties|null} [tokenProperties] Assessment tokenProperties + * @property {Array.|null} [reasons] Assessment reasons + * @property {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null} [passwordLeakVerification] Assessment passwordLeakVerification + * @property {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null} [accountDefenderAssessment] Assessment accountDefenderAssessment + */ + + /** + * Constructs a new Assessment. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents an Assessment. + * @implements IAssessment + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.IAssessment=} [properties] Properties to set + */ + function Assessment(properties) { + this.reasons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Assessment name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.name = ""; + + /** + * Assessment event. + * @member {google.cloud.recaptchaenterprise.v1beta1.IEvent|null|undefined} event + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.event = null; + + /** + * Assessment score. + * @member {number} score + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.score = 0; + + /** + * Assessment tokenProperties. + * @member {google.cloud.recaptchaenterprise.v1beta1.ITokenProperties|null|undefined} tokenProperties + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.tokenProperties = null; + + /** + * Assessment reasons. + * @member {Array.} reasons + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.reasons = $util.emptyArray; + + /** + * Assessment passwordLeakVerification. + * @member {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null|undefined} passwordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.passwordLeakVerification = null; + + /** + * Assessment accountDefenderAssessment. + * @member {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null|undefined} accountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.accountDefenderAssessment = null; + + /** + * Creates a new Assessment instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.Assessment} Assessment instance + */ + Assessment.create = function create(properties) { + return new Assessment(properties); + }; + + /** + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAssessment} message Assessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Assessment.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.event != null && Object.hasOwnProperty.call(message, "event")) + $root.google.cloud.recaptchaenterprise.v1beta1.Event.encode(message.event, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.score != null && Object.hasOwnProperty.call(message, "score")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.score); + if (message.tokenProperties != null && Object.hasOwnProperty.call(message, "tokenProperties")) + $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties.encode(message.tokenProperties, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reasons != null && message.reasons.length) { + writer.uint32(/* id 5, wireType 2 =*/42).fork(); + for (var i = 0; i < message.reasons.length; ++i) + writer.int32(message.reasons[i]); + writer.ldelim(); + } + if (message.passwordLeakVerification != null && Object.hasOwnProperty.call(message, "passwordLeakVerification")) + $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.encode(message.passwordLeakVerification, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.accountDefenderAssessment != null && Object.hasOwnProperty.call(message, "accountDefenderAssessment")) + $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.encode(message.accountDefenderAssessment, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAssessment} message Assessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Assessment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Assessment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.Assessment} Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Assessment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.Assessment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.event = $root.google.cloud.recaptchaenterprise.v1beta1.Event.decode(reader, reader.uint32()); + break; + } + case 3: { + message.score = reader.float(); + break; + } + case 4: { + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.reasons && message.reasons.length)) + message.reasons = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.reasons.push(reader.int32()); + } else + message.reasons.push(reader.int32()); + break; + } + case 7: { + message.passwordLeakVerification = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.decode(reader, reader.uint32()); + break; + } + case 8: { + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Assessment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.Assessment} Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Assessment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Assessment message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Assessment.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.event != null && message.hasOwnProperty("event")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.Event.verify(message.event); + if (error) + return "event." + error; + } + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify(message.tokenProperties); + if (error) + return "tokenProperties." + error; + } + if (message.reasons != null && message.hasOwnProperty("reasons")) { + if (!Array.isArray(message.reasons)) + return "reasons: array expected"; + for (var i = 0; i < message.reasons.length; ++i) + switch (message.reasons[i]) { + default: + return "reasons: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + } + if (message.passwordLeakVerification != null && message.hasOwnProperty("passwordLeakVerification")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify(message.passwordLeakVerification); + if (error) + return "passwordLeakVerification." + error; + } + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify(message.accountDefenderAssessment); + if (error) + return "accountDefenderAssessment." + error; + } + return null; + }; + + /** + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.Assessment} Assessment + */ + Assessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.Assessment) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.Assessment(); + if (object.name != null) + message.name = String(object.name); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Assessment.event: object expected"); + message.event = $root.google.cloud.recaptchaenterprise.v1beta1.Event.fromObject(object.event); + } + if (object.score != null) + message.score = Number(object.score); + if (object.tokenProperties != null) { + if (typeof object.tokenProperties !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Assessment.tokenProperties: object expected"); + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties.fromObject(object.tokenProperties); + } + if (object.reasons) { + if (!Array.isArray(object.reasons)) + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Assessment.reasons: array expected"); + message.reasons = []; + for (var i = 0; i < object.reasons.length; ++i) + switch (object.reasons[i]) { + default: + if (typeof object.reasons[i] === "number") { + message.reasons[i] = object.reasons[i]; + break; + } + case "CLASSIFICATION_REASON_UNSPECIFIED": + case 0: + message.reasons[i] = 0; + break; + case "AUTOMATION": + case 1: + message.reasons[i] = 1; + break; + case "UNEXPECTED_ENVIRONMENT": + case 2: + message.reasons[i] = 2; + break; + case "TOO_MUCH_TRAFFIC": + case 3: + message.reasons[i] = 3; + break; + case "UNEXPECTED_USAGE_PATTERNS": + case 4: + message.reasons[i] = 4; + break; + case "LOW_CONFIDENCE_SCORE": + case 5: + message.reasons[i] = 5; + break; + } + } + if (object.passwordLeakVerification != null) { + if (typeof object.passwordLeakVerification !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Assessment.passwordLeakVerification: object expected"); + message.passwordLeakVerification = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.fromObject(object.passwordLeakVerification); + } + if (object.accountDefenderAssessment != null) { + if (typeof object.accountDefenderAssessment !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Assessment.accountDefenderAssessment: object expected"); + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.fromObject(object.accountDefenderAssessment); + } + return message; + }; + + /** + * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.Assessment} message Assessment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Assessment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.reasons = []; + if (options.defaults) { + object.name = ""; + object.event = null; + object.score = 0; + object.tokenProperties = null; + object.passwordLeakVerification = null; + object.accountDefenderAssessment = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.google.cloud.recaptchaenterprise.v1beta1.Event.toObject(message.event, options); + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) + object.tokenProperties = $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties.toObject(message.tokenProperties, options); + if (message.reasons && message.reasons.length) { + object.reasons = []; + for (var j = 0; j < message.reasons.length; ++j) + object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[message.reasons[j]] === undefined ? message.reasons[j] : $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[message.reasons[j]] : message.reasons[j]; + } + if (message.passwordLeakVerification != null && message.hasOwnProperty("passwordLeakVerification")) + object.passwordLeakVerification = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.toObject(message.passwordLeakVerification, options); + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) + object.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.toObject(message.accountDefenderAssessment, options); + return object; + }; + + /** + * Converts this Assessment to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + * @returns {Object.} JSON object + */ + Assessment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Assessment + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Assessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.Assessment"; + }; + + /** + * ClassificationReason enum. + * @name google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason + * @enum {number} + * @property {number} CLASSIFICATION_REASON_UNSPECIFIED=0 CLASSIFICATION_REASON_UNSPECIFIED value + * @property {number} AUTOMATION=1 AUTOMATION value + * @property {number} UNEXPECTED_ENVIRONMENT=2 UNEXPECTED_ENVIRONMENT value + * @property {number} TOO_MUCH_TRAFFIC=3 TOO_MUCH_TRAFFIC value + * @property {number} UNEXPECTED_USAGE_PATTERNS=4 UNEXPECTED_USAGE_PATTERNS value + * @property {number} LOW_CONFIDENCE_SCORE=5 LOW_CONFIDENCE_SCORE value + */ + Assessment.ClassificationReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLASSIFICATION_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATION"] = 1; + values[valuesById[2] = "UNEXPECTED_ENVIRONMENT"] = 2; + values[valuesById[3] = "TOO_MUCH_TRAFFIC"] = 3; + values[valuesById[4] = "UNEXPECTED_USAGE_PATTERNS"] = 4; + values[valuesById[5] = "LOW_CONFIDENCE_SCORE"] = 5; + return values; + })(); + + return Assessment; + })(); + + v1beta1.Event = (function() { + + /** + * Properties of an Event. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface IEvent + * @property {string|null} [token] Event token + * @property {string|null} [siteKey] Event siteKey + * @property {string|null} [userAgent] Event userAgent + * @property {string|null} [userIpAddress] Event userIpAddress + * @property {string|null} [expectedAction] Event expectedAction + * @property {Uint8Array|null} [hashedAccountId] Event hashedAccountId + */ + + /** + * Constructs a new Event. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents an Event. + * @implements IEvent + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.IEvent=} [properties] Properties to set + */ + function Event(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Event token. + * @member {string} token + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.token = ""; + + /** + * Event siteKey. + * @member {string} siteKey + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.siteKey = ""; + + /** + * Event userAgent. + * @member {string} userAgent + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.userAgent = ""; + + /** + * Event userIpAddress. + * @member {string} userIpAddress + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.userIpAddress = ""; + + /** + * Event expectedAction. + * @member {string} expectedAction + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.expectedAction = ""; + + /** + * Event hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.hashedAccountId = $util.newBuffer([]); + + /** + * Creates a new Event instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IEvent=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.Event} Event instance + */ + Event.create = function create(properties) { + return new Event(properties); + }; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.token != null && Object.hasOwnProperty.call(message, "token")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.token); + if (message.siteKey != null && Object.hasOwnProperty.call(message, "siteKey")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.siteKey); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.userIpAddress != null && Object.hasOwnProperty.call(message, "userIpAddress")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.userIpAddress); + if (message.expectedAction != null && Object.hasOwnProperty.call(message, "expectedAction")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.expectedAction); + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.hashedAccountId); + return writer; + }; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Event message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.Event(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.token = reader.string(); + break; + } + case 2: { + message.siteKey = reader.string(); + break; + } + case 3: { + message.userAgent = reader.string(); + break; + } + case 4: { + message.userIpAddress = reader.string(); + break; + } + case 5: { + message.expectedAction = reader.string(); + break; + } + case 6: { + message.hashedAccountId = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Event message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Event.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.token != null && message.hasOwnProperty("token")) + if (!$util.isString(message.token)) + return "token: string expected"; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + if (!$util.isString(message.siteKey)) + return "siteKey: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + if (!$util.isString(message.userIpAddress)) + return "userIpAddress: string expected"; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + if (!$util.isString(message.expectedAction)) + return "expectedAction: string expected"; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; + return null; + }; + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.Event} Event + */ + Event.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.Event) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.Event(); + if (object.token != null) + message.token = String(object.token); + if (object.siteKey != null) + message.siteKey = String(object.siteKey); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.userIpAddress != null) + message.userIpAddress = String(object.userIpAddress); + if (object.expectedAction != null) + message.expectedAction = String(object.expectedAction); + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length >= 0) + message.hashedAccountId = object.hashedAccountId; + return message; + }; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.Event} message Event + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Event.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.token = ""; + object.siteKey = ""; + object.userAgent = ""; + object.userIpAddress = ""; + object.expectedAction = ""; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } + } + if (message.token != null && message.hasOwnProperty("token")) + object.token = message.token; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + object.siteKey = message.siteKey; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + object.userIpAddress = message.userIpAddress; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + object.expectedAction = message.expectedAction; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; + return object; + }; + + /** + * Converts this Event to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + * @returns {Object.} JSON object + */ + Event.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Event + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Event.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.Event"; + }; + + return Event; + })(); + + v1beta1.TokenProperties = (function() { + + /** + * Properties of a TokenProperties. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface ITokenProperties + * @property {boolean|null} [valid] TokenProperties valid + * @property {google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason|null} [invalidReason] TokenProperties invalidReason + * @property {google.protobuf.ITimestamp|null} [createTime] TokenProperties createTime + * @property {string|null} [hostname] TokenProperties hostname + * @property {string|null} [action] TokenProperties action + */ + + /** + * Constructs a new TokenProperties. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents a TokenProperties. + * @implements ITokenProperties + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.ITokenProperties=} [properties] Properties to set + */ + function TokenProperties(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TokenProperties valid. + * @member {boolean} valid + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @instance + */ + TokenProperties.prototype.valid = false; + + /** + * TokenProperties invalidReason. + * @member {google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason} invalidReason + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @instance + */ + TokenProperties.prototype.invalidReason = 0; + + /** + * TokenProperties createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @instance + */ + TokenProperties.prototype.createTime = null; + + /** + * TokenProperties hostname. + * @member {string} hostname + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @instance + */ + TokenProperties.prototype.hostname = ""; + + /** + * TokenProperties action. + * @member {string} action + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @instance + */ + TokenProperties.prototype.action = ""; + + /** + * Creates a new TokenProperties instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ITokenProperties=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.TokenProperties} TokenProperties instance + */ + TokenProperties.create = function create(properties) { + return new TokenProperties(properties); + }; + + /** + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TokenProperties.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.valid != null && Object.hasOwnProperty.call(message, "valid")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.valid); + if (message.invalidReason != null && Object.hasOwnProperty.call(message, "invalidReason")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.invalidReason); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.hostname != null && Object.hasOwnProperty.call(message, "hostname")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.hostname); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.action); + return writer; + }; + + /** + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TokenProperties.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TokenProperties message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.TokenProperties} TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TokenProperties.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.valid = reader.bool(); + break; + } + case 2: { + message.invalidReason = reader.int32(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.hostname = reader.string(); + break; + } + case 5: { + message.action = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.TokenProperties} TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TokenProperties.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TokenProperties message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TokenProperties.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.valid != null && message.hasOwnProperty("valid")) + if (typeof message.valid !== "boolean") + return "valid: boolean expected"; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + switch (message.invalidReason) { + default: + return "invalidReason: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.hostname != null && message.hasOwnProperty("hostname")) + if (!$util.isString(message.hostname)) + return "hostname: string expected"; + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; + return null; + }; + + /** + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.TokenProperties} TokenProperties + */ + TokenProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties(); + if (object.valid != null) + message.valid = Boolean(object.valid); + switch (object.invalidReason) { + default: + if (typeof object.invalidReason === "number") { + message.invalidReason = object.invalidReason; + break; + } + break; + case "INVALID_REASON_UNSPECIFIED": + case 0: + message.invalidReason = 0; + break; + case "UNKNOWN_INVALID_REASON": + case 1: + message.invalidReason = 1; + break; + case "MALFORMED": + case 2: + message.invalidReason = 2; + break; + case "EXPIRED": + case 3: + message.invalidReason = 3; + break; + case "DUPE": + case 4: + message.invalidReason = 4; + break; + case "SITE_MISMATCH": + case 5: + message.invalidReason = 5; + break; + case "MISSING": + case 6: + message.invalidReason = 6; + break; + case "BROWSER_ERROR": + case 7: + message.invalidReason = 7; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.TokenProperties.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.hostname != null) + message.hostname = String(object.hostname); + if (object.action != null) + message.action = String(object.action); + return message; + }; + + /** + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.TokenProperties} message TokenProperties + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TokenProperties.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.valid = false; + object.invalidReason = options.enums === String ? "INVALID_REASON_UNSPECIFIED" : 0; + object.createTime = null; + object.hostname = ""; + object.action = ""; + } + if (message.valid != null && message.hasOwnProperty("valid")) + object.valid = message.valid; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + object.invalidReason = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason[message.invalidReason] === undefined ? message.invalidReason : $root.google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason[message.invalidReason] : message.invalidReason; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.hostname != null && message.hasOwnProperty("hostname")) + object.hostname = message.hostname; + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; + return object; + }; + + /** + * Converts this TokenProperties to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @instance + * @returns {Object.} JSON object + */ + TokenProperties.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TokenProperties + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.TokenProperties + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TokenProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.TokenProperties"; + }; + + /** + * InvalidReason enum. + * @name google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason + * @enum {number} + * @property {number} INVALID_REASON_UNSPECIFIED=0 INVALID_REASON_UNSPECIFIED value + * @property {number} UNKNOWN_INVALID_REASON=1 UNKNOWN_INVALID_REASON value + * @property {number} MALFORMED=2 MALFORMED value + * @property {number} EXPIRED=3 EXPIRED value + * @property {number} DUPE=4 DUPE value + * @property {number} SITE_MISMATCH=5 SITE_MISMATCH value + * @property {number} MISSING=6 MISSING value + * @property {number} BROWSER_ERROR=7 BROWSER_ERROR value + */ + TokenProperties.InvalidReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INVALID_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "UNKNOWN_INVALID_REASON"] = 1; + values[valuesById[2] = "MALFORMED"] = 2; + values[valuesById[3] = "EXPIRED"] = 3; + values[valuesById[4] = "DUPE"] = 4; + values[valuesById[5] = "SITE_MISMATCH"] = 5; + values[valuesById[6] = "MISSING"] = 6; + values[valuesById[7] = "BROWSER_ERROR"] = 7; + return values; + })(); + + return TokenProperties; + })(); + + v1beta1.AccountDefenderAssessment = (function() { + + /** + * Properties of an AccountDefenderAssessment. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface IAccountDefenderAssessment + * @property {Array.|null} [labels] AccountDefenderAssessment labels + */ + + /** + * Constructs a new AccountDefenderAssessment. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents an AccountDefenderAssessment. + * @implements IAccountDefenderAssessment + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment=} [properties] Properties to set + */ + function AccountDefenderAssessment(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]]; + } + + /** + * AccountDefenderAssessment labels. + * @member {Array.} labels + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @instance + */ + AccountDefenderAssessment.prototype.labels = $util.emptyArray; + + /** + * Creates a new AccountDefenderAssessment instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment instance + */ + AccountDefenderAssessment.create = function create(properties) { + return new AccountDefenderAssessment(properties); + }; + + /** + * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccountDefenderAssessment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labels != null && message.labels.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.labels.length; ++i) + writer.int32(message.labels[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccountDefenderAssessment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccountDefenderAssessment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.labels && message.labels.length)) + message.labels = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.labels.push(reader.int32()); + } else + message.labels.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccountDefenderAssessment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AccountDefenderAssessment message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AccountDefenderAssessment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) + switch (message.labels[i]) { + default: + return "labels: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + return null; + }; + + /** + * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment + */ + AccountDefenderAssessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment(); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) + switch (object.labels[i]) { + default: + if (typeof object.labels[i] === "number") { + message.labels[i] = object.labels[i]; + break; + } + case "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": + case 0: + message.labels[i] = 0; + break; + case "PROFILE_MATCH": + case 1: + message.labels[i] = 1; + break; + case "SUSPICIOUS_LOGIN_ACTIVITY": + case 2: + message.labels[i] = 2; + break; + case "SUSPICIOUS_ACCOUNT_CREATION": + case 3: + message.labels[i] = 3; + break; + case "RELATED_ACCOUNTS_NUMBER_HIGH": + case 4: + message.labels[i] = 4; + break; + } + } + return message; + }; + + /** + * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} message AccountDefenderAssessment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AccountDefenderAssessment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.labels = []; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel[message.labels[j]] === undefined ? message.labels[j] : $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel[message.labels[j]] : message.labels[j]; + } + return object; + }; + + /** + * Converts this AccountDefenderAssessment to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @instance + * @returns {Object.} JSON object + */ + AccountDefenderAssessment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AccountDefenderAssessment + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AccountDefenderAssessment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment"; + }; + + /** + * AccountDefenderLabel enum. + * @name google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel + * @enum {number} + * @property {number} ACCOUNT_DEFENDER_LABEL_UNSPECIFIED=0 ACCOUNT_DEFENDER_LABEL_UNSPECIFIED value + * @property {number} PROFILE_MATCH=1 PROFILE_MATCH value + * @property {number} SUSPICIOUS_LOGIN_ACTIVITY=2 SUSPICIOUS_LOGIN_ACTIVITY value + * @property {number} SUSPICIOUS_ACCOUNT_CREATION=3 SUSPICIOUS_ACCOUNT_CREATION value + * @property {number} RELATED_ACCOUNTS_NUMBER_HIGH=4 RELATED_ACCOUNTS_NUMBER_HIGH value + */ + AccountDefenderAssessment.AccountDefenderLabel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROFILE_MATCH"] = 1; + values[valuesById[2] = "SUSPICIOUS_LOGIN_ACTIVITY"] = 2; + values[valuesById[3] = "SUSPICIOUS_ACCOUNT_CREATION"] = 3; + values[valuesById[4] = "RELATED_ACCOUNTS_NUMBER_HIGH"] = 4; + return values; + })(); + + return AccountDefenderAssessment; + })(); + + return v1beta1; + })(); + + return recaptchaenterprise; + })(); + + 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 + */ + + /** + * 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; + + /** + * 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.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; + } + 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"; + } + 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]); + } + 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.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.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.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.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + + return FieldMask; + })(); + + protobuf.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; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.json b/packages/google-cloud-recaptchaenterprise/protos/protos.json new file mode 100644 index 00000000000..305751757a8 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.json @@ -0,0 +1,2625 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "recaptchaenterprise": { + "nested": { + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.RecaptchaEnterprise.V1", + "go_package": "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1;recaptchaenterprise", + "java_multiple_files": true, + "java_outer_classname": "RecaptchaEnterpriseProto", + "java_package": "com.google.recaptchaenterprise.v1", + "objc_class_prefix": "GCRE", + "php_namespace": "Google\\Cloud\\RecaptchaEnterprise\\V1", + "ruby_package": "Google::Cloud::RecaptchaEnterprise::V1" + }, + "nested": { + "RecaptchaEnterpriseService": { + "options": { + "(google.api.default_host)": "recaptchaenterprise.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateAssessment": { + "requestType": "CreateAssessmentRequest", + "responseType": "Assessment", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/assessments", + "(google.api.http).body": "assessment", + "(google.api.method_signature)": "parent,assessment" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/assessments", + "body": "assessment" + } + }, + { + "(google.api.method_signature)": "parent,assessment" + } + ] + }, + "AnnotateAssessment": { + "requestType": "AnnotateAssessmentRequest", + "responseType": "AnnotateAssessmentResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/assessments/*}:annotate", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,annotation" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/assessments/*}:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,annotation" + } + ] + }, + "CreateKey": { + "requestType": "CreateKeyRequest", + "responseType": "Key", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/keys", + "(google.api.http).body": "key" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/keys", + "body": "key" + } + } + ] + }, + "ListKeys": { + "requestType": "ListKeysRequest", + "responseType": "ListKeysResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*}/keys" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*}/keys" + } + } + ] + }, + "RetrieveLegacySecretKey": { + "requestType": "RetrieveLegacySecretKeyRequest", + "responseType": "RetrieveLegacySecretKeyResponse", + "options": { + "(google.api.http).get": "/v1/{key=projects/*/keys/*}:retrieveLegacySecretKey", + "(google.api.method_signature)": "key" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{key=projects/*/keys/*}:retrieveLegacySecretKey" + } + }, + { + "(google.api.method_signature)": "key" + } + ] + }, + "GetKey": { + "requestType": "GetKeyRequest", + "responseType": "Key", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/keys/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/keys/*}" + } + } + ] + }, + "UpdateKey": { + "requestType": "UpdateKeyRequest", + "responseType": "Key", + "options": { + "(google.api.http).patch": "/v1/{key.name=projects/*/keys/*}", + "(google.api.http).body": "key" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{key.name=projects/*/keys/*}", + "body": "key" + } + } + ] + }, + "DeleteKey": { + "requestType": "DeleteKeyRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/keys/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/keys/*}" + } + } + ] + }, + "MigrateKey": { + "requestType": "MigrateKeyRequest", + "responseType": "Key", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/keys/*}:migrate", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/keys/*}:migrate", + "body": "*" + } + } + ] + }, + "GetMetrics": { + "requestType": "GetMetricsRequest", + "responseType": "Metrics", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/keys/*/metrics}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/keys/*/metrics}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListRelatedAccountGroups": { + "requestType": "ListRelatedAccountGroupsRequest", + "responseType": "ListRelatedAccountGroupsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*}/relatedaccountgroups", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*}/relatedaccountgroups" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListRelatedAccountGroupMemberships": { + "requestType": "ListRelatedAccountGroupMembershipsRequest", + "responseType": "ListRelatedAccountGroupMembershipsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/relatedaccountgroups/*}/memberships", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/relatedaccountgroups/*}/memberships" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SearchRelatedAccountGroupMemberships": { + "requestType": "SearchRelatedAccountGroupMembershipsRequest", + "responseType": "SearchRelatedAccountGroupMembershipsResponse", + "options": { + "(google.api.http).post": "/v1/{project=projects/*}/relatedaccountgroupmemberships:search", + "(google.api.http).body": "*", + "(google.api.method_signature)": "project,hashed_account_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{project=projects/*}/relatedaccountgroupmemberships:search", + "body": "*" + } + }, + { + "(google.api.method_signature)": "project,hashed_account_id" + } + ] + } + } + }, + "CreateAssessmentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "assessment": { + "type": "Assessment", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AnnotateAssessmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Assessment" + } + }, + "annotation": { + "type": "Annotation", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "reasons": { + "rule": "repeated", + "type": "Reason", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hashedAccountId": { + "type": "bytes", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Annotation": { + "valuesOptions": { + "PASSWORD_CORRECT": { + "deprecated": true + }, + "PASSWORD_INCORRECT": { + "deprecated": true + } + }, + "values": { + "ANNOTATION_UNSPECIFIED": 0, + "LEGITIMATE": 1, + "FRAUDULENT": 2, + "PASSWORD_CORRECT": 3, + "PASSWORD_INCORRECT": 4 + } + }, + "Reason": { + "values": { + "REASON_UNSPECIFIED": 0, + "CHARGEBACK": 1, + "CHARGEBACK_FRAUD": 8, + "CHARGEBACK_DISPUTE": 9, + "REFUND": 10, + "REFUND_FRAUD": 11, + "TRANSACTION_ACCEPTED": 12, + "TRANSACTION_DECLINED": 13, + "PAYMENT_HEURISTICS": 2, + "INITIATED_TWO_FACTOR": 7, + "PASSED_TWO_FACTOR": 3, + "FAILED_TWO_FACTOR": 4, + "CORRECT_PASSWORD": 5, + "INCORRECT_PASSWORD": 6, + "SOCIAL_SPAM": 14 + } + } + } + }, + "AnnotateAssessmentResponse": { + "fields": {} + }, + "PrivatePasswordLeakVerification": { + "fields": { + "lookupHashPrefix": { + "type": "bytes", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "encryptedUserCredentialsHash": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "encryptedLeakMatchPrefixes": { + "rule": "repeated", + "type": "bytes", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "reencryptedUserCredentialsHash": { + "type": "bytes", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "Assessment": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Assessment", + "(google.api.resource).pattern": "projects/{project}/assessments/{assessment}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "event": { + "type": "Event", + "id": 2 + }, + "riskAnalysis": { + "type": "RiskAnalysis", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "tokenProperties": { + "type": "TokenProperties", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "accountDefenderAssessment": { + "type": "AccountDefenderAssessment", + "id": 6 + }, + "privatePasswordLeakVerification": { + "type": "PrivatePasswordLeakVerification", + "id": 8 + } + } + }, + "Event": { + "fields": { + "token": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "siteKey": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userAgent": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userIpAddress": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "expectedAction": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hashedAccountId": { + "type": "bytes", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "RiskAnalysis": { + "fields": { + "score": { + "type": "float", + "id": 1 + }, + "reasons": { + "rule": "repeated", + "type": "ClassificationReason", + "id": 2 + } + }, + "nested": { + "ClassificationReason": { + "values": { + "CLASSIFICATION_REASON_UNSPECIFIED": 0, + "AUTOMATION": 1, + "UNEXPECTED_ENVIRONMENT": 2, + "TOO_MUCH_TRAFFIC": 3, + "UNEXPECTED_USAGE_PATTERNS": 4, + "LOW_CONFIDENCE_SCORE": 5 + } + } + } + }, + "TokenProperties": { + "fields": { + "valid": { + "type": "bool", + "id": 1 + }, + "invalidReason": { + "type": "InvalidReason", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "hostname": { + "type": "string", + "id": 4 + }, + "action": { + "type": "string", + "id": 5 + } + }, + "nested": { + "InvalidReason": { + "values": { + "INVALID_REASON_UNSPECIFIED": 0, + "UNKNOWN_INVALID_REASON": 1, + "MALFORMED": 2, + "EXPIRED": 3, + "DUPE": 4, + "MISSING": 5, + "BROWSER_ERROR": 6 + } + } + } + }, + "AccountDefenderAssessment": { + "fields": { + "labels": { + "rule": "repeated", + "type": "AccountDefenderLabel", + "id": 1 + } + }, + "nested": { + "AccountDefenderLabel": { + "values": { + "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": 0, + "PROFILE_MATCH": 1, + "SUSPICIOUS_LOGIN_ACTIVITY": 2, + "SUSPICIOUS_ACCOUNT_CREATION": 3, + "RELATED_ACCOUNTS_NUMBER_HIGH": 4 + } + } + } + }, + "CreateKeyRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "key": { + "type": "Key", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListKeysRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListKeysResponse": { + "fields": { + "keys": { + "rule": "repeated", + "type": "Key", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "RetrieveLegacySecretKeyRequest": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "GetKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "UpdateKeyRequest": { + "fields": { + "key": { + "type": "Key", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "MigrateKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "GetMetricsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Metrics" + } + } + } + }, + "Metrics": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Metrics", + "(google.api.resource).pattern": "projects/{project}/keys/{key}/metrics" + }, + "fields": { + "name": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "scoreMetrics": { + "rule": "repeated", + "type": "ScoreMetrics", + "id": 2 + }, + "challengeMetrics": { + "rule": "repeated", + "type": "ChallengeMetrics", + "id": 3 + } + } + }, + "RetrieveLegacySecretKeyResponse": { + "fields": { + "legacySecretKey": { + "type": "string", + "id": 1 + } + } + }, + "Key": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Key", + "(google.api.resource).pattern": "projects/{project}/keys/{key}" + }, + "oneofs": { + "platformSettings": { + "oneof": [ + "webSettings", + "androidSettings", + "iosSettings" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "webSettings": { + "type": "WebKeySettings", + "id": 3 + }, + "androidSettings": { + "type": "AndroidKeySettings", + "id": 4 + }, + "iosSettings": { + "type": "IOSKeySettings", + "id": 5 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "testingOptions": { + "type": "TestingOptions", + "id": 9 + }, + "wafSettings": { + "type": "WafSettings", + "id": 10 + } + } + }, + "TestingOptions": { + "fields": { + "testingScore": { + "type": "float", + "id": 1 + }, + "testingChallenge": { + "type": "TestingChallenge", + "id": 2 + } + }, + "nested": { + "TestingChallenge": { + "values": { + "TESTING_CHALLENGE_UNSPECIFIED": 0, + "NOCAPTCHA": 1, + "UNSOLVABLE_CHALLENGE": 2 + } + } + } + }, + "WebKeySettings": { + "fields": { + "allowAllDomains": { + "type": "bool", + "id": 3 + }, + "allowedDomains": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "allowAmpTraffic": { + "type": "bool", + "id": 2 + }, + "integrationType": { + "type": "IntegrationType", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "challengeSecurityPreference": { + "type": "ChallengeSecurityPreference", + "id": 5 + } + }, + "nested": { + "IntegrationType": { + "values": { + "INTEGRATION_TYPE_UNSPECIFIED": 0, + "SCORE": 1, + "CHECKBOX": 2, + "INVISIBLE": 3 + } + }, + "ChallengeSecurityPreference": { + "values": { + "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED": 0, + "USABILITY": 1, + "BALANCE": 2, + "SECURITY": 3 + } + } + } + }, + "AndroidKeySettings": { + "fields": { + "allowAllPackageNames": { + "type": "bool", + "id": 2 + }, + "allowedPackageNames": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "IOSKeySettings": { + "fields": { + "allowAllBundleIds": { + "type": "bool", + "id": 2 + }, + "allowedBundleIds": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "ScoreDistribution": { + "fields": { + "scoreBuckets": { + "keyType": "int32", + "type": "int64", + "id": 1 + } + } + }, + "ScoreMetrics": { + "fields": { + "overallMetrics": { + "type": "ScoreDistribution", + "id": 1 + }, + "actionMetrics": { + "keyType": "string", + "type": "ScoreDistribution", + "id": 2 + } + } + }, + "ChallengeMetrics": { + "fields": { + "pageloadCount": { + "type": "int64", + "id": 1 + }, + "nocaptchaCount": { + "type": "int64", + "id": 2 + }, + "failedCount": { + "type": "int64", + "id": 3 + }, + "passedCount": { + "type": "int64", + "id": 4 + } + } + }, + "ListRelatedAccountGroupMembershipsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListRelatedAccountGroupMembershipsResponse": { + "fields": { + "relatedAccountGroupMemberships": { + "rule": "repeated", + "type": "RelatedAccountGroupMembership", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ListRelatedAccountGroupsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "recaptchaenterprise.googleapis.com/RelatedAccountGroup" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListRelatedAccountGroupsResponse": { + "fields": { + "relatedAccountGroups": { + "rule": "repeated", + "type": "RelatedAccountGroup", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "SearchRelatedAccountGroupMembershipsRequest": { + "fields": { + "project": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + }, + "hashedAccountId": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SearchRelatedAccountGroupMembershipsResponse": { + "fields": { + "relatedAccountGroupMemberships": { + "rule": "repeated", + "type": "RelatedAccountGroupMembership", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "RelatedAccountGroupMembership": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership", + "(google.api.resource).pattern": "projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + }, + "hashedAccountId": { + "type": "bytes", + "id": 2 + } + } + }, + "RelatedAccountGroup": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/RelatedAccountGroup", + "(google.api.resource).pattern": "projects/{project}/relatedaccountgroups/{relatedaccountgroup}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/RelatedAccountGroup" + } + } + } + }, + "WafSettings": { + "fields": { + "wafService": { + "type": "WafService", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "wafFeature": { + "type": "WafFeature", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "WafFeature": { + "values": { + "WAF_FEATURE_UNSPECIFIED": 0, + "CHALLENGE_PAGE": 1, + "SESSION_TOKEN": 2, + "ACTION_TOKEN": 3 + } + }, + "WafService": { + "values": { + "WAF_SERVICE_UNSPECIFIED": 0, + "CA": 1 + } + } + } + } + } + }, + "v1beta1": { + "options": { + "csharp_namespace": "Google.Cloud.RecaptchaEnterprise.V1Beta1", + "go_package": "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1;recaptchaenterprise", + "java_multiple_files": true, + "java_outer_classname": "RecaptchaEnterpriseProto", + "java_package": "com.google.recaptchaenterprise.v1beta1", + "objc_class_prefix": "GCRE", + "php_namespace": "Google\\Cloud\\RecaptchaEnterprise\\V1beta1", + "ruby_package": "Google::Cloud::RecaptchaEnterprise::V1beta1" + }, + "nested": { + "RecaptchaEnterpriseServiceV1Beta1": { + "options": { + "(google.api.default_host)": "recaptchaenterprise.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateAssessment": { + "requestType": "CreateAssessmentRequest", + "responseType": "Assessment", + "options": { + "(google.api.http).post": "/v1beta1/{parent=projects/*}/assessments", + "(google.api.http).body": "assessment", + "(google.api.method_signature)": "parent,assessment" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*}/assessments", + "body": "assessment" + } + }, + { + "(google.api.method_signature)": "parent,assessment" + } + ] + }, + "AnnotateAssessment": { + "requestType": "AnnotateAssessmentRequest", + "responseType": "AnnotateAssessmentResponse", + "options": { + "(google.api.http).post": "/v1beta1/{name=projects/*/assessments/*}:annotate", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,annotation" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{name=projects/*/assessments/*}:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,annotation" + } + ] + } + } + }, + "CreateAssessmentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "assessment": { + "type": "Assessment", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AnnotateAssessmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Assessment" + } + }, + "annotation": { + "type": "Annotation", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "reasons": { + "rule": "repeated", + "type": "Reason", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hashedAccountId": { + "type": "bytes", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Annotation": { + "valuesOptions": { + "PASSWORD_CORRECT": { + "deprecated": true + }, + "PASSWORD_INCORRECT": { + "deprecated": true + } + }, + "values": { + "ANNOTATION_UNSPECIFIED": 0, + "LEGITIMATE": 1, + "FRAUDULENT": 2, + "PASSWORD_CORRECT": 3, + "PASSWORD_INCORRECT": 4 + } + }, + "Reason": { + "values": { + "REASON_UNSPECIFIED": 0, + "CHARGEBACK": 1, + "CHARGEBACK_FRAUD": 8, + "CHARGEBACK_DISPUTE": 9, + "PAYMENT_HEURISTICS": 2, + "INITIATED_TWO_FACTOR": 7, + "PASSED_TWO_FACTOR": 3, + "FAILED_TWO_FACTOR": 4, + "CORRECT_PASSWORD": 5, + "INCORRECT_PASSWORD": 6 + } + } + } + }, + "AnnotateAssessmentResponse": { + "fields": {} + }, + "PasswordLeakVerification": { + "fields": { + "hashedUserCredentials": { + "type": "bytes", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "credentialsLeaked": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "canonicalizedUsername": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Assessment": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Assessment", + "(google.api.resource).pattern": "projects/{project}/assessments/{assessment}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "event": { + "type": "Event", + "id": 2 + }, + "score": { + "type": "float", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "tokenProperties": { + "type": "TokenProperties", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "reasons": { + "rule": "repeated", + "type": "ClassificationReason", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "passwordLeakVerification": { + "type": "PasswordLeakVerification", + "id": 7 + }, + "accountDefenderAssessment": { + "type": "AccountDefenderAssessment", + "id": 8 + } + }, + "nested": { + "ClassificationReason": { + "values": { + "CLASSIFICATION_REASON_UNSPECIFIED": 0, + "AUTOMATION": 1, + "UNEXPECTED_ENVIRONMENT": 2, + "TOO_MUCH_TRAFFIC": 3, + "UNEXPECTED_USAGE_PATTERNS": 4, + "LOW_CONFIDENCE_SCORE": 5 + } + } + } + }, + "Event": { + "fields": { + "token": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "siteKey": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userAgent": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userIpAddress": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "expectedAction": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hashedAccountId": { + "type": "bytes", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TokenProperties": { + "fields": { + "valid": { + "type": "bool", + "id": 1 + }, + "invalidReason": { + "type": "InvalidReason", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "hostname": { + "type": "string", + "id": 4 + }, + "action": { + "type": "string", + "id": 5 + } + }, + "nested": { + "InvalidReason": { + "valuesOptions": { + "SITE_MISMATCH": { + "deprecated": true + } + }, + "values": { + "INVALID_REASON_UNSPECIFIED": 0, + "UNKNOWN_INVALID_REASON": 1, + "MALFORMED": 2, + "EXPIRED": 3, + "DUPE": 4, + "SITE_MISMATCH": 5, + "MISSING": 6, + "BROWSER_ERROR": 7 + } + } + } + }, + "AccountDefenderAssessment": { + "fields": { + "labels": { + "rule": "repeated", + "type": "AccountDefenderLabel", + "id": 1 + } + }, + "nested": { + "AccountDefenderLabel": { + "values": { + "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": 0, + "PROFILE_MATCH": 1, + "SUSPICIOUS_LOGIN_ACTIVITY": 2, + "SUSPICIOUS_ACCOUNT_CREATION": 3, + "RELATED_ACCOUNTS_NUMBER_HIGH": 4 + } + } + } + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-recaptchaenterprise/samples/README.md b/packages/google-cloud-recaptchaenterprise/samples/README.md new file mode 100644 index 00000000000..ea4f029b55f --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/README.md @@ -0,0 +1,392 @@ +[//]: # "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 + +# [Google Cloud reCAPTCHA Enterprise: 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) + * [Recaptcha_enterprise_service.annotate_assessment](#recaptcha_enterprise_service.annotate_assessment) + * [Recaptcha_enterprise_service.create_assessment](#recaptcha_enterprise_service.create_assessment) + * [Recaptcha_enterprise_service.create_key](#recaptcha_enterprise_service.create_key) + * [Recaptcha_enterprise_service.delete_key](#recaptcha_enterprise_service.delete_key) + * [Recaptcha_enterprise_service.get_key](#recaptcha_enterprise_service.get_key) + * [Recaptcha_enterprise_service.get_metrics](#recaptcha_enterprise_service.get_metrics) + * [Recaptcha_enterprise_service.list_keys](#recaptcha_enterprise_service.list_keys) + * [Recaptcha_enterprise_service.list_related_account_group_memberships](#recaptcha_enterprise_service.list_related_account_group_memberships) + * [Recaptcha_enterprise_service.list_related_account_groups](#recaptcha_enterprise_service.list_related_account_groups) + * [Recaptcha_enterprise_service.migrate_key](#recaptcha_enterprise_service.migrate_key) + * [Recaptcha_enterprise_service.retrieve_legacy_secret_key](#recaptcha_enterprise_service.retrieve_legacy_secret_key) + * [Recaptcha_enterprise_service.search_related_account_group_memberships](#recaptcha_enterprise_service.search_related_account_group_memberships) + * [Recaptcha_enterprise_service.update_key](#recaptcha_enterprise_service.update_key) + * [Recaptcha_enterprise_service_v1_beta1.annotate_assessment](#recaptcha_enterprise_service_v1_beta1.annotate_assessment) + * [Recaptcha_enterprise_service_v1_beta1.create_assessment](#recaptcha_enterprise_service_v1_beta1.create_assessment) + * [Recaptcha_enterprise_service_v1_beta1.create_key](#recaptcha_enterprise_service_v1_beta1.create_key) + * [Recaptcha_enterprise_service_v1_beta1.delete_key](#recaptcha_enterprise_service_v1_beta1.delete_key) + * [Recaptcha_enterprise_service_v1_beta1.get_key](#recaptcha_enterprise_service_v1_beta1.get_key) + * [Recaptcha_enterprise_service_v1_beta1.list_keys](#recaptcha_enterprise_service_v1_beta1.list_keys) + * [Recaptcha_enterprise_service_v1_beta1.update_key](#recaptcha_enterprise_service_v1_beta1.update_key) + +## 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 + + + +### Recaptcha_enterprise_service.annotate_assessment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js` + + +----- + + + + +### Recaptcha_enterprise_service.create_assessment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js` + + +----- + + + + +### Recaptcha_enterprise_service.create_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.create_key.js` + + +----- + + + + +### Recaptcha_enterprise_service.delete_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.delete_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.delete_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.delete_key.js` + + +----- + + + + +### Recaptcha_enterprise_service.get_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_key.js` + + +----- + + + + +### Recaptcha_enterprise_service.get_metrics + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js` + + +----- + + + + +### Recaptcha_enterprise_service.list_keys + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_keys.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_keys.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_keys.js` + + +----- + + + + +### Recaptcha_enterprise_service.list_related_account_group_memberships + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js` + + +----- + + + + +### Recaptcha_enterprise_service.list_related_account_groups + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js` + + +----- + + + + +### Recaptcha_enterprise_service.migrate_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js` + + +----- + + + + +### Recaptcha_enterprise_service.retrieve_legacy_secret_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js` + + +----- + + + + +### Recaptcha_enterprise_service.search_related_account_group_memberships + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js` + + +----- + + + + +### Recaptcha_enterprise_service.update_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.update_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.update_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/recaptcha_enterprise_service.update_key.js` + + +----- + + + + +### Recaptcha_enterprise_service_v1_beta1.annotate_assessment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js` + + +----- + + + + +### Recaptcha_enterprise_service_v1_beta1.create_assessment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js` + + +----- + + + + +### Recaptcha_enterprise_service_v1_beta1.create_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js` + + +----- + + + + +### Recaptcha_enterprise_service_v1_beta1.delete_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js` + + +----- + + + + +### Recaptcha_enterprise_service_v1_beta1.get_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js` + + +----- + + + + +### Recaptcha_enterprise_service_v1_beta1.list_keys + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js` + + +----- + + + + +### Recaptcha_enterprise_service_v1_beta1.update_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.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/recaptcha-enterprise/docs/ diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js new file mode 100644 index 00000000000..24146c3cd7d --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_AnnotateAssessment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Assessment, in the format + * "projects/{project}/assessments/{assessment}". + */ + // const name = 'abc123' + /** + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. + */ + // const annotation = {} + /** + * Optional. Optional reasons for the annotation that will be assigned to the Event. + */ + // const reasons = 1234 + /** + * Optional. Unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in + * CreateAssessment, for example when the account identifier is not yet known + * in the initial request. It is recommended that the identifier is hashed + * using hmac-sha256 with stable secret. + */ + // const hashedAccountId = 'Buffer.from('string')' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callAnnotateAssessment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.annotateAssessment(request); + console.log(response); + } + + callAnnotateAssessment(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_AnnotateAssessment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js new file mode 100644 index 00000000000..f8d5e56966a --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.create_assessment.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, assessment) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateAssessment_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 in which the assessment will be created, + * in the format "projects/{project}". + */ + // const parent = 'abc123' + /** + * Required. The assessment details. + */ + // const assessment = {} + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callCreateAssessment() { + // Construct request + const request = { + parent, + assessment, + }; + + // Run request + const response = await recaptchaenterpriseClient.createAssessment(request); + console.log(response); + } + + callCreateAssessment(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateAssessment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.create_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.create_key.js new file mode 100644 index 00000000000..62f1bfc4222 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.create_key.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, key) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateKey_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 in which the key will be created, in the + * format "projects/{project}". + */ + // const parent = 'abc123' + /** + * Required. Information to create a reCAPTCHA Enterprise key. + */ + // const key = {} + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callCreateKey() { + // Construct request + const request = { + parent, + key, + }; + + // Run request + const response = await recaptchaenterpriseClient.createKey(request); + console.log(response); + } + + callCreateKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.delete_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.delete_key.js new file mode 100644 index 00000000000..c43d4a44ee8 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.delete_key.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 recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_DeleteKey_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 key to be deleted, in the format + * "projects/{project}/keys/{key}". + */ + // const name = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callDeleteKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.deleteKey(request); + console.log(response); + } + + callDeleteKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_DeleteKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.get_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.get_key.js new file mode 100644 index 00000000000..f0ffac910ba --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.get_key.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 recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetKey_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 requested key, in the format + * "projects/{project}/keys/{key}". + */ + // const name = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callGetKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.getKey(request); + console.log(response); + } + + callGetKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js new file mode 100644 index 00000000000..42c35e64d11 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.get_metrics.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 recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_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 requested metrics, in the format + * "projects/{project}/keys/{key}/metrics". + */ + // const name = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callGetMetrics() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.getMetrics(request); + console.log(response); + } + + callGetMetrics(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_keys.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_keys.js new file mode 100644 index 00000000000..a90e3bfaad3 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_keys.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListKeys_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 that contains the keys that will be + * listed, in the format "projects/{project}". + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of keys to return. Default is 10. Max limit is + * 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous. + * ListKeysRequest, if any. + */ + // const pageToken = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callListKeys() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await recaptchaenterpriseClient.listKeysAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKeys(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js new file mode 100644 index 00000000000..097f294ce3c --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroupMemberships_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for the related account group in the format + * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. + * When paginating, all other parameters provided to + * `ListRelatedAccountGroupMemberships` must match the call that provided the + * page token. + */ + // const pageToken = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callListRelatedAccountGroupMemberships() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await recaptchaenterpriseClient.listRelatedAccountGroupMembershipsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRelatedAccountGroupMemberships(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroupMemberships_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js new file mode 100644 index 00000000000..9be614706a0 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroups_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 to list related account groups from, in the format + * "projects/{project}". + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListRelatedAccountGroups` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callListRelatedAccountGroups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await recaptchaenterpriseClient.listRelatedAccountGroupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRelatedAccountGroups(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js new file mode 100644 index 00000000000..7437784d6db --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.migrate_key.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 recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_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 key to be migrated, in the format + * "projects/{project}/keys/{key}". + */ + // const name = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callMigrateKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.migrateKey(request); + console.log(response); + } + + callMigrateKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js new file mode 100644 index 00000000000..95cb5eb22e9 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.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(key) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_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 public key name linked to the requested secret key in the format + * "projects/{project}/keys/{key}". + */ + // const key = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callRetrieveLegacySecretKey() { + // Construct request + const request = { + key, + }; + + // Run request + const response = await recaptchaenterpriseClient.retrieveLegacySecretKey(request); + console.log(response); + } + + callRetrieveLegacySecretKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js new file mode 100644 index 00000000000..1e85d154cb6 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.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(project) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_SearchRelatedAccountGroupMemberships_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 to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". + */ + // const project = 'my-project' + /** + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. + */ + // const hashedAccountId = 'Buffer.from('string')' + /** + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous + * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the + * subsequent page. + * When paginating, all other parameters provided to + * `SearchRelatedAccountGroupMemberships` must match the call that provided + * the page token. + */ + // const pageToken = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callSearchRelatedAccountGroupMemberships() { + // Construct request + const request = { + project, + }; + + // Run request + const iterable = await recaptchaenterpriseClient.searchRelatedAccountGroupMembershipsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchRelatedAccountGroupMemberships(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_SearchRelatedAccountGroupMemberships_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.update_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.update_key.js new file mode 100644 index 00000000000..b7fc0fc86cd --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/recaptcha_enterprise_service.update_key.js @@ -0,0 +1,66 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(key) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_UpdateKey_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 key to update. + */ + // const key = {} + /** + * Optional. The mask to control which fields of the key get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = {} + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callUpdateKey() { + // Construct request + const request = { + key, + }; + + // Run request + const response = await recaptchaenterpriseClient.updateKey(request); + console.log(response); + } + + callUpdateKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_UpdateKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json new file mode 100644 index 00000000000..8084719b40d --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json @@ -0,0 +1,595 @@ +{ + "clientLibrary": { + "name": "nodejs-recaptchaenterprise", + "version": "3.1.1", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.recaptchaenterprise.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateAssessment_async", + "title": "RecaptchaEnterpriseService createAssessment Sample", + "origin": "API_DEFINITION", + "description": " Creates an Assessment of the likelihood an event is legitimate.", + "canonical": true, + "file": "recaptcha_enterprise_service.create_assessment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateAssessment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "assessment", + "type": ".google.cloud.recaptchaenterprise.v1.Assessment" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.Assessment", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "CreateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateAssessment", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_AnnotateAssessment_async", + "title": "RecaptchaEnterpriseService annotateAssessment Sample", + "origin": "API_DEFINITION", + "description": " Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.", + "canonical": true, + "file": "recaptcha_enterprise_service.annotate_assessment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnnotateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.AnnotateAssessment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "annotation", + "type": ".google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation" + }, + { + "name": "reasons", + "type": "TYPE_ENUM[]" + }, + { + "name": "hashed_account_id", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "AnnotateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.AnnotateAssessment", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateKey_async", + "title": "RecaptchaEnterpriseService createKey Sample", + "origin": "API_DEFINITION", + "description": " Creates a new reCAPTCHA Enterprise key.", + "canonical": true, + "file": "recaptcha_enterprise_service.create_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "key", + "type": ".google.cloud.recaptchaenterprise.v1.Key" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.Key", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "CreateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListKeys_async", + "title": "RecaptchaEnterpriseService listKeys Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all keys that belong to a project.", + "canonical": true, + "file": "recaptcha_enterprise_service.list_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListKeys", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListKeys", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.ListKeysResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "ListKeys", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListKeys", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_async", + "title": "RecaptchaEnterpriseService retrieveLegacySecretKey Sample", + "origin": "API_DEFINITION", + "description": " Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.", + "canonical": true, + "file": "recaptcha_enterprise_service.retrieve_legacy_secret_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RetrieveLegacySecretKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKey", + "async": true, + "parameters": [ + { + "name": "key", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "RetrieveLegacySecretKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.RetrieveLegacySecretKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetKey_async", + "title": "RecaptchaEnterpriseService getKey Sample", + "origin": "API_DEFINITION", + "description": " Returns the specified key.", + "canonical": true, + "file": "recaptcha_enterprise_service.get_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.Key", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "GetKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_UpdateKey_async", + "title": "RecaptchaEnterpriseService updateKey Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified key.", + "canonical": true, + "file": "recaptcha_enterprise_service.update_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.UpdateKey", + "async": true, + "parameters": [ + { + "name": "key", + "type": ".google.cloud.recaptchaenterprise.v1.Key" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.Key", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "UpdateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.UpdateKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_DeleteKey_async", + "title": "RecaptchaEnterpriseService deleteKey Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified key.", + "canonical": true, + "file": "recaptcha_enterprise_service.delete_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.DeleteKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "DeleteKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.DeleteKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async", + "title": "RecaptchaEnterpriseService migrateKey Sample", + "origin": "API_DEFINITION", + "description": " Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key is migrated, it can be used from either product. SiteVerify requests are billed as CreateAssessment calls. You must be authenticated as one of the current owners of the reCAPTCHA Site Key, and your user must have the reCAPTCHA Enterprise Admin IAM role in the destination project.", + "canonical": true, + "file": "recaptcha_enterprise_service.migrate_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MigrateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.Key", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "MigrateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_async", + "title": "RecaptchaEnterpriseService getMetrics Sample", + "origin": "API_DEFINITION", + "description": " Get some aggregated metrics for a Key. This data can be used to build dashboards.", + "canonical": true, + "file": "recaptcha_enterprise_service.get_metrics.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMetrics", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetMetrics", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.Metrics", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "GetMetrics", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetMetrics", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroups_async", + "title": "RecaptchaEnterpriseService listRelatedAccountGroups Sample", + "origin": "API_DEFINITION", + "description": " List groups of related accounts.", + "canonical": true, + "file": "recaptcha_enterprise_service.list_related_account_groups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRelatedAccountGroups", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "ListRelatedAccountGroups", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroups", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroupMemberships_async", + "title": "RecaptchaEnterpriseService listRelatedAccountGroupMemberships Sample", + "origin": "API_DEFINITION", + "description": " Get memberships in a group of related accounts.", + "canonical": true, + "file": "recaptcha_enterprise_service.list_related_account_group_memberships.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRelatedAccountGroupMemberships", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroupMemberships", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "ListRelatedAccountGroupMemberships", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListRelatedAccountGroupMemberships", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_SearchRelatedAccountGroupMemberships_async", + "title": "RecaptchaEnterpriseService searchRelatedAccountGroupMemberships Sample", + "origin": "API_DEFINITION", + "description": " Search group memberships related to a given account.", + "canonical": true, + "file": "recaptcha_enterprise_service.search_related_account_group_memberships.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchRelatedAccountGroupMemberships", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.SearchRelatedAccountGroupMemberships", + "async": true, + "parameters": [ + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "hashed_account_id", + "type": "TYPE_BYTES" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "SearchRelatedAccountGroupMemberships", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.SearchRelatedAccountGroupMemberships", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js new file mode 100644 index 00000000000..6a17e309ad8 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_AnnotateAssessment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Assessment, in the format + * "projects/{project_number}/assessments/{assessment_id}". + */ + // const name = 'abc123' + /** + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. + */ + // const annotation = {} + /** + * Optional. Optional reasons for the annotation that will be assigned to the Event. + */ + // const reasons = 1234 + /** + * Optional. Optional unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in + * CreateAssessment, for example when the account identifier is not yet known + * in the initial request. It is recommended that the identifier is hashed + * using hmac-sha256 with stable secret. + */ + // const hashedAccountId = 'Buffer.from('string')' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceV1Beta1Client(); + + async function callAnnotateAssessment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.annotateAssessment(request); + console.log(response); + } + + callAnnotateAssessment(); + // [END recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_AnnotateAssessment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js new file mode 100644 index 00000000000..dd1c7421e2f --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.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, assessment) { + // [START recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateAssessment_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 in which the assessment will be created, + * in the format "projects/{project_number}". + */ + // const parent = 'abc123' + /** + * Required. The assessment details. + */ + // const assessment = {} + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceV1Beta1Client(); + + async function callCreateAssessment() { + // Construct request + const request = { + parent, + assessment, + }; + + // Run request + const response = await recaptchaenterpriseClient.createAssessment(request); + console.log(response); + } + + callCreateAssessment(); + // [END recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateAssessment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js new file mode 100644 index 00000000000..b835923f453 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, key) { + // [START recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateKey_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project in which the key will be created, in the + * format "projects/{project_number}". + */ + // const parent = 'abc123' + /** + * Required. Information to create a reCAPTCHA Enterprise key. + */ + // const key = {} + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceV1Beta1Client(); + + async function callCreateKey() { + // Construct request + const request = { + parent, + key, + }; + + // Run request + const response = await recaptchaenterpriseClient.createKey(request); + console.log(response); + } + + callCreateKey(); + // [END recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js new file mode 100644 index 00000000000..149836ef693 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_DeleteKey_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the key to be deleted, in the format + * "projects/{project_number}/keys/{key_id}". + */ + // const name = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceV1Beta1Client(); + + async function callDeleteKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.deleteKey(request); + console.log(response); + } + + callDeleteKey(); + // [END recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_DeleteKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js new file mode 100644 index 00000000000..42ab9e46ddf --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_GetKey_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the requested key, in the format + * "projects/{project_number}/keys/{key_id}". + */ + // const name = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceV1Beta1Client(); + + async function callGetKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.getKey(request); + console.log(response); + } + + callGetKey(); + // [END recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_GetKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js new file mode 100644 index 00000000000..53096252862 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_ListKeys_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project that contains the keys that will be + * listed, in the format "projects/{project_number}". + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of keys to return. Default is 10. Max limit is + * 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous. + * ListKeysRequest, if any. + */ + // const pageToken = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceV1Beta1Client(); + + async function callListKeys() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await recaptchaenterpriseClient.listKeysAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKeys(); + // [END recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_ListKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js new file mode 100644 index 00000000000..b1c78ff1a26 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(key) { + // [START recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_UpdateKey_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The key to update. + */ + // const key = {} + /** + * Optional. The mask to control which field of the key get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = {} + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceV1Beta1Client(); + + async function callUpdateKey() { + // Construct request + const request = { + key, + }; + + // Run request + const response = await recaptchaenterpriseClient.updateKey(request); + console.log(response); + } + + callUpdateKey(); + // [END recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_UpdateKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json new file mode 100644 index 00000000000..97050889533 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json @@ -0,0 +1,111 @@ +{ + "clientLibrary": { + "name": "nodejs-recaptchaenterprise", + "version": "3.1.1", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.recaptchaenterprise.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateAssessment_async", + "title": "RecaptchaEnterpriseServiceV1Beta1 createAssessment Sample", + "origin": "API_DEFINITION", + "description": " Creates an Assessment of the likelihood an event is legitimate.", + "canonical": true, + "file": "recaptcha_enterprise_service_v1_beta1.create_assessment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateAssessment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "assessment", + "type": ".google.cloud.recaptchaenterprise.v1beta1.Assessment" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1beta1.Assessment", + "client": { + "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" + }, + "method": { + "shortName": "CreateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateAssessment", + "service": { + "shortName": "RecaptchaEnterpriseServiceV1Beta1", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_AnnotateAssessment_async", + "title": "RecaptchaEnterpriseServiceV1Beta1 annotateAssessment Sample", + "origin": "API_DEFINITION", + "description": " Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fradulent.", + "canonical": true, + "file": "recaptcha_enterprise_service_v1_beta1.annotate_assessment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnnotateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.AnnotateAssessment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "annotation", + "type": ".google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation" + }, + { + "name": "reasons", + "type": "TYPE_ENUM[]" + }, + { + "name": "hashed_account_id", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse", + "client": { + "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" + }, + "method": { + "shortName": "AnnotateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.AnnotateAssessment", + "service": { + "shortName": "RecaptchaEnterpriseServiceV1Beta1", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-recaptchaenterprise/samples/package.json b/packages/google-cloud-recaptchaenterprise/samples/package.json new file mode 100644 index 00000000000..e7f32ba05a0 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/package.json @@ -0,0 +1,23 @@ +{ + "name": "nodejs-recaptcha-enterprise-samples", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=12.0.0" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "echo add tests" + }, + "dependencies": { + "@google-cloud/recaptcha-enterprise": "^3.1.1" + }, + "devDependencies": { + "chai": "^4.2.0", + "mocha": "^8.0.0", + "uuid": "^9.0.0" + } +} diff --git a/packages/google-cloud-recaptchaenterprise/samples/quickstart.js b/packages/google-cloud-recaptchaenterprise/samples/quickstart.js new file mode 100644 index 00000000000..b6c5020cbb9 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/samples/quickstart.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +function main(parent) { + // [START recaptchaenterprise_quickstart] + /** + * 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 that contains the keys that will be + * listed, in the format "projects/{project}". + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of keys to return. Default is 10. Max limit is + * 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous. + * ListKeysRequest, if any. + */ + // const pageToken = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = + // eslint-disable-next-line node/no-missing-require + require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callListKeys() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await recaptchaenterpriseClient.listKeysAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKeys(); + // [END recaptchaenterprise_quickstart] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-recaptchaenterprise/src/index.ts b/packages/google-cloud-recaptchaenterprise/src/index.ts new file mode 100644 index 00000000000..f4866ad0693 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/index.ts @@ -0,0 +1,28 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +import * as v1beta1 from './v1beta1'; + +const RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; +type RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; + +export {v1, v1beta1, RecaptchaEnterpriseServiceClient}; +export default {v1, v1beta1, RecaptchaEnterpriseServiceClient}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/gapic_metadata.json b/packages/google-cloud-recaptchaenterprise/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..023c63fe31e --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1/gapic_metadata.json @@ -0,0 +1,169 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.recaptchaenterprise.v1", + "libraryPackage": "@google-cloud/recaptcha-enterprise", + "services": { + "RecaptchaEnterpriseService": { + "clients": { + "grpc": { + "libraryClient": "RecaptchaEnterpriseServiceClient", + "rpcs": { + "CreateAssessment": { + "methods": [ + "createAssessment" + ] + }, + "AnnotateAssessment": { + "methods": [ + "annotateAssessment" + ] + }, + "CreateKey": { + "methods": [ + "createKey" + ] + }, + "RetrieveLegacySecretKey": { + "methods": [ + "retrieveLegacySecretKey" + ] + }, + "GetKey": { + "methods": [ + "getKey" + ] + }, + "UpdateKey": { + "methods": [ + "updateKey" + ] + }, + "DeleteKey": { + "methods": [ + "deleteKey" + ] + }, + "MigrateKey": { + "methods": [ + "migrateKey" + ] + }, + "GetMetrics": { + "methods": [ + "getMetrics" + ] + }, + "ListKeys": { + "methods": [ + "listKeys", + "listKeysStream", + "listKeysAsync" + ] + }, + "ListRelatedAccountGroups": { + "methods": [ + "listRelatedAccountGroups", + "listRelatedAccountGroupsStream", + "listRelatedAccountGroupsAsync" + ] + }, + "ListRelatedAccountGroupMemberships": { + "methods": [ + "listRelatedAccountGroupMemberships", + "listRelatedAccountGroupMembershipsStream", + "listRelatedAccountGroupMembershipsAsync" + ] + }, + "SearchRelatedAccountGroupMemberships": { + "methods": [ + "searchRelatedAccountGroupMemberships", + "searchRelatedAccountGroupMembershipsStream", + "searchRelatedAccountGroupMembershipsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "RecaptchaEnterpriseServiceClient", + "rpcs": { + "CreateAssessment": { + "methods": [ + "createAssessment" + ] + }, + "AnnotateAssessment": { + "methods": [ + "annotateAssessment" + ] + }, + "CreateKey": { + "methods": [ + "createKey" + ] + }, + "RetrieveLegacySecretKey": { + "methods": [ + "retrieveLegacySecretKey" + ] + }, + "GetKey": { + "methods": [ + "getKey" + ] + }, + "UpdateKey": { + "methods": [ + "updateKey" + ] + }, + "DeleteKey": { + "methods": [ + "deleteKey" + ] + }, + "MigrateKey": { + "methods": [ + "migrateKey" + ] + }, + "GetMetrics": { + "methods": [ + "getMetrics" + ] + }, + "ListKeys": { + "methods": [ + "listKeys", + "listKeysStream", + "listKeysAsync" + ] + }, + "ListRelatedAccountGroups": { + "methods": [ + "listRelatedAccountGroups", + "listRelatedAccountGroupsStream", + "listRelatedAccountGroupsAsync" + ] + }, + "ListRelatedAccountGroupMemberships": { + "methods": [ + "listRelatedAccountGroupMemberships", + "listRelatedAccountGroupMembershipsStream", + "listRelatedAccountGroupMembershipsAsync" + ] + }, + "SearchRelatedAccountGroupMemberships": { + "methods": [ + "searchRelatedAccountGroupMemberships", + "searchRelatedAccountGroupMembershipsStream", + "searchRelatedAccountGroupMembershipsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/index.ts b/packages/google-cloud-recaptchaenterprise/src/v1/index.ts new file mode 100644 index 00000000000..0d9bc262643 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {RecaptchaEnterpriseServiceClient} from './recaptcha_enterprise_service_client'; diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts new file mode 100644 index 00000000000..f4b28da6fb2 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts @@ -0,0 +1,2387 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, + 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/v1/recaptcha_enterprise_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './recaptcha_enterprise_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service to determine the likelihood an event is legitimate. + * @class + * @memberof v1 + */ +export class RecaptchaEnterpriseServiceClient { + 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}; + recaptchaEnterpriseServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RecaptchaEnterpriseServiceClient. + * + * @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 RecaptchaEnterpriseServiceClient({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 RecaptchaEnterpriseServiceClient; + 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 = { + assessmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assessments/{assessment}' + ), + keyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/keys/{key}' + ), + metricsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/keys/{key}/metrics' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + relatedAccountGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/relatedaccountgroups/{relatedaccountgroup}' + ), + relatedAccountGroupMembershipPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}' + ), + }; + + // 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 = { + listKeys: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'keys' + ), + listRelatedAccountGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'relatedAccountGroups' + ), + listRelatedAccountGroupMemberships: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'relatedAccountGroupMemberships' + ), + searchRelatedAccountGroupMemberships: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'relatedAccountGroupMemberships' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService', + 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.recaptchaEnterpriseServiceStub) { + return this.recaptchaEnterpriseServiceStub; + } + + // Put together the "service stub" for + // google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService. + this.recaptchaEnterpriseServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.recaptchaenterprise.v1 + .RecaptchaEnterpriseService, + 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 recaptchaEnterpriseServiceStubMethods = [ + 'createAssessment', + 'annotateAssessment', + 'createKey', + 'listKeys', + 'retrieveLegacySecretKey', + 'getKey', + 'updateKey', + 'deleteKey', + 'migrateKey', + 'getMetrics', + 'listRelatedAccountGroups', + 'listRelatedAccountGroupMemberships', + 'searchRelatedAccountGroupMemberships', + ]; + for (const methodName of recaptchaEnterpriseServiceStubMethods) { + const callPromise = this.recaptchaEnterpriseServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.recaptchaEnterpriseServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'recaptchaenterprise.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 'recaptchaenterprise.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates an Assessment of the likelihood an event is legitimate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project in which the assessment will be created, + * in the format "projects/{project}". + * @param {google.cloud.recaptchaenterprise.v1.Assessment} request.assessment + * Required. The assessment details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Assessment]{@link google.cloud.recaptchaenterprise.v1.Assessment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.create_assessment.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateAssessment_async + */ + createAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IAssessment, + ( + | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | undefined + ), + {} | undefined + ] + >; + createAssessment( + request: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createAssessment( + request: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IAssessment, + ( + | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | 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.createAssessment(request, options, callback); + } + /** + * Annotates a previously created Assessment to provide additional information + * on whether the event turned out to be authentic or fraudulent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Assessment, in the format + * "projects/{project}/assessments/{assessment}". + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation} [request.annotation] + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. + * @param {number[]} [request.reasons] + * Optional. Optional reasons for the annotation that will be assigned to the Event. + * @param {Buffer} [request.hashedAccountId] + * Optional. Unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in + * CreateAssessment, for example when the account identifier is not yet known + * in the initial request. It is recommended that the identifier is hashed + * using hmac-sha256 with stable secret. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AnnotateAssessmentResponse]{@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_AnnotateAssessment_async + */ + annotateAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | undefined + ), + {} | undefined + ] + >; + annotateAssessment( + request: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + annotateAssessment( + request: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + annotateAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | 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.annotateAssessment(request, options, callback); + } + /** + * Creates a new reCAPTCHA Enterprise key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project in which the key will be created, in the + * format "projects/{project}". + * @param {google.cloud.recaptchaenterprise.v1.Key} request.key + * Required. Information to create a reCAPTCHA Enterprise key. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.create_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateKey_async + */ + createKey( + request?: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest | undefined, + {} | undefined + ] + >; + createKey( + request: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createKey( + request: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createKey( + request?: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest | 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.createKey(request, options, callback); + } + /** + * Returns the secret key related to the specified public key. + * You must use the legacy secret key only in a 3rd party integration with + * legacy reCAPTCHA. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.key + * Required. The public key name linked to the requested secret key in the format + * "projects/{project}/keys/{key}". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RetrieveLegacySecretKeyResponse]{@link google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_async + */ + retrieveLegacySecretKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | undefined + ), + {} | undefined + ] + >; + retrieveLegacySecretKey( + request: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + retrieveLegacySecretKey( + request: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + retrieveLegacySecretKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyRequest + | 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({ + key: request.key ?? '', + }); + this.initialize(); + return this.innerApiCalls.retrieveLegacySecretKey( + request, + options, + callback + ); + } + /** + * Returns the specified key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the requested key, in the format + * "projects/{project}/keys/{key}". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.get_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetKey_async + */ + getKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest | undefined, + {} | undefined + ] + >; + getKey( + request: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getKey( + request: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest | 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.getKey(request, options, callback); + } + /** + * Updates the specified key. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.recaptchaenterprise.v1.Key} request.key + * Required. The key to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields of the key get updated. If the mask is not + * present, all fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.update_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_UpdateKey_async + */ + updateKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest | undefined, + {} | undefined + ] + >; + updateKey( + request: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateKey( + request: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest | 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({ + 'key.name': request.key!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateKey(request, options, callback); + } + /** + * Deletes the specified key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the key to be deleted, in the format + * "projects/{project}/keys/{key}". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.delete_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_DeleteKey_async + */ + deleteKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest | undefined, + {} | undefined + ] + >; + deleteKey( + request: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteKey( + request: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest | 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.deleteKey(request, options, callback); + } + /** + * Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. + * Once a key is migrated, it can be used from either product. SiteVerify + * requests are billed as CreateAssessment calls. You must be + * authenticated as one of the current owners of the reCAPTCHA Site Key, and + * your user must have the reCAPTCHA Enterprise Admin IAM role in the + * destination project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the key to be migrated, in the format + * "projects/{project}/keys/{key}". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.migrate_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async + */ + migrateKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest | undefined, + {} | undefined + ] + >; + migrateKey( + request: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + migrateKey( + request: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): void; + migrateKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + | protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest | 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.migrateKey(request, options, callback); + } + /** + * Get some aggregated metrics for a Key. This data can be used to build + * dashboards. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the requested metrics, in the format + * "projects/{project}/keys/{key}/metrics". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Metrics]{@link google.cloud.recaptchaenterprise.v1.Metrics}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.get_metrics.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_async + */ + getMetrics( + request?: protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IMetrics, + protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest | undefined, + {} | undefined + ] + >; + getMetrics( + request: protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IMetrics, + | protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getMetrics( + request: protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IMetrics, + | protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getMetrics( + request?: protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1.IMetrics, + | protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IMetrics, + | protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IMetrics, + protos.google.cloud.recaptchaenterprise.v1.IGetMetricsRequest | 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.getMetrics(request, options, callback); + } + + /** + * Returns the list of all keys that belong to a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project that contains the keys that will be + * listed, in the format "projects/{project}". + * @param {number} [request.pageSize] + * Optional. The maximum number of keys to return. Default is 10. Max limit is + * 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous. + * ListKeysRequest, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. + * 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 `listKeysAsync()` + * 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. + */ + listKeys( + request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey[], + protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest | null, + protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse + ] + >; + listKeys( + request: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IKey + > + ): void; + listKeys( + request: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IKey + > + ): void; + listKeys( + request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IKey + >, + callback?: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IKey + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IKey[], + protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest | null, + protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse + ] + > | 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.listKeys(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 that contains the keys that will be + * listed, in the format "projects/{project}". + * @param {number} [request.pageSize] + * Optional. The maximum number of keys to return. Default is 10. Max limit is + * 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous. + * ListKeysRequest, if any. + * @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 [Key]{@link google.cloud.recaptchaenterprise.v1.Key} 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 `listKeysAsync()` + * 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. + */ + listKeysStream( + request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + 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['listKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKeys.createStream( + this.innerApiCalls.listKeys as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listKeys`, 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 that contains the keys that will be + * listed, in the format "projects/{project}". + * @param {number} [request.pageSize] + * Optional. The maximum number of keys to return. Default is 10. Max limit is + * 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous. + * ListKeysRequest, if any. + * @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 + * [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.list_keys.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListKeys_async + */ + listKeysAsync( + request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + 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['listKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKeys.asyncIterate( + this.innerApiCalls['listKeys'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * List groups of related accounts. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project to list related account groups from, in the format + * "projects/{project}". + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRelatedAccountGroups` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [RelatedAccountGroup]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroup}. + * 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 `listRelatedAccountGroupsAsync()` + * 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. + */ + listRelatedAccountGroups( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup[], + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest | null, + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse + ] + >; + listRelatedAccountGroups( + request: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup + > + ): void; + listRelatedAccountGroups( + request: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup + > + ): void; + listRelatedAccountGroups( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup + >, + callback?: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup[], + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest | null, + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsResponse + ] + > | 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.listRelatedAccountGroups( + 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 to list related account groups from, in the format + * "projects/{project}". + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRelatedAccountGroups` must match the call that provided the page + * token. + * @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 [RelatedAccountGroup]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroup} 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 `listRelatedAccountGroupsAsync()` + * 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. + */ + listRelatedAccountGroupsStream( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + 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['listRelatedAccountGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRelatedAccountGroups.createStream( + this.innerApiCalls.listRelatedAccountGroups as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listRelatedAccountGroups`, 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 to list related account groups from, in the format + * "projects/{project}". + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListRelatedAccountGroups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRelatedAccountGroups` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [RelatedAccountGroup]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroups_async + */ + listRelatedAccountGroupsAsync( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupsRequest, + 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['listRelatedAccountGroups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRelatedAccountGroups.asyncIterate( + this.innerApiCalls['listRelatedAccountGroups'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Get memberships in a group of related accounts. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name for the related account group in the format + * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. + * + * When paginating, all other parameters provided to + * `ListRelatedAccountGroupMemberships` must match the call that provided the + * page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [RelatedAccountGroupMembership]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership}. + * 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 `listRelatedAccountGroupMembershipsAsync()` + * 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. + */ + listRelatedAccountGroupMemberships( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[], + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest | null, + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse + ] + >; + listRelatedAccountGroupMemberships( + request: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + > + ): void; + listRelatedAccountGroupMemberships( + request: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + > + ): void; + listRelatedAccountGroupMemberships( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + >, + callback?: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[], + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest | null, + protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsResponse + ] + > | 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.listRelatedAccountGroupMemberships( + 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 resource name for the related account group in the format + * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. + * + * When paginating, all other parameters provided to + * `ListRelatedAccountGroupMemberships` must match the call that provided the + * page token. + * @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 [RelatedAccountGroupMembership]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership} 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 `listRelatedAccountGroupMembershipsAsync()` + * 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. + */ + listRelatedAccountGroupMembershipsStream( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + 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['listRelatedAccountGroupMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRelatedAccountGroupMemberships.createStream( + this.innerApiCalls.listRelatedAccountGroupMemberships as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listRelatedAccountGroupMemberships`, 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 resource name for the related account group in the format + * `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. + * @param {number} [request.pageSize] + * Optional. The maximum number of accounts to return. The service might return fewer + * than this value. + * If unspecified, at most 50 accounts are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships` + * call. + * + * When paginating, all other parameters provided to + * `ListRelatedAccountGroupMemberships` must match the call that provided the + * page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [RelatedAccountGroupMembership]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroupMemberships_async + */ + listRelatedAccountGroupMembershipsAsync( + request?: protos.google.cloud.recaptchaenterprise.v1.IListRelatedAccountGroupMembershipsRequest, + 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['listRelatedAccountGroupMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRelatedAccountGroupMemberships.asyncIterate( + this.innerApiCalls['listRelatedAccountGroupMemberships'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Search group memberships related to a given account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Required. The name of the project to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". + * @param {Buffer} [request.hashedAccountId] + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the + * subsequent page. + * + * When paginating, all other parameters provided to + * `SearchRelatedAccountGroupMemberships` must match the call that provided + * the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [RelatedAccountGroupMembership]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership}. + * 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 `searchRelatedAccountGroupMembershipsAsync()` + * 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. + */ + searchRelatedAccountGroupMemberships( + request?: protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[], + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest | null, + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse + ] + >; + searchRelatedAccountGroupMemberships( + request: protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + > + ): void; + searchRelatedAccountGroupMemberships( + request: protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + callback: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + > + ): void; + searchRelatedAccountGroupMemberships( + request?: protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + >, + callback?: PaginationCallback< + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + | protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse + | null + | undefined, + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[], + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest | null, + protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsResponse + ] + > | 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({ + project: request.project ?? '', + }); + this.initialize(); + return this.innerApiCalls.searchRelatedAccountGroupMemberships( + 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.project + * Required. The name of the project to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". + * @param {Buffer} [request.hashedAccountId] + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the + * subsequent page. + * + * When paginating, all other parameters provided to + * `SearchRelatedAccountGroupMemberships` must match the call that provided + * the page token. + * @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 [RelatedAccountGroupMembership]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership} 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 `searchRelatedAccountGroupMembershipsAsync()` + * 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. + */ + searchRelatedAccountGroupMembershipsStream( + request?: protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + 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({ + project: request.project ?? '', + }); + const defaultCallSettings = + this._defaults['searchRelatedAccountGroupMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchRelatedAccountGroupMemberships.createStream( + this.innerApiCalls.searchRelatedAccountGroupMemberships as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `searchRelatedAccountGroupMemberships`, 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.project + * Required. The name of the project to search related account group memberships from. + * Specify the project name in the following format: "projects/{project}". + * @param {Buffer} [request.hashedAccountId] + * Optional. The unique stable hashed user identifier we should search connections to. + * The identifier should correspond to a `hashed_account_id` provided in a + * previous `CreateAssessment` or `AnnotateAssessment` call. + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service might return fewer than + * this value. + * If unspecified, at most 50 groups are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous + * `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the + * subsequent page. + * + * When paginating, all other parameters provided to + * `SearchRelatedAccountGroupMemberships` must match the call that provided + * the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [RelatedAccountGroupMembership]{@link google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_SearchRelatedAccountGroupMemberships_async + */ + searchRelatedAccountGroupMembershipsAsync( + request?: protos.google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest, + 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({ + project: request.project ?? '', + }); + const defaultCallSettings = + this._defaults['searchRelatedAccountGroupMemberships']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate( + this.innerApiCalls['searchRelatedAccountGroupMemberships'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified assessment resource name string. + * + * @param {string} project + * @param {string} assessment + * @returns {string} Resource name string. + */ + assessmentPath(project: string, assessment: string) { + return this.pathTemplates.assessmentPathTemplate.render({ + project: project, + assessment: assessment, + }); + } + + /** + * Parse the project from Assessment resource. + * + * @param {string} assessmentName + * A fully-qualified path representing Assessment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAssessmentName(assessmentName: string) { + return this.pathTemplates.assessmentPathTemplate.match(assessmentName) + .project; + } + + /** + * Parse the assessment from Assessment resource. + * + * @param {string} assessmentName + * A fully-qualified path representing Assessment resource. + * @returns {string} A string representing the assessment. + */ + matchAssessmentFromAssessmentName(assessmentName: string) { + return this.pathTemplates.assessmentPathTemplate.match(assessmentName) + .assessment; + } + + /** + * Return a fully-qualified key resource name string. + * + * @param {string} project + * @param {string} key + * @returns {string} Resource name string. + */ + keyPath(project: string, key: string) { + return this.pathTemplates.keyPathTemplate.render({ + project: project, + key: key, + }); + } + + /** + * Parse the project from Key resource. + * + * @param {string} keyName + * A fully-qualified path representing Key resource. + * @returns {string} A string representing the project. + */ + matchProjectFromKeyName(keyName: string) { + return this.pathTemplates.keyPathTemplate.match(keyName).project; + } + + /** + * Parse the key from Key resource. + * + * @param {string} keyName + * A fully-qualified path representing Key resource. + * @returns {string} A string representing the key. + */ + matchKeyFromKeyName(keyName: string) { + return this.pathTemplates.keyPathTemplate.match(keyName).key; + } + + /** + * Return a fully-qualified metrics resource name string. + * + * @param {string} project + * @param {string} key + * @returns {string} Resource name string. + */ + metricsPath(project: string, key: string) { + return this.pathTemplates.metricsPathTemplate.render({ + project: project, + key: key, + }); + } + + /** + * Parse the project from Metrics resource. + * + * @param {string} metricsName + * A fully-qualified path representing Metrics resource. + * @returns {string} A string representing the project. + */ + matchProjectFromMetricsName(metricsName: string) { + return this.pathTemplates.metricsPathTemplate.match(metricsName).project; + } + + /** + * Parse the key from Metrics resource. + * + * @param {string} metricsName + * A fully-qualified path representing Metrics resource. + * @returns {string} A string representing the key. + */ + matchKeyFromMetricsName(metricsName: string) { + return this.pathTemplates.metricsPathTemplate.match(metricsName).key; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified relatedAccountGroup resource name string. + * + * @param {string} project + * @param {string} relatedaccountgroup + * @returns {string} Resource name string. + */ + relatedAccountGroupPath(project: string, relatedaccountgroup: string) { + return this.pathTemplates.relatedAccountGroupPathTemplate.render({ + project: project, + relatedaccountgroup: relatedaccountgroup, + }); + } + + /** + * Parse the project from RelatedAccountGroup resource. + * + * @param {string} relatedAccountGroupName + * A fully-qualified path representing RelatedAccountGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRelatedAccountGroupName(relatedAccountGroupName: string) { + return this.pathTemplates.relatedAccountGroupPathTemplate.match( + relatedAccountGroupName + ).project; + } + + /** + * Parse the relatedaccountgroup from RelatedAccountGroup resource. + * + * @param {string} relatedAccountGroupName + * A fully-qualified path representing RelatedAccountGroup resource. + * @returns {string} A string representing the relatedaccountgroup. + */ + matchRelatedaccountgroupFromRelatedAccountGroupName( + relatedAccountGroupName: string + ) { + return this.pathTemplates.relatedAccountGroupPathTemplate.match( + relatedAccountGroupName + ).relatedaccountgroup; + } + + /** + * Return a fully-qualified relatedAccountGroupMembership resource name string. + * + * @param {string} project + * @param {string} relatedaccountgroup + * @param {string} membership + * @returns {string} Resource name string. + */ + relatedAccountGroupMembershipPath( + project: string, + relatedaccountgroup: string, + membership: string + ) { + return this.pathTemplates.relatedAccountGroupMembershipPathTemplate.render({ + project: project, + relatedaccountgroup: relatedaccountgroup, + membership: membership, + }); + } + + /** + * Parse the project from RelatedAccountGroupMembership resource. + * + * @param {string} relatedAccountGroupMembershipName + * A fully-qualified path representing RelatedAccountGroupMembership resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRelatedAccountGroupMembershipName( + relatedAccountGroupMembershipName: string + ) { + return this.pathTemplates.relatedAccountGroupMembershipPathTemplate.match( + relatedAccountGroupMembershipName + ).project; + } + + /** + * Parse the relatedaccountgroup from RelatedAccountGroupMembership resource. + * + * @param {string} relatedAccountGroupMembershipName + * A fully-qualified path representing RelatedAccountGroupMembership resource. + * @returns {string} A string representing the relatedaccountgroup. + */ + matchRelatedaccountgroupFromRelatedAccountGroupMembershipName( + relatedAccountGroupMembershipName: string + ) { + return this.pathTemplates.relatedAccountGroupMembershipPathTemplate.match( + relatedAccountGroupMembershipName + ).relatedaccountgroup; + } + + /** + * Parse the membership from RelatedAccountGroupMembership resource. + * + * @param {string} relatedAccountGroupMembershipName + * A fully-qualified path representing RelatedAccountGroupMembership resource. + * @returns {string} A string representing the membership. + */ + matchMembershipFromRelatedAccountGroupMembershipName( + relatedAccountGroupMembershipName: string + ) { + return this.pathTemplates.relatedAccountGroupMembershipPathTemplate.match( + relatedAccountGroupMembershipName + ).membership; + } + + /** + * 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.recaptchaEnterpriseServiceStub && !this._terminated) { + return this.recaptchaEnterpriseServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client_config.json b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client_config.json new file mode 100644 index 00000000000..acb5f95bd9c --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client_config.json @@ -0,0 +1,85 @@ +{ + "interfaces": { + "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService": { + "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": { + "CreateAssessment": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AnnotateAssessment": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateKey": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListKeys": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RetrieveLegacySecretKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetKey": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateKey": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteKey": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "MigrateKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetMetrics": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRelatedAccountGroups": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListRelatedAccountGroupMemberships": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SearchRelatedAccountGroupMemberships": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_proto_list.json b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_proto_list.json new file mode 100644 index 00000000000..790fef960af --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto" +] diff --git a/packages/google-cloud-recaptchaenterprise/src/v1beta1/gapic_metadata.json b/packages/google-cloud-recaptchaenterprise/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..2a7ea778505 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1beta1/gapic_metadata.json @@ -0,0 +1,43 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.recaptchaenterprise.v1beta1", + "libraryPackage": "@google-cloud/recaptcha-enterprise", + "services": { + "RecaptchaEnterpriseServiceV1Beta1": { + "clients": { + "grpc": { + "libraryClient": "RecaptchaEnterpriseServiceV1Beta1Client", + "rpcs": { + "CreateAssessment": { + "methods": [ + "createAssessment" + ] + }, + "AnnotateAssessment": { + "methods": [ + "annotateAssessment" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "RecaptchaEnterpriseServiceV1Beta1Client", + "rpcs": { + "CreateAssessment": { + "methods": [ + "createAssessment" + ] + }, + "AnnotateAssessment": { + "methods": [ + "annotateAssessment" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-recaptchaenterprise/src/v1beta1/index.ts b/packages/google-cloud-recaptchaenterprise/src/v1beta1/index.ts new file mode 100644 index 00000000000..7cf779e456f --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {RecaptchaEnterpriseServiceV1Beta1Client} from './recaptcha_enterprise_service_v1_beta1_client'; diff --git a/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts new file mode 100644 index 00000000000..be347ee16e4 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -0,0 +1,613 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './recaptcha_enterprise_service_v1_beta1_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service to determine the likelihood an event is legitimate. + * @class + * @memberof v1beta1 + */ +export class RecaptchaEnterpriseServiceV1Beta1Client { + 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}; + recaptchaEnterpriseServiceV1Beta1Stub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RecaptchaEnterpriseServiceV1Beta1Client. + * + * @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 RecaptchaEnterpriseServiceV1Beta1Client({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 RecaptchaEnterpriseServiceV1Beta1Client; + 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 = { + assessmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assessments/{assessment}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1', + 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.recaptchaEnterpriseServiceV1Beta1Stub) { + return this.recaptchaEnterpriseServiceV1Beta1Stub; + } + + // Put together the "service stub" for + // google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1. + this.recaptchaEnterpriseServiceV1Beta1Stub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.recaptchaenterprise.v1beta1 + .RecaptchaEnterpriseServiceV1Beta1, + 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 recaptchaEnterpriseServiceV1Beta1StubMethods = [ + 'createAssessment', + 'annotateAssessment', + ]; + for (const methodName of recaptchaEnterpriseServiceV1Beta1StubMethods) { + const callPromise = this.recaptchaEnterpriseServiceV1Beta1Stub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.recaptchaEnterpriseServiceV1Beta1Stub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'recaptchaenterprise.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 'recaptchaenterprise.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates an Assessment of the likelihood an event is legitimate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project in which the assessment will be created, + * in the format "projects/{project_number}". + * @param {google.cloud.recaptchaenterprise.v1beta1.Assessment} request.assessment + * Required. The assessment details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Assessment]{@link google.cloud.recaptchaenterprise.v1beta1.Assessment}. + * 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/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js + * region_tag:recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateAssessment_async + */ + createAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, + ( + | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest + | undefined + ), + {} | undefined + ] + >; + createAssessment( + request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createAssessment( + request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, + | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, + ( + | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest + | 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.createAssessment(request, options, callback); + } + /** + * Annotates a previously created Assessment to provide additional information + * on whether the event turned out to be authentic or fradulent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Assessment, in the format + * "projects/{project_number}/assessments/{assessment_id}". + * @param {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation} [request.annotation] + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. + * @param {number[]} [request.reasons] + * Optional. Optional reasons for the annotation that will be assigned to the Event. + * @param {Buffer} [request.hashedAccountId] + * Optional. Optional unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in + * CreateAssessment, for example when the account identifier is not yet known + * in the initial request. It is recommended that the identifier is hashed + * using hmac-sha256 with stable secret. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AnnotateAssessmentResponse]{@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse}. + * 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/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js + * region_tag:recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_AnnotateAssessment_async + */ + annotateAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest + | undefined + ), + {} | undefined + ] + >; + annotateAssessment( + request: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + annotateAssessment( + request: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + annotateAssessment( + request?: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, + | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, + ( + | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest + | 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.annotateAssessment(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified assessment resource name string. + * + * @param {string} project + * @param {string} assessment + * @returns {string} Resource name string. + */ + assessmentPath(project: string, assessment: string) { + return this.pathTemplates.assessmentPathTemplate.render({ + project: project, + assessment: assessment, + }); + } + + /** + * Parse the project from Assessment resource. + * + * @param {string} assessmentName + * A fully-qualified path representing Assessment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAssessmentName(assessmentName: string) { + return this.pathTemplates.assessmentPathTemplate.match(assessmentName) + .project; + } + + /** + * Parse the assessment from Assessment resource. + * + * @param {string} assessmentName + * A fully-qualified path representing Assessment resource. + * @returns {string} A string representing the assessment. + */ + matchAssessmentFromAssessmentName(assessmentName: string) { + return this.pathTemplates.assessmentPathTemplate.match(assessmentName) + .assessment; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.recaptchaEnterpriseServiceV1Beta1Stub && !this._terminated) { + return this.recaptchaEnterpriseServiceV1Beta1Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json b/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json new file mode 100644 index 00000000000..7907ebe8f8e --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1": { + "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": { + "CreateAssessment": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AnnotateAssessment": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json b/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json new file mode 100644 index 00000000000..35d2e7543ad --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto" +] diff --git a/packages/google-cloud-recaptchaenterprise/system-test/fixtures/sample/src/index.js b/packages/google-cloud-recaptchaenterprise/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..88f738cf909 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const recaptchaenterprise = require('@google-cloud/recaptcha-enterprise'); + +function main() { + const recaptchaEnterpriseServiceClient = + new recaptchaenterprise.RecaptchaEnterpriseServiceClient(); +} + +main(); diff --git a/packages/google-cloud-recaptchaenterprise/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-recaptchaenterprise/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..0cfe4da061f --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,35 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 {RecaptchaEnterpriseServiceClient} from '@google-cloud/recaptcha-enterprise'; + +// check that the client class type name can be used +function doStuffWithRecaptchaEnterpriseServiceClient( + client: RecaptchaEnterpriseServiceClient +) { + client.close(); +} + +function main() { + // check that the client instance can be created + const recaptchaEnterpriseServiceClient = + new RecaptchaEnterpriseServiceClient(); + doStuffWithRecaptchaEnterpriseServiceClient(recaptchaEnterpriseServiceClient); +} + +main(); diff --git a/packages/google-cloud-recaptchaenterprise/system-test/install.ts b/packages/google-cloud-recaptchaenterprise/system-test/install.ts new file mode 100644 index 00000000000..6dd1eaadafa --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1.ts b/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1.ts new file mode 100644 index 00000000000..ab5f746919a --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1.ts @@ -0,0 +1,3377 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 recaptchaenterpriseserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} 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 stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.RecaptchaEnterpriseServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient + .servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.recaptchaEnterpriseServiceStub, undefined); + await client.initialize(); + assert(client.recaptchaEnterpriseServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.recaptchaEnterpriseServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.recaptchaEnterpriseServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + 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 recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + 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('createAssessment', () => { + it('invokes createAssessment without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Assessment() + ); + client.innerApiCalls.createAssessment = stubSimpleCall(expectedResponse); + const [response] = await client.createAssessment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssessment without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Assessment() + ); + client.innerApiCalls.createAssessment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAssessment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IAssessment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssessment with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAssessment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createAssessment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssessment with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAssessment(request), expectedError); + }); + }); + + describe('annotateAssessment', () => { + it('invokes annotateAssessment without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse() + ); + client.innerApiCalls.annotateAssessment = + stubSimpleCall(expectedResponse); + const [response] = await client.annotateAssessment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes annotateAssessment without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse() + ); + client.innerApiCalls.annotateAssessment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.annotateAssessment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes annotateAssessment with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.annotateAssessment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.annotateAssessment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes annotateAssessment with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.annotateAssessment(request), expectedError); + }); + }); + + describe('createKey', () => { + it('invokes createKey without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.createKey = stubSimpleCall(expectedResponse); + const [response] = await client.createKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKey without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.createKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKey with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKey with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.CreateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.CreateKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKey(request), expectedError); + }); + }); + + describe('retrieveLegacySecretKey', () => { + it('invokes retrieveLegacySecretKey without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedHeaderRequestParams = `key=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse() + ); + client.innerApiCalls.retrieveLegacySecretKey = + stubSimpleCall(expectedResponse); + const [response] = await client.retrieveLegacySecretKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retrieveLegacySecretKey without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedHeaderRequestParams = `key=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse() + ); + client.innerApiCalls.retrieveLegacySecretKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.retrieveLegacySecretKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IRetrieveLegacySecretKeyResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retrieveLegacySecretKey with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedHeaderRequestParams = `key=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.retrieveLegacySecretKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.retrieveLegacySecretKey(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.retrieveLegacySecretKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes retrieveLegacySecretKey with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest', + ['key'] + ); + request.key = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.retrieveLegacySecretKey(request), + expectedError + ); + }); + }); + + describe('getKey', () => { + it('invokes getKey without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.getKey = stubSimpleCall(expectedResponse); + const [response] = await client.getKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getKey as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKey without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.getKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getKey as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKey with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getKey(request), expectedError); + const actualRequest = (client.innerApiCalls.getKey as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKey with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getKey(request), expectedError); + }); + }); + + describe('updateKey', () => { + it('invokes updateKey without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest() + ); + request.key ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest', + ['key', 'name'] + ); + request.key.name = defaultValue1; + const expectedHeaderRequestParams = `key.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.updateKey = stubSimpleCall(expectedResponse); + const [response] = await client.updateKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKey without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest() + ); + request.key ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest', + ['key', 'name'] + ); + request.key.name = defaultValue1; + const expectedHeaderRequestParams = `key.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.updateKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKey with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest() + ); + request.key ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest', + ['key', 'name'] + ); + request.key.name = defaultValue1; + const expectedHeaderRequestParams = `key.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKey with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest() + ); + request.key ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest', + ['key', 'name'] + ); + request.key.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateKey(request), expectedError); + }); + }); + + describe('deleteKey', () => { + it('invokes deleteKey without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKey = stubSimpleCall(expectedResponse); + const [response] = await client.deleteKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKey without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteKey( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKey with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKey with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteKey(request), expectedError); + }); + }); + + describe('migrateKey', () => { + it('invokes migrateKey without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.migrateKey = stubSimpleCall(expectedResponse); + const [response] = await client.migrateKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.migrateKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.migrateKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes migrateKey without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ); + client.innerApiCalls.migrateKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.migrateKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.migrateKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.migrateKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes migrateKey with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.migrateKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.migrateKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.migrateKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.migrateKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes migrateKey with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.migrateKey(request), expectedError); + }); + }); + + describe('getMetrics', () => { + it('invokes getMetrics without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetMetricsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Metrics() + ); + client.innerApiCalls.getMetrics = stubSimpleCall(expectedResponse); + const [response] = await client.getMetrics(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMetrics as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMetrics as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetrics without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetMetricsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Metrics() + ); + client.innerApiCalls.getMetrics = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetrics( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IMetrics | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMetrics as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMetrics as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetrics with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetMetricsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetrics = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getMetrics(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getMetrics as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMetrics as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMetrics with closed client', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.GetMetricsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.GetMetricsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMetrics(request), expectedError); + }); + }); + + describe('listKeys', () => { + it('invokes listKeys without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + ]; + client.innerApiCalls.listKeys = stubSimpleCall(expectedResponse); + const [response] = await client.listKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeys without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + ]; + client.innerApiCalls.listKeys = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listKeys( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1.IKey[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeys with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listKeys = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listKeys(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeysStream without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + ]; + client.descriptors.page.listKeys.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.Key[] = []; + stream.on( + 'data', + (response: protos.google.cloud.recaptchaenterprise.v1.Key) => { + 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.listKeys.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKeys, request) + ); + assert( + (client.descriptors.page.listKeys.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listKeysStream with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKeys.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.Key[] = []; + stream.on( + 'data', + (response: protos.google.cloud.recaptchaenterprise.v1.Key) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listKeys.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKeys, request) + ); + assert( + (client.descriptors.page.listKeys.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKeys without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.Key() + ), + ]; + client.descriptors.page.listKeys.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.recaptchaenterprise.v1.IKey[] = []; + const iterable = client.listKeysAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listKeys.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert( + (client.descriptors.page.listKeys.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKeys with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKeys.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listKeysAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.recaptchaenterprise.v1.IKey[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listKeys.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert( + (client.descriptors.page.listKeys.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRelatedAccountGroups', () => { + it('invokes listRelatedAccountGroups without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + ]; + client.innerApiCalls.listRelatedAccountGroups = + stubSimpleCall(expectedResponse); + const [response] = await client.listRelatedAccountGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRelatedAccountGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRelatedAccountGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRelatedAccountGroups without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + ]; + client.innerApiCalls.listRelatedAccountGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRelatedAccountGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRelatedAccountGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRelatedAccountGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRelatedAccountGroups with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRelatedAccountGroups = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listRelatedAccountGroups(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listRelatedAccountGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRelatedAccountGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRelatedAccountGroupsStream without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + ]; + client.descriptors.page.listRelatedAccountGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listRelatedAccountGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + ) => { + 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.listRelatedAccountGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listRelatedAccountGroups, request) + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRelatedAccountGroupsStream with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRelatedAccountGroups.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listRelatedAccountGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listRelatedAccountGroups + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listRelatedAccountGroups, request) + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroups + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRelatedAccountGroups without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroup() + ), + ]; + client.descriptors.page.listRelatedAccountGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup[] = + []; + const iterable = client.listRelatedAccountGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listRelatedAccountGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRelatedAccountGroups with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRelatedAccountGroups.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRelatedAccountGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroup[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listRelatedAccountGroups + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroups + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRelatedAccountGroupMemberships', () => { + it('invokes listRelatedAccountGroupMemberships without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.innerApiCalls.listRelatedAccountGroupMemberships = + stubSimpleCall(expectedResponse); + const [response] = await client.listRelatedAccountGroupMemberships( + request + ); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRelatedAccountGroupMemberships without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.innerApiCalls.listRelatedAccountGroupMemberships = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRelatedAccountGroupMemberships( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRelatedAccountGroupMemberships with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRelatedAccountGroupMemberships = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listRelatedAccountGroupMemberships(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRelatedAccountGroupMembershipsStream without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.descriptors.page.listRelatedAccountGroupMemberships.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listRelatedAccountGroupMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + ) => { + 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.listRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listRelatedAccountGroupMemberships, + request + ) + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRelatedAccountGroupMembershipsStream with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRelatedAccountGroupMemberships.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listRelatedAccountGroupMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listRelatedAccountGroupMemberships, + request + ) + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRelatedAccountGroupMemberships without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.descriptors.page.listRelatedAccountGroupMemberships.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[] = + []; + const iterable = client.listRelatedAccountGroupMembershipsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRelatedAccountGroupMemberships with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRelatedAccountGroupMemberships.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRelatedAccountGroupMembershipsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('searchRelatedAccountGroupMemberships', () => { + it('invokes searchRelatedAccountGroupMemberships without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest', + ['project'] + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.innerApiCalls.searchRelatedAccountGroupMemberships = + stubSimpleCall(expectedResponse); + const [response] = await client.searchRelatedAccountGroupMemberships( + request + ); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchRelatedAccountGroupMemberships without error using callback', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest', + ['project'] + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.innerApiCalls.searchRelatedAccountGroupMemberships = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchRelatedAccountGroupMemberships( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchRelatedAccountGroupMemberships with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest', + ['project'] + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchRelatedAccountGroupMemberships = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.searchRelatedAccountGroupMemberships(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchRelatedAccountGroupMembershipsStream without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest', + ['project'] + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.descriptors.page.searchRelatedAccountGroupMemberships.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchRelatedAccountGroupMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + ) => { + 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.searchRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.searchRelatedAccountGroupMemberships, + request + ) + ); + assert( + ( + client.descriptors.page.searchRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchRelatedAccountGroupMembershipsStream with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest', + ['project'] + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchRelatedAccountGroupMemberships.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.searchRelatedAccountGroupMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.searchRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.searchRelatedAccountGroupMemberships, + request + ) + ); + assert( + ( + client.descriptors.page.searchRelatedAccountGroupMemberships + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchRelatedAccountGroupMemberships without error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest', + ['project'] + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() + ), + ]; + client.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[] = + []; + const iterable = + client.searchRelatedAccountGroupMembershipsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.searchRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.searchRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchRelatedAccountGroupMemberships with error', async () => { + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest', + ['project'] + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = + client.searchRelatedAccountGroupMembershipsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.recaptchaenterprise.v1.IRelatedAccountGroupMembership[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.searchRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.searchRelatedAccountGroupMemberships + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('assessment', () => { + const fakePath = '/rendered/path/assessment'; + const expectedParameters = { + project: 'projectValue', + assessment: 'assessmentValue', + }; + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.assessmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assessmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assessmentPath', () => { + const result = client.assessmentPath('projectValue', 'assessmentValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assessmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAssessmentName', () => { + const result = client.matchProjectFromAssessmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.assessmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAssessmentFromAssessmentName', () => { + const result = client.matchAssessmentFromAssessmentName(fakePath); + assert.strictEqual(result, 'assessmentValue'); + assert( + (client.pathTemplates.assessmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('key', () => { + const fakePath = '/rendered/path/key'; + const expectedParameters = { + project: 'projectValue', + key: 'keyValue', + }; + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.keyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.keyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('keyPath', () => { + const result = client.keyPath('projectValue', 'keyValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.keyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromKeyName', () => { + const result = client.matchProjectFromKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.keyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyFromKeyName', () => { + const result = client.matchKeyFromKeyName(fakePath); + assert.strictEqual(result, 'keyValue'); + assert( + (client.pathTemplates.keyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('metrics', () => { + const fakePath = '/rendered/path/metrics'; + const expectedParameters = { + project: 'projectValue', + key: 'keyValue', + }; + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.metricsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.metricsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('metricsPath', () => { + const result = client.metricsPath('projectValue', 'keyValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.metricsPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromMetricsName', () => { + const result = client.matchProjectFromMetricsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.metricsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyFromMetricsName', () => { + const result = client.matchKeyFromMetricsName(fakePath); + assert.strictEqual(result, 'keyValue'); + assert( + (client.pathTemplates.metricsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('relatedAccountGroup', () => { + const fakePath = '/rendered/path/relatedAccountGroup'; + const expectedParameters = { + project: 'projectValue', + relatedaccountgroup: 'relatedaccountgroupValue', + }; + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.relatedAccountGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.relatedAccountGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('relatedAccountGroupPath', () => { + const result = client.relatedAccountGroupPath( + 'projectValue', + 'relatedaccountgroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.relatedAccountGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRelatedAccountGroupName', () => { + const result = client.matchProjectFromRelatedAccountGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.relatedAccountGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRelatedaccountgroupFromRelatedAccountGroupName', () => { + const result = + client.matchRelatedaccountgroupFromRelatedAccountGroupName(fakePath); + assert.strictEqual(result, 'relatedaccountgroupValue'); + assert( + ( + client.pathTemplates.relatedAccountGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('relatedAccountGroupMembership', () => { + const fakePath = '/rendered/path/relatedAccountGroupMembership'; + const expectedParameters = { + project: 'projectValue', + relatedaccountgroup: 'relatedaccountgroupValue', + membership: 'membershipValue', + }; + const client = + new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.relatedAccountGroupMembershipPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.relatedAccountGroupMembershipPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('relatedAccountGroupMembershipPath', () => { + const result = client.relatedAccountGroupMembershipPath( + 'projectValue', + 'relatedaccountgroupValue', + 'membershipValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.relatedAccountGroupMembershipPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromRelatedAccountGroupMembershipName', () => { + const result = + client.matchProjectFromRelatedAccountGroupMembershipName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.relatedAccountGroupMembershipPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchRelatedaccountgroupFromRelatedAccountGroupMembershipName', () => { + const result = + client.matchRelatedaccountgroupFromRelatedAccountGroupMembershipName( + fakePath + ); + assert.strictEqual(result, 'relatedaccountgroupValue'); + assert( + ( + client.pathTemplates.relatedAccountGroupMembershipPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMembershipFromRelatedAccountGroupMembershipName', () => { + const result = + client.matchMembershipFromRelatedAccountGroupMembershipName(fakePath); + assert.strictEqual(result, 'membershipValue'); + assert( + ( + client.pathTemplates.relatedAccountGroupMembershipPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts b/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts new file mode 100644 index 00000000000..fa441a00e8b --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts @@ -0,0 +1,575 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 recaptchaenterpriseservicev1beta1Module from '../src'; + +import {protobuf} 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); +} + +describe('v1beta1.RecaptchaEnterpriseServiceV1Beta1Client', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + recaptchaenterpriseservicev1beta1Module.v1beta1 + .RecaptchaEnterpriseServiceV1Beta1Client.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + recaptchaenterpriseservicev1beta1Module.v1beta1 + .RecaptchaEnterpriseServiceV1Beta1Client.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + recaptchaenterpriseservicev1beta1Module.v1beta1 + .RecaptchaEnterpriseServiceV1Beta1Client.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual( + client.recaptchaEnterpriseServiceV1Beta1Stub, + undefined + ); + await client.initialize(); + assert(client.recaptchaEnterpriseServiceV1Beta1Stub); + }); + + it('has close method for the initialized client', done => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.recaptchaEnterpriseServiceV1Beta1Stub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual( + client.recaptchaEnterpriseServiceV1Beta1Stub, + undefined + ); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + 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 recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + 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('createAssessment', () => { + it('invokes createAssessment without error', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.Assessment() + ); + client.innerApiCalls.createAssessment = stubSimpleCall(expectedResponse); + const [response] = await client.createAssessment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssessment without error using callback', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.Assessment() + ); + client.innerApiCalls.createAssessment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAssessment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssessment with error', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAssessment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createAssessment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createAssessment with closed client', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createAssessment(request), expectedError); + }); + }); + + describe('annotateAssessment', () => { + it('invokes annotateAssessment without error', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse() + ); + client.innerApiCalls.annotateAssessment = + stubSimpleCall(expectedResponse); + const [response] = await client.annotateAssessment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes annotateAssessment without error using callback', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse() + ); + client.innerApiCalls.annotateAssessment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.annotateAssessment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes annotateAssessment with error', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.annotateAssessment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.annotateAssessment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.annotateAssessment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes annotateAssessment with closed client', async () => { + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.annotateAssessment(request), expectedError); + }); + }); + + describe('Path templates', () => { + describe('assessment', () => { + const fakePath = '/rendered/path/assessment'; + const expectedParameters = { + project: 'projectValue', + assessment: 'assessmentValue', + }; + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.assessmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assessmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assessmentPath', () => { + const result = client.assessmentPath('projectValue', 'assessmentValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assessmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAssessmentName', () => { + const result = client.matchProjectFromAssessmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.assessmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAssessmentFromAssessmentName', () => { + const result = client.matchAssessmentFromAssessmentName(fakePath); + assert.strictEqual(result, 'assessmentValue'); + assert( + (client.pathTemplates.assessmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-recaptchaenterprise/tsconfig.json b/packages/google-cloud-recaptchaenterprise/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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-recaptchaenterprise/webpack.config.js b/packages/google-cloud-recaptchaenterprise/webpack.config.js new file mode 100644 index 00000000000..8a8caae6493 --- /dev/null +++ b/packages/google-cloud-recaptchaenterprise/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: 'RecaptchaEnterpriseService', + filename: './recaptcha-enterprise-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 077a7239844..2f12797a350 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -58,11 +58,10 @@ "packages/google-cloud-gkeconnect-gateway": {}, "packages/google-cloud-gkehub": {}, "packages/google-cloud-gkemulticloud": {}, - "packages/google-cloud-kms": {}, - "packages/google-cloud-ids": {}, "packages/google-cloud-iap": {}, "packages/google-cloud-ids": {}, "packages/google-cloud-iot": {}, + "packages/google-cloud-kms": {}, "packages/google-cloud-language": {}, "packages/google-cloud-lifesciences": {}, "packages/google-cloud-managedidentities": {}, @@ -82,6 +81,7 @@ "packages/google-cloud-phishingprotection": {}, "packages/google-cloud-policytroubleshooter": {}, "packages/google-cloud-privatecatalog": {}, + "packages/google-cloud-recaptchaenterprise": {}, "packages/google-cloud-recommender": {}, "packages/google-cloud-redis": {}, "packages/google-cloud-resourcemanager": {},