From 6de5f02e538c05ef5a8ac2bf2e7fb5e45cb3ad6e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 7 Dec 2022 23:54:51 +0000 Subject: [PATCH 1/2] feat: add account_verification field to Assessment for MFA PiperOrigin-RevId: 493691493 Source-Link: https://github.com/googleapis/googleapis/commit/c9560d8f8f535936baff1fcda1f12806e38f67b9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ec825c8ef9987b67d43dfffab50914e032275d63 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXJlY2FwdGNoYWVudGVycHJpc2UvLk93bEJvdC55YW1sIiwiaCI6ImVjODI1YzhlZjk5ODdiNjdkNDNkZmZmYWI1MDkxNGUwMzIyNzVkNjMifQ== --- .../v1/.eslintignore | 7 + .../v1/.eslintrc.json | 3 + .../v1/.gitignore | 14 + .../v1/.jsdoc.js | 55 + .../v1/.mocharc.js | 33 + .../v1/.prettierrc.js | 22 + .../v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../v1/package.json | 64 + .../v1/recaptchaenterprise.proto | 1113 ++++++++ ..._enterprise_service.annotate_assessment.js | 81 + ...ha_enterprise_service.create_assessment.js | 67 + ...recaptcha_enterprise_service.create_key.js | 67 + ...recaptcha_enterprise_service.delete_key.js | 62 + .../recaptcha_enterprise_service.get_key.js | 62 + ...ecaptcha_enterprise_service.get_metrics.js | 62 + .../recaptcha_enterprise_service.list_keys.js | 74 + ....list_related_account_group_memberships.js | 78 + ...ise_service.list_related_account_groups.js | 78 + ...ecaptcha_enterprise_service.migrate_key.js | 73 + ...rise_service.retrieve_legacy_secret_key.js | 62 + ...earch_related_account_group_memberships.js | 86 + ...recaptcha_enterprise_service.update_key.js | 66 + ...a.google.cloud.recaptchaenterprise.v1.json | 599 +++++ .../v1/src/index.ts | 25 + .../v1/src/v1/gapic_metadata.json | 169 ++ .../v1/src/v1/index.ts | 19 + .../v1/recaptcha_enterprise_service_client.ts | 2042 ++++++++++++++ ...tcha_enterprise_service_client_config.json | 85 + ...captcha_enterprise_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../gapic_recaptcha_enterprise_service_v1.ts | 2384 +++++++++++++++++ .../v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1beta1/.eslintignore | 7 + .../v1beta1/.eslintrc.json | 3 + .../v1beta1/.gitignore | 14 + .../v1beta1/.jsdoc.js | 55 + .../v1beta1/.mocharc.js | 33 + .../v1beta1/.prettierrc.js | 22 + .../v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 16 + .../v1beta1/package.json | 64 + .../v1beta1/recaptchaenterprise.proto | 350 +++ ...se_service_v1_beta1.annotate_assessment.js | 80 + ...rise_service_v1_beta1.create_assessment.js | 67 + ...gle.cloud.recaptchaenterprise.v1beta1.json | 111 + .../v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 43 + .../v1beta1/src/v1beta1/index.ts | 19 + ...tcha_enterprise_service_v1_beta1_client.ts | 541 ++++ ...rprise_service_v1_beta1_client_config.json | 36 + ...nterprise_service_v1_beta1_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + ...cha_enterprise_service_v1_beta1_v1beta1.ts | 437 +++ .../v1beta1/tsconfig.json | 19 + .../v1beta1/webpack.config.js | 64 + 61 files changed, 9881 insertions(+) create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.gitignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.jsdoc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.jsdoc.js new file mode 100644 index 00000000000..fd8d38512d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md new file mode 100644 index 00000000000..57a5e168123 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md @@ -0,0 +1 @@ +Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/linkinator.config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json new file mode 100644 index 00000000000..66ef57ed3b0 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/recaptcha-enterprise", + "version": "0.1.0", + "description": "Recaptchaenterprise client for Node.js", + "repository": "googleapis/nodejs-recaptchaenterprise", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google recaptchaenterprise", + "recaptchaenterprise", + "recaptcha enterprise service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto new file mode 100644 index 00000000000..12e5852d50c --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -0,0 +1,1113 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this 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 {} + +// Information about a verification endpoint that can be used for 2FA. +message EndpointVerificationInfo { + oneof endpoint { + // Email address for which to trigger a verification request. + string email_address = 1; + + // Phone number for which to trigger a verification request. Should be given + // in E.164 format. + string phone_number = 2; + } + + // Output only. Token to provide to the client to trigger endpoint + // verification. It must be used within 15 minutes. + string request_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp of the last successful verification for the + // endpoint, if any. + google.protobuf.Timestamp last_verification_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Information about account verification, used for identity verification. +message AccountVerificationInfo { + // Result of the account verification as contained in the verdict token issued + // at the end of the verification flow. + enum Result { + // No information about the latest account verification. + RESULT_UNSPECIFIED = 0; + + // The user was successfully verified. This means the account verification + // challenge was successfully completed. + SUCCESS_USER_VERIFIED = 1; + + // The user failed the verification challenge. + ERROR_USER_NOT_VERIFIED = 2; + + // The site is not properly onboarded to use the account verification + // feature. + ERROR_SITE_ONBOARDING_INCOMPLETE = 3; + + // The recipient is not allowed for account verification. This can occur + // during integration but should not occur in production. + ERROR_RECIPIENT_NOT_ALLOWED = 4; + + // The recipient has already been sent too many verification codes in a + // short amount of time. + ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED = 5; + + // The verification flow could not be completed due to a critical internal + // error. + ERROR_CRITICAL_INTERNAL = 6; + + // The client has exceeded their two factor request quota for this period of + // time. + ERROR_CUSTOMER_QUOTA_EXHAUSTED = 7; + + // The request cannot be processed at the time because of an incident. This + // bypass can be restricted to a problematic destination email domain, a + // customer, or could affect the entire service. + ERROR_VERIFICATION_BYPASSED = 8; + + // The request parameters do not match with the token provided and cannot be + // processed. + ERROR_VERDICT_MISMATCH = 9; + } + + // Endpoints that can be used for identity verification. + repeated EndpointVerificationInfo endpoints = 1; + + // Language code preference for the verification message, set as a IETF BCP 47 + // language code. + string language_code = 3; + + // Output only. Result of the latest account verification challenge. + Result latest_verification_result = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Username of the account that is being verified. Deprecated. Customers + // should now provide the hashed account ID field in Event. + string username = 2 [deprecated = true]; +} + +// 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]; + + // Account verification information for identity verification. The assessment + // event must include a token and site key to use this feature. + AccountVerificationInfo account_verification = 5; + + // 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; + + // The name of the Android package with which the token was generated (Android + // keys only). + string android_package_name = 8; + + // The ID of the iOS bundle with which the token was generated (iOS keys + // only). + string ios_bundle_id = 9; + + // 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" + } + ]; + + // Optional. If true, skips the billing check. + // A reCAPTCHA Enterprise key or migrated key behaves differently than a + // reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see + // https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid + // any disruption of your usage, we check that a billing account is present. + // If your usage of reCAPTCHA is under the free quota, you can safely skip the + // billing check and proceed with the migration. See + // https://cloud.google.com/recaptcha-enterprise/docs/billing-information. + bool skip_billing_check = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// 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. + 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]; +} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js new file mode 100644 index 00000000000..04fb366c8fa --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js @@ -0,0 +1,81 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js new file mode 100644 index 00000000000..f8d5e56966a --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js new file mode 100644 index 00000000000..62f1bfc4222 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js new file mode 100644 index 00000000000..c43d4a44ee8 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js new file mode 100644 index 00000000000..f0ffac910ba --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js new file mode 100644 index 00000000000..42c35e64d11 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js new file mode 100644 index 00000000000..a90e3bfaad3 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js new file mode 100644 index 00000000000..523c80763c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js new file mode 100644 index 00000000000..d5edb77984c --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js @@ -0,0 +1,78 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js new file mode 100644 index 00000000000..108ddc86c4e --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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' + /** + * Optional. If true, skips the billing check. + * A reCAPTCHA Enterprise key or migrated key behaves differently than a + * reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see + * https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid + * any disruption of your usage, we check that a billing account is present. + * If your usage of reCAPTCHA is under the free quota, you can safely skip the + * billing check and proceed with the migration. See + * https://cloud.google.com/recaptcha-enterprise/docs/billing-information. + */ + // const skipBillingCheck = true + + // 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js new file mode 100644 index 00000000000..f3575ba3070 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js new file mode 100644 index 00000000000..81bb0b2abf0 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js new file mode 100644 index 00000000000..b50005c503d --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json new file mode 100644 index 00000000000..cd31d495c3e --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json @@ -0,0 +1,599 @@ +{ + "clientLibrary": { + "name": "nodejs-recaptchaenterprise", + "version": "0.1.0", + "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": 73, + "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": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MigrateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "skip_billing_check", + "type": "TYPE_BOOL" + } + ], + "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": 70, + "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": 70, + "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" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts new file mode 100644 index 00000000000..51c11379be5 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 v1 from './v1'; +const RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; +type RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; +export {v1, RecaptchaEnterpriseServiceClient}; +export default {v1, RecaptchaEnterpriseServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..023c63fe31e --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/index.ts new file mode 100644 index 00000000000..0d9bc262643 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts new file mode 100644 index 00000000000..77758868250 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts @@ -0,0 +1,2042 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // 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 {boolean} [request.skipBillingCheck] + * Optional. If true, skips the billing check. + * A reCAPTCHA Enterprise key or migrated key behaves differently than a + * reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see + * https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid + * any disruption of your usage, we check that a billing account is present. + * If your usage of reCAPTCHA is under the free quota, you can safely skip the + * billing check and proceed with the migration. See + * https://cloud.google.com/recaptcha-enterprise/docs/billing-information. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client_config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client_config.json new file mode 100644 index 00000000000..acb5f95bd9c --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json new file mode 100644 index 00000000000..790fef960af --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto" +] diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..3df789b6cc1 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..1ba761a963b --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts new file mode 100644 index 00000000000..06f71913012 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts @@ -0,0 +1,2384 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/tsconfig.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/webpack.config.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/webpack.config.js new file mode 100644 index 00000000000..6a9d07da0f4 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.gitignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.jsdoc.js new file mode 100644 index 00000000000..fd8d38512d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md new file mode 100644 index 00000000000..57a5e168123 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md @@ -0,0 +1 @@ +Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json new file mode 100644 index 00000000000..395cc28a4f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/recaptcha-enterprise", + "version": "0.1.0", + "description": "Recaptchaenterprise client for Node.js", + "repository": "googleapis/nodejs-recaptchaenterprise", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google recaptchaenterprise", + "recaptchaenterprise", + "recaptcha enterprise service v1 beta1" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto new file mode 100644 index 00000000000..28a07a8e51b --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js new file mode 100644 index 00000000000..6a17e309ad8 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js new file mode 100644 index 00000000000..dd1c7421e2f --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json new file mode 100644 index 00000000000..521cdd71261 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json @@ -0,0 +1,111 @@ +{ + "clientLibrary": { + "name": "nodejs-recaptchaenterprise", + "version": "0.1.0", + "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" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts new file mode 100644 index 00000000000..6bdae5da74e --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 v1beta1 from './v1beta1'; +const RecaptchaEnterpriseServiceV1Beta1Client = v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +type RecaptchaEnterpriseServiceV1Beta1Client = v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +export {v1beta1, RecaptchaEnterpriseServiceV1Beta1Client}; +export default {v1beta1, RecaptchaEnterpriseServiceV1Beta1Client}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000000..2a7ea778505 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000000..7cf779e456f --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts new file mode 100644 index 00000000000..1bb8bd398fe --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -0,0 +1,541 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json new file mode 100644 index 00000000000..7907ebe8f8e --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json new file mode 100644 index 00000000000..35d2e7543ad --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto" +] diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..2f544c32851 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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 recaptchaEnterpriseServiceV1Beta1Client = new recaptchaenterprise.RecaptchaEnterpriseServiceV1Beta1Client(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..0214f5c8301 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {RecaptchaEnterpriseServiceV1Beta1Client} from '@google-cloud/recaptcha-enterprise'; + +// check that the client class type name can be used +function doStuffWithRecaptchaEnterpriseServiceV1Beta1Client(client: RecaptchaEnterpriseServiceV1Beta1Client) { + client.close(); +} + +function main() { + // check that the client instance can be created + const recaptchaEnterpriseServiceV1Beta1Client = new RecaptchaEnterpriseServiceV1Beta1Client(); + doStuffWithRecaptchaEnterpriseServiceV1Beta1Client(recaptchaEnterpriseServiceV1Beta1Client); +} + +main(); diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts new file mode 100644 index 00000000000..7562d57bc10 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts @@ -0,0 +1,437 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/webpack.config.js new file mode 100644 index 00000000000..a5030d63883 --- /dev/null +++ b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/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: 'RecaptchaEnterpriseServiceV1Beta1', + filename: './recaptcha-enterprise-service-v1-beta1.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 654ccbbc51dd175e62ec35af438e0ed0a2374698 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 7 Dec 2022 23:59:12 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../v1/.eslintignore | 7 - .../v1/.eslintrc.json | 3 - .../v1/.gitignore | 14 - .../v1/.jsdoc.js | 55 - .../v1/.mocharc.js | 33 - .../v1/.prettierrc.js | 22 - .../v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../v1/package.json | 64 - .../v1/recaptchaenterprise.proto | 1113 -------- ..._enterprise_service.annotate_assessment.js | 81 - ...ha_enterprise_service.create_assessment.js | 67 - ...recaptcha_enterprise_service.create_key.js | 67 - ...recaptcha_enterprise_service.delete_key.js | 62 - .../recaptcha_enterprise_service.get_key.js | 62 - ...ecaptcha_enterprise_service.get_metrics.js | 62 - .../recaptcha_enterprise_service.list_keys.js | 74 - ....list_related_account_group_memberships.js | 78 - ...ise_service.list_related_account_groups.js | 78 - ...ecaptcha_enterprise_service.migrate_key.js | 73 - ...rise_service.retrieve_legacy_secret_key.js | 62 - ...earch_related_account_group_memberships.js | 86 - ...recaptcha_enterprise_service.update_key.js | 66 - ...a.google.cloud.recaptchaenterprise.v1.json | 599 ----- .../v1/src/index.ts | 25 - .../v1/src/v1/gapic_metadata.json | 169 -- .../v1/src/v1/index.ts | 19 - .../v1/recaptcha_enterprise_service_client.ts | 2042 -------------- ...tcha_enterprise_service_client_config.json | 85 - ...captcha_enterprise_service_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../gapic_recaptcha_enterprise_service_v1.ts | 2384 ----------------- .../v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1beta1/.eslintignore | 7 - .../v1beta1/.eslintrc.json | 3 - .../v1beta1/.gitignore | 14 - .../v1beta1/.jsdoc.js | 55 - .../v1beta1/.mocharc.js | 33 - .../v1beta1/.prettierrc.js | 22 - .../v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 16 - .../v1beta1/package.json | 64 - .../v1beta1/recaptchaenterprise.proto | 350 --- ...se_service_v1_beta1.annotate_assessment.js | 80 - ...rise_service_v1_beta1.create_assessment.js | 67 - ...gle.cloud.recaptchaenterprise.v1beta1.json | 111 - .../v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 43 - .../v1beta1/src/v1beta1/index.ts | 19 - ...tcha_enterprise_service_v1_beta1_client.ts | 541 ---- ...rprise_service_v1_beta1_client_config.json | 36 - ...nterprise_service_v1_beta1_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - ...cha_enterprise_service_v1_beta1_v1beta1.ts | 437 --- .../v1beta1/tsconfig.json | 19 - .../v1beta1/webpack.config.js | 64 - .../v1/recaptchaenterprise.proto | 253 +- .../protos/protos.d.ts | 274 ++ .../protos/protos.js | 787 +++++- .../protos/protos.json | 96 + ..._enterprise_service.annotate_assessment.js | 9 +- ....list_related_account_group_memberships.js | 11 +- ...ise_service.list_related_account_groups.js | 15 +- ...ecaptcha_enterprise_service.migrate_key.js | 11 + ...rise_service.retrieve_legacy_secret_key.js | 4 +- ...earch_related_account_group_memberships.js | 18 +- ...recaptcha_enterprise_service.update_key.js | 4 +- ...a.google.cloud.recaptchaenterprise.v1.json | 12 +- .../v1/recaptcha_enterprise_service_client.ts | 161 +- ...tcha_enterprise_service_v1_beta1_client.ts | 3 + 75 files changed, 1476 insertions(+), 10063 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.gitignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.jsdoc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.jsdoc.js deleted file mode 100644 index fd8d38512d4..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md deleted file mode 100644 index 57a5e168123..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/linkinator.config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json deleted file mode 100644 index 66ef57ed3b0..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/recaptcha-enterprise", - "version": "0.1.0", - "description": "Recaptchaenterprise client for Node.js", - "repository": "googleapis/nodejs-recaptchaenterprise", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google recaptchaenterprise", - "recaptchaenterprise", - "recaptcha enterprise service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto deleted file mode 100644 index 12e5852d50c..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto +++ /dev/null @@ -1,1113 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this 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 {} - -// Information about a verification endpoint that can be used for 2FA. -message EndpointVerificationInfo { - oneof endpoint { - // Email address for which to trigger a verification request. - string email_address = 1; - - // Phone number for which to trigger a verification request. Should be given - // in E.164 format. - string phone_number = 2; - } - - // Output only. Token to provide to the client to trigger endpoint - // verification. It must be used within 15 minutes. - string request_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp of the last successful verification for the - // endpoint, if any. - google.protobuf.Timestamp last_verification_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Information about account verification, used for identity verification. -message AccountVerificationInfo { - // Result of the account verification as contained in the verdict token issued - // at the end of the verification flow. - enum Result { - // No information about the latest account verification. - RESULT_UNSPECIFIED = 0; - - // The user was successfully verified. This means the account verification - // challenge was successfully completed. - SUCCESS_USER_VERIFIED = 1; - - // The user failed the verification challenge. - ERROR_USER_NOT_VERIFIED = 2; - - // The site is not properly onboarded to use the account verification - // feature. - ERROR_SITE_ONBOARDING_INCOMPLETE = 3; - - // The recipient is not allowed for account verification. This can occur - // during integration but should not occur in production. - ERROR_RECIPIENT_NOT_ALLOWED = 4; - - // The recipient has already been sent too many verification codes in a - // short amount of time. - ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED = 5; - - // The verification flow could not be completed due to a critical internal - // error. - ERROR_CRITICAL_INTERNAL = 6; - - // The client has exceeded their two factor request quota for this period of - // time. - ERROR_CUSTOMER_QUOTA_EXHAUSTED = 7; - - // The request cannot be processed at the time because of an incident. This - // bypass can be restricted to a problematic destination email domain, a - // customer, or could affect the entire service. - ERROR_VERIFICATION_BYPASSED = 8; - - // The request parameters do not match with the token provided and cannot be - // processed. - ERROR_VERDICT_MISMATCH = 9; - } - - // Endpoints that can be used for identity verification. - repeated EndpointVerificationInfo endpoints = 1; - - // Language code preference for the verification message, set as a IETF BCP 47 - // language code. - string language_code = 3; - - // Output only. Result of the latest account verification challenge. - Result latest_verification_result = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Username of the account that is being verified. Deprecated. Customers - // should now provide the hashed account ID field in Event. - string username = 2 [deprecated = true]; -} - -// 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]; - - // Account verification information for identity verification. The assessment - // event must include a token and site key to use this feature. - AccountVerificationInfo account_verification = 5; - - // 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; - - // The name of the Android package with which the token was generated (Android - // keys only). - string android_package_name = 8; - - // The ID of the iOS bundle with which the token was generated (iOS keys - // only). - string ios_bundle_id = 9; - - // 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" - } - ]; - - // Optional. If true, skips the billing check. - // A reCAPTCHA Enterprise key or migrated key behaves differently than a - // reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see - // https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid - // any disruption of your usage, we check that a billing account is present. - // If your usage of reCAPTCHA is under the free quota, you can safely skip the - // billing check and proceed with the migration. See - // https://cloud.google.com/recaptcha-enterprise/docs/billing-information. - bool skip_billing_check = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// 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. - 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]; -} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js deleted file mode 100644 index 04fb366c8fa..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js deleted file mode 100644 index f8d5e56966a..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js deleted file mode 100644 index 62f1bfc4222..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js deleted file mode 100644 index c43d4a44ee8..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js deleted file mode 100644 index f0ffac910ba..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js deleted file mode 100644 index 42c35e64d11..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js deleted file mode 100644 index a90e3bfaad3..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js deleted file mode 100644 index 523c80763c4..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js deleted file mode 100644 index d5edb77984c..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js deleted file mode 100644 index 108ddc86c4e..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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' - /** - * Optional. If true, skips the billing check. - * A reCAPTCHA Enterprise key or migrated key behaves differently than a - * reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see - * https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid - * any disruption of your usage, we check that a billing account is present. - * If your usage of reCAPTCHA is under the free quota, you can safely skip the - * billing check and proceed with the migration. See - * https://cloud.google.com/recaptcha-enterprise/docs/billing-information. - */ - // const skipBillingCheck = true - - // 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js deleted file mode 100644 index f3575ba3070..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.retrieve_legacy_secret_key.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js deleted file mode 100644 index 81bb0b2abf0..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js deleted file mode 100644 index b50005c503d..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json deleted file mode 100644 index cd31d495c3e..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json +++ /dev/null @@ -1,599 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-recaptchaenterprise", - "version": "0.1.0", - "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": 73, - "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": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MigrateKey", - "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "skip_billing_check", - "type": "TYPE_BOOL" - } - ], - "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": 70, - "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": 70, - "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" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts deleted file mode 100644 index 51c11379be5..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 v1 from './v1'; -const RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; -type RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; -export {v1, RecaptchaEnterpriseServiceClient}; -export default {v1, RecaptchaEnterpriseServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 023c63fe31e..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/index.ts deleted file mode 100644 index 0d9bc262643..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts deleted file mode 100644 index 77758868250..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client.ts +++ /dev/null @@ -1,2042 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // 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 {boolean} [request.skipBillingCheck] - * Optional. If true, skips the billing check. - * A reCAPTCHA Enterprise key or migrated key behaves differently than a - * reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see - * https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid - * any disruption of your usage, we check that a billing account is present. - * If your usage of reCAPTCHA is under the free quota, you can safely skip the - * billing check and proceed with the migration. See - * https://cloud.google.com/recaptcha-enterprise/docs/billing-information. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client_config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client_config.json deleted file mode 100644 index acb5f95bd9c..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_client_config.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json deleted file mode 100644 index 790fef960af..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/src/v1/recaptcha_enterprise_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto" -] diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 3df789b6cc1..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 1ba761a963b..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts deleted file mode 100644 index 06f71913012..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/test/gapic_recaptcha_enterprise_service_v1.ts +++ /dev/null @@ -1,2384 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/tsconfig.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1/webpack.config.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1/webpack.config.js deleted file mode 100644 index 6a9d07da0f4..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.gitignore b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.jsdoc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.jsdoc.js deleted file mode 100644 index fd8d38512d4..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md deleted file mode 100644 index 57a5e168123..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/linkinator.config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json deleted file mode 100644 index 395cc28a4f8..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/recaptcha-enterprise", - "version": "0.1.0", - "description": "Recaptchaenterprise client for Node.js", - "repository": "googleapis/nodejs-recaptchaenterprise", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google recaptchaenterprise", - "recaptchaenterprise", - "recaptcha enterprise service v1 beta1" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto deleted file mode 100644 index 28a07a8e51b..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js deleted file mode 100644 index 6a17e309ad8..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js deleted file mode 100644 index dd1c7421e2f..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json deleted file mode 100644 index 521cdd71261..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-recaptchaenterprise", - "version": "0.1.0", - "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" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts deleted file mode 100644 index 6bdae5da74e..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 v1beta1 from './v1beta1'; -const RecaptchaEnterpriseServiceV1Beta1Client = v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; -type RecaptchaEnterpriseServiceV1Beta1Client = v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; -export {v1beta1, RecaptchaEnterpriseServiceV1Beta1Client}; -export default {v1beta1, RecaptchaEnterpriseServiceV1Beta1Client}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 2a7ea778505..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index 7cf779e456f..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts deleted file mode 100644 index 1bb8bd398fe..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ /dev/null @@ -1,541 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json deleted file mode 100644 index 7907ebe8f8e..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json deleted file mode 100644 index 35d2e7543ad..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto" -] diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2f544c32851..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 recaptchaEnterpriseServiceV1Beta1Client = new recaptchaenterprise.RecaptchaEnterpriseServiceV1Beta1Client(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 0214f5c8301..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 {RecaptchaEnterpriseServiceV1Beta1Client} from '@google-cloud/recaptcha-enterprise'; - -// check that the client class type name can be used -function doStuffWithRecaptchaEnterpriseServiceV1Beta1Client(client: RecaptchaEnterpriseServiceV1Beta1Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const recaptchaEnterpriseServiceV1Beta1Client = new RecaptchaEnterpriseServiceV1Beta1Client(); - doStuffWithRecaptchaEnterpriseServiceV1Beta1Client(recaptchaEnterpriseServiceV1Beta1Client); -} - -main(); diff --git a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts deleted file mode 100644 index 7562d57bc10..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/tsconfig.json b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "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/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/webpack.config.js b/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/webpack.config.js deleted file mode 100644 index a5030d63883..00000000000 --- a/owl-bot-staging/google-cloud-recaptchaenterprise/v1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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: 'RecaptchaEnterpriseServiceV1Beta1', - filename: './recaptcha-enterprise-service-v1-beta1.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/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto index 9376f342ce5..12e5852d50c 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto +++ b/packages/google-cloud-recaptchaenterprise/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -36,7 +36,8 @@ 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"; + 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) { @@ -49,7 +50,8 @@ service RecaptchaEnterpriseService { // 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) { + rpc AnnotateAssessment(AnnotateAssessmentRequest) + returns (AnnotateAssessmentResponse) { option (google.api.http) = { post: "/v1/{name=projects/*/assessments/*}:annotate" body: "*" @@ -75,7 +77,8 @@ service RecaptchaEnterpriseService { // 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) { + rpc RetrieveLegacySecretKey(RetrieveLegacySecretKeyRequest) + returns (RetrieveLegacySecretKeyResponse) { option (google.api.http) = { get: "/v1/{key=projects/*/keys/*}:retrieveLegacySecretKey" }; @@ -127,7 +130,8 @@ service RecaptchaEnterpriseService { } // List groups of related accounts. - rpc ListRelatedAccountGroups(ListRelatedAccountGroupsRequest) returns (ListRelatedAccountGroupsResponse) { + rpc ListRelatedAccountGroups(ListRelatedAccountGroupsRequest) + returns (ListRelatedAccountGroupsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*}/relatedaccountgroups" }; @@ -135,7 +139,9 @@ service RecaptchaEnterpriseService { } // Get memberships in a group of related accounts. - rpc ListRelatedAccountGroupMemberships(ListRelatedAccountGroupMembershipsRequest) returns (ListRelatedAccountGroupMembershipsResponse) { + rpc ListRelatedAccountGroupMemberships( + ListRelatedAccountGroupMembershipsRequest) + returns (ListRelatedAccountGroupMembershipsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/relatedaccountgroups/*}/memberships" }; @@ -143,7 +149,9 @@ service RecaptchaEnterpriseService { } // Search group memberships related to a given account. - rpc SearchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest) returns (SearchRelatedAccountGroupMembershipsResponse) { + rpc SearchRelatedAccountGroupMemberships( + SearchRelatedAccountGroupMembershipsRequest) + returns (SearchRelatedAccountGroupMembershipsResponse) { option (google.api.http) = { post: "/v1/{project=projects/*}/relatedaccountgroupmemberships:search" body: "*" @@ -265,12 +273,13 @@ message AnnotateAssessmentRequest { } ]; - // 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. + // 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. + // 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. @@ -282,30 +291,114 @@ message AnnotateAssessmentRequest { } // Empty response for AnnotateAssessment. -message AnnotateAssessmentResponse { +message AnnotateAssessmentResponse {} +// Information about a verification endpoint that can be used for 2FA. +message EndpointVerificationInfo { + oneof endpoint { + // Email address for which to trigger a verification request. + string email_address = 1; + + // Phone number for which to trigger a verification request. Should be given + // in E.164 format. + string phone_number = 2; + } + + // Output only. Token to provide to the client to trigger endpoint + // verification. It must be used within 15 minutes. + string request_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp of the last successful verification for the + // endpoint, if any. + google.protobuf.Timestamp last_verification_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Information about account verification, used for identity verification. +message AccountVerificationInfo { + // Result of the account verification as contained in the verdict token issued + // at the end of the verification flow. + enum Result { + // No information about the latest account verification. + RESULT_UNSPECIFIED = 0; + + // The user was successfully verified. This means the account verification + // challenge was successfully completed. + SUCCESS_USER_VERIFIED = 1; + + // The user failed the verification challenge. + ERROR_USER_NOT_VERIFIED = 2; + + // The site is not properly onboarded to use the account verification + // feature. + ERROR_SITE_ONBOARDING_INCOMPLETE = 3; + + // The recipient is not allowed for account verification. This can occur + // during integration but should not occur in production. + ERROR_RECIPIENT_NOT_ALLOWED = 4; + + // The recipient has already been sent too many verification codes in a + // short amount of time. + ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED = 5; + + // The verification flow could not be completed due to a critical internal + // error. + ERROR_CRITICAL_INTERNAL = 6; + + // The client has exceeded their two factor request quota for this period of + // time. + ERROR_CUSTOMER_QUOTA_EXHAUSTED = 7; + + // The request cannot be processed at the time because of an incident. This + // bypass can be restricted to a problematic destination email domain, a + // customer, or could affect the entire service. + ERROR_VERIFICATION_BYPASSED = 8; + + // The request parameters do not match with the token provided and cannot be + // processed. + ERROR_VERDICT_MISMATCH = 9; + } + + // Endpoints that can be used for identity verification. + repeated EndpointVerificationInfo endpoints = 1; + + // Language code preference for the verification message, set as a IETF BCP 47 + // language code. + string language_code = 3; + + // Output only. Result of the latest account verification challenge. + Result latest_verification_result = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Username of the account that is being verified. Deprecated. Customers + // should now provide the hashed account ID field in Event. + string username = 2 [deprecated = true]; } // 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. + // 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 + // 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]; + 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. @@ -326,7 +419,12 @@ message Assessment { 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]; + TokenProperties token_properties = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Account verification information for identity verification. The assessment + // event must include a token and site key to use this feature. + AccountVerificationInfo account_verification = 5; // Assessment returned by account defender when a hashed_account_id is // provided. @@ -338,28 +436,29 @@ message Assessment { } message Event { - // Optional. The user response token provided by the reCAPTCHA client-side integration - // on your site. + // 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. + // 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. + // 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. + // 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. + // 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. + // 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]; } @@ -439,6 +538,14 @@ message TokenProperties { // The hostname of the page on which the token was generated (Web keys only). string hostname = 4; + // The name of the Android package with which the token was generated (Android + // keys only). + string android_package_name = 8; + + // The ID of the iOS bundle with which the token was generated (iOS keys + // only). + string ios_bundle_id = 9; + // Action name provided at token generation. string action = 5; } @@ -518,8 +625,8 @@ message ListKeysResponse { // 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}". + // 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) = { @@ -545,9 +652,10 @@ 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]; + // 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. @@ -572,6 +680,16 @@ message MigrateKeyRequest { type: "recaptchaenterprise.googleapis.com/Key" } ]; + + // Optional. If true, skips the billing check. + // A reCAPTCHA Enterprise key or migrated key behaves differently than a + // reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see + // https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid + // any disruption of your usage, we check that a billing account is present. + // If your usage of reCAPTCHA is under the free quota, you can safely skip the + // billing check and proceed with the migration. See + // https://cloud.google.com/recaptcha-enterprise/docs/billing-information. + bool skip_billing_check = 2 [(google.api.field_behavior) = OPTIONAL]; } // The get metrics request message. @@ -785,7 +903,6 @@ message ScoreMetrics { // 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; } @@ -819,14 +936,13 @@ message ListRelatedAccountGroupMembershipsRequest { } ]; - // 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. + // 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. + // 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 @@ -846,8 +962,8 @@ message ListRelatedAccountGroupMembershipsResponse { // 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}". + // 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) = { @@ -855,14 +971,13 @@ message ListRelatedAccountGroupsRequest { } ]; - // 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. + // 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. + // 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 @@ -882,8 +997,9 @@ message ListRelatedAccountGroupsResponse { // 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}". + // 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) = { @@ -891,15 +1007,14 @@ message SearchRelatedAccountGroupMembershipsRequest { } ]; - // 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. + // 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. + // 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 @@ -995,4 +1110,4 @@ message WafSettings { // Required. The WAF feature for which this key is enabled. WafFeature waf_feature = 2 [(google.api.field_behavior) = REQUIRED]; -} +} \ No newline at end of file diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts b/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts index 819d15cf6a6..9982f333e22 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.d.ts @@ -663,6 +663,256 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of an EndpointVerificationInfo. */ + interface IEndpointVerificationInfo { + + /** EndpointVerificationInfo emailAddress */ + emailAddress?: (string|null); + + /** EndpointVerificationInfo phoneNumber */ + phoneNumber?: (string|null); + + /** EndpointVerificationInfo requestToken */ + requestToken?: (string|null); + + /** EndpointVerificationInfo lastVerificationTime */ + lastVerificationTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an EndpointVerificationInfo. */ + class EndpointVerificationInfo implements IEndpointVerificationInfo { + + /** + * Constructs a new EndpointVerificationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo); + + /** EndpointVerificationInfo emailAddress. */ + public emailAddress?: (string|null); + + /** EndpointVerificationInfo phoneNumber. */ + public phoneNumber?: (string|null); + + /** EndpointVerificationInfo requestToken. */ + public requestToken: string; + + /** EndpointVerificationInfo lastVerificationTime. */ + public lastVerificationTime?: (google.protobuf.ITimestamp|null); + + /** EndpointVerificationInfo endpoint. */ + public endpoint?: ("emailAddress"|"phoneNumber"); + + /** + * Creates a new EndpointVerificationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns EndpointVerificationInfo instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo): google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo; + + /** + * Encodes the specified EndpointVerificationInfo message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.verify|verify} messages. + * @param message EndpointVerificationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EndpointVerificationInfo message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.verify|verify} messages. + * @param message EndpointVerificationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EndpointVerificationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EndpointVerificationInfo + * @throws {Error} If the payload is not a 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.EndpointVerificationInfo; + + /** + * Decodes an EndpointVerificationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EndpointVerificationInfo + * @throws {Error} If the payload is 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.EndpointVerificationInfo; + + /** + * Verifies an EndpointVerificationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EndpointVerificationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EndpointVerificationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo; + + /** + * Creates a plain object from an EndpointVerificationInfo message. Also converts values to other types if specified. + * @param message EndpointVerificationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EndpointVerificationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EndpointVerificationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AccountVerificationInfo. */ + interface IAccountVerificationInfo { + + /** AccountVerificationInfo endpoints */ + endpoints?: (google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo[]|null); + + /** AccountVerificationInfo languageCode */ + languageCode?: (string|null); + + /** AccountVerificationInfo latestVerificationResult */ + latestVerificationResult?: (google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result|keyof typeof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result|null); + + /** AccountVerificationInfo username */ + username?: (string|null); + } + + /** Represents an AccountVerificationInfo. */ + class AccountVerificationInfo implements IAccountVerificationInfo { + + /** + * Constructs a new AccountVerificationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo); + + /** AccountVerificationInfo endpoints. */ + public endpoints: google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo[]; + + /** AccountVerificationInfo languageCode. */ + public languageCode: string; + + /** AccountVerificationInfo latestVerificationResult. */ + public latestVerificationResult: (google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result|keyof typeof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result); + + /** AccountVerificationInfo username. */ + public username: string; + + /** + * Creates a new AccountVerificationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns AccountVerificationInfo instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo): google.cloud.recaptchaenterprise.v1.AccountVerificationInfo; + + /** + * Encodes the specified AccountVerificationInfo message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.verify|verify} messages. + * @param message AccountVerificationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AccountVerificationInfo message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.verify|verify} messages. + * @param message AccountVerificationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AccountVerificationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AccountVerificationInfo + * @throws {Error} If the payload is not a 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.AccountVerificationInfo; + + /** + * Decodes an AccountVerificationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AccountVerificationInfo + * @throws {Error} If the payload is 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.AccountVerificationInfo; + + /** + * Verifies an AccountVerificationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AccountVerificationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AccountVerificationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AccountVerificationInfo; + + /** + * Creates a plain object from an AccountVerificationInfo message. Also converts values to other types if specified. + * @param message AccountVerificationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AccountVerificationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AccountVerificationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AccountVerificationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AccountVerificationInfo { + + /** Result enum. */ + enum Result { + RESULT_UNSPECIFIED = 0, + SUCCESS_USER_VERIFIED = 1, + ERROR_USER_NOT_VERIFIED = 2, + ERROR_SITE_ONBOARDING_INCOMPLETE = 3, + ERROR_RECIPIENT_NOT_ALLOWED = 4, + ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED = 5, + ERROR_CRITICAL_INTERNAL = 6, + ERROR_CUSTOMER_QUOTA_EXHAUSTED = 7, + ERROR_VERIFICATION_BYPASSED = 8, + ERROR_VERDICT_MISMATCH = 9 + } + } + /** Properties of a PrivatePasswordLeakVerification. */ interface IPrivatePasswordLeakVerification { @@ -793,6 +1043,9 @@ export namespace google { /** Assessment tokenProperties */ tokenProperties?: (google.cloud.recaptchaenterprise.v1.ITokenProperties|null); + /** Assessment accountVerification */ + accountVerification?: (google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo|null); + /** Assessment accountDefenderAssessment */ accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null); @@ -821,6 +1074,9 @@ export namespace google { /** Assessment tokenProperties. */ public tokenProperties?: (google.cloud.recaptchaenterprise.v1.ITokenProperties|null); + /** Assessment accountVerification. */ + public accountVerification?: (google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo|null); + /** Assessment accountDefenderAssessment. */ public accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null); @@ -1163,6 +1419,12 @@ export namespace google { /** TokenProperties hostname */ hostname?: (string|null); + /** TokenProperties androidPackageName */ + androidPackageName?: (string|null); + + /** TokenProperties iosBundleId */ + iosBundleId?: (string|null); + /** TokenProperties action */ action?: (string|null); } @@ -1188,6 +1450,12 @@ export namespace google { /** TokenProperties hostname. */ public hostname: string; + /** TokenProperties androidPackageName. */ + public androidPackageName: string; + + /** TokenProperties iosBundleId. */ + public iosBundleId: string; + /** TokenProperties action. */ public action: string; @@ -2106,6 +2374,9 @@ export namespace google { /** MigrateKeyRequest name */ name?: (string|null); + + /** MigrateKeyRequest skipBillingCheck */ + skipBillingCheck?: (boolean|null); } /** Represents a MigrateKeyRequest. */ @@ -2120,6 +2391,9 @@ export namespace google { /** MigrateKeyRequest name. */ public name: string; + /** MigrateKeyRequest skipBillingCheck. */ + public skipBillingCheck: boolean; + /** * Creates a new MigrateKeyRequest instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.js b/packages/google-cloud-recaptchaenterprise/protos/protos.js index 479c0761672..d4af4552589 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/protos.js +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.js @@ -1422,6 +1422,693 @@ return AnnotateAssessmentResponse; })(); + v1.EndpointVerificationInfo = (function() { + + /** + * Properties of an EndpointVerificationInfo. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IEndpointVerificationInfo + * @property {string|null} [emailAddress] EndpointVerificationInfo emailAddress + * @property {string|null} [phoneNumber] EndpointVerificationInfo phoneNumber + * @property {string|null} [requestToken] EndpointVerificationInfo requestToken + * @property {google.protobuf.ITimestamp|null} [lastVerificationTime] EndpointVerificationInfo lastVerificationTime + */ + + /** + * Constructs a new EndpointVerificationInfo. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an EndpointVerificationInfo. + * @implements IEndpointVerificationInfo + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo=} [properties] Properties to set + */ + function EndpointVerificationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EndpointVerificationInfo emailAddress. + * @member {string|null|undefined} emailAddress + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @instance + */ + EndpointVerificationInfo.prototype.emailAddress = null; + + /** + * EndpointVerificationInfo phoneNumber. + * @member {string|null|undefined} phoneNumber + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @instance + */ + EndpointVerificationInfo.prototype.phoneNumber = null; + + /** + * EndpointVerificationInfo requestToken. + * @member {string} requestToken + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @instance + */ + EndpointVerificationInfo.prototype.requestToken = ""; + + /** + * EndpointVerificationInfo lastVerificationTime. + * @member {google.protobuf.ITimestamp|null|undefined} lastVerificationTime + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @instance + */ + EndpointVerificationInfo.prototype.lastVerificationTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * EndpointVerificationInfo endpoint. + * @member {"emailAddress"|"phoneNumber"|undefined} endpoint + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @instance + */ + Object.defineProperty(EndpointVerificationInfo.prototype, "endpoint", { + get: $util.oneOfGetter($oneOfFields = ["emailAddress", "phoneNumber"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new EndpointVerificationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo} EndpointVerificationInfo instance + */ + EndpointVerificationInfo.create = function create(properties) { + return new EndpointVerificationInfo(properties); + }; + + /** + * Encodes the specified EndpointVerificationInfo message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo} message EndpointVerificationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndpointVerificationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.emailAddress != null && Object.hasOwnProperty.call(message, "emailAddress")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.emailAddress); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.phoneNumber); + if (message.requestToken != null && Object.hasOwnProperty.call(message, "requestToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.requestToken); + if (message.lastVerificationTime != null && Object.hasOwnProperty.call(message, "lastVerificationTime")) + $root.google.protobuf.Timestamp.encode(message.lastVerificationTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EndpointVerificationInfo message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEndpointVerificationInfo} message EndpointVerificationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndpointVerificationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EndpointVerificationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @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.EndpointVerificationInfo} EndpointVerificationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndpointVerificationInfo.decode = function decode(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.EndpointVerificationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.emailAddress = reader.string(); + break; + } + case 2: { + message.phoneNumber = reader.string(); + break; + } + case 3: { + message.requestToken = reader.string(); + break; + } + case 4: { + message.lastVerificationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EndpointVerificationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo} EndpointVerificationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndpointVerificationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EndpointVerificationInfo message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EndpointVerificationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.emailAddress != null && message.hasOwnProperty("emailAddress")) { + properties.endpoint = 1; + if (!$util.isString(message.emailAddress)) + return "emailAddress: string expected"; + } + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + if (properties.endpoint === 1) + return "endpoint: multiple values"; + properties.endpoint = 1; + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + } + if (message.requestToken != null && message.hasOwnProperty("requestToken")) + if (!$util.isString(message.requestToken)) + return "requestToken: string expected"; + if (message.lastVerificationTime != null && message.hasOwnProperty("lastVerificationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.lastVerificationTime); + if (error) + return "lastVerificationTime." + error; + } + return null; + }; + + /** + * Creates an EndpointVerificationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo} EndpointVerificationInfo + */ + EndpointVerificationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo(); + if (object.emailAddress != null) + message.emailAddress = String(object.emailAddress); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + if (object.requestToken != null) + message.requestToken = String(object.requestToken); + if (object.lastVerificationTime != null) { + if (typeof object.lastVerificationTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.lastVerificationTime: object expected"); + message.lastVerificationTime = $root.google.protobuf.Timestamp.fromObject(object.lastVerificationTime); + } + return message; + }; + + /** + * Creates a plain object from an EndpointVerificationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo} message EndpointVerificationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EndpointVerificationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.requestToken = ""; + object.lastVerificationTime = null; + } + if (message.emailAddress != null && message.hasOwnProperty("emailAddress")) { + object.emailAddress = message.emailAddress; + if (options.oneofs) + object.endpoint = "emailAddress"; + } + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + object.phoneNumber = message.phoneNumber; + if (options.oneofs) + object.endpoint = "phoneNumber"; + } + if (message.requestToken != null && message.hasOwnProperty("requestToken")) + object.requestToken = message.requestToken; + if (message.lastVerificationTime != null && message.hasOwnProperty("lastVerificationTime")) + object.lastVerificationTime = $root.google.protobuf.Timestamp.toObject(message.lastVerificationTime, options); + return object; + }; + + /** + * Converts this EndpointVerificationInfo to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @instance + * @returns {Object.} JSON object + */ + EndpointVerificationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EndpointVerificationInfo + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EndpointVerificationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo"; + }; + + return EndpointVerificationInfo; + })(); + + v1.AccountVerificationInfo = (function() { + + /** + * Properties of an AccountVerificationInfo. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAccountVerificationInfo + * @property {Array.|null} [endpoints] AccountVerificationInfo endpoints + * @property {string|null} [languageCode] AccountVerificationInfo languageCode + * @property {google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result|null} [latestVerificationResult] AccountVerificationInfo latestVerificationResult + * @property {string|null} [username] AccountVerificationInfo username + */ + + /** + * Constructs a new AccountVerificationInfo. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AccountVerificationInfo. + * @implements IAccountVerificationInfo + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo=} [properties] Properties to set + */ + function AccountVerificationInfo(properties) { + this.endpoints = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AccountVerificationInfo endpoints. + * @member {Array.} endpoints + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @instance + */ + AccountVerificationInfo.prototype.endpoints = $util.emptyArray; + + /** + * AccountVerificationInfo languageCode. + * @member {string} languageCode + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @instance + */ + AccountVerificationInfo.prototype.languageCode = ""; + + /** + * AccountVerificationInfo latestVerificationResult. + * @member {google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result} latestVerificationResult + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @instance + */ + AccountVerificationInfo.prototype.latestVerificationResult = 0; + + /** + * AccountVerificationInfo username. + * @member {string} username + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @instance + */ + AccountVerificationInfo.prototype.username = ""; + + /** + * Creates a new AccountVerificationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AccountVerificationInfo} AccountVerificationInfo instance + */ + AccountVerificationInfo.create = function create(properties) { + return new AccountVerificationInfo(properties); + }; + + /** + * Encodes the specified AccountVerificationInfo message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo} message AccountVerificationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccountVerificationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpoints != null && message.endpoints.length) + for (var i = 0; i < message.endpoints.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.encode(message.endpoints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.latestVerificationResult != null && Object.hasOwnProperty.call(message, "latestVerificationResult")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.latestVerificationResult); + return writer; + }; + + /** + * Encodes the specified AccountVerificationInfo message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo} message AccountVerificationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AccountVerificationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AccountVerificationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @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.AccountVerificationInfo} AccountVerificationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccountVerificationInfo.decode = function decode(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.AccountVerificationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.endpoints && message.endpoints.length)) + message.endpoints = []; + message.endpoints.push($root.google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.decode(reader, reader.uint32())); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 7: { + message.latestVerificationResult = reader.int32(); + break; + } + case 2: { + message.username = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AccountVerificationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AccountVerificationInfo} AccountVerificationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AccountVerificationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AccountVerificationInfo message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AccountVerificationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpoints != null && message.hasOwnProperty("endpoints")) { + if (!Array.isArray(message.endpoints)) + return "endpoints: array expected"; + for (var i = 0; i < message.endpoints.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.verify(message.endpoints[i]); + if (error) + return "endpoints." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.latestVerificationResult != null && message.hasOwnProperty("latestVerificationResult")) + switch (message.latestVerificationResult) { + default: + return "latestVerificationResult: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + return null; + }; + + /** + * Creates an AccountVerificationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AccountVerificationInfo} AccountVerificationInfo + */ + AccountVerificationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo(); + if (object.endpoints) { + if (!Array.isArray(object.endpoints)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.endpoints: array expected"); + message.endpoints = []; + for (var i = 0; i < object.endpoints.length; ++i) { + if (typeof object.endpoints[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.endpoints: object expected"); + message.endpoints[i] = $root.google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.fromObject(object.endpoints[i]); + } + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.latestVerificationResult) { + default: + if (typeof object.latestVerificationResult === "number") { + message.latestVerificationResult = object.latestVerificationResult; + break; + } + break; + case "RESULT_UNSPECIFIED": + case 0: + message.latestVerificationResult = 0; + break; + case "SUCCESS_USER_VERIFIED": + case 1: + message.latestVerificationResult = 1; + break; + case "ERROR_USER_NOT_VERIFIED": + case 2: + message.latestVerificationResult = 2; + break; + case "ERROR_SITE_ONBOARDING_INCOMPLETE": + case 3: + message.latestVerificationResult = 3; + break; + case "ERROR_RECIPIENT_NOT_ALLOWED": + case 4: + message.latestVerificationResult = 4; + break; + case "ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED": + case 5: + message.latestVerificationResult = 5; + break; + case "ERROR_CRITICAL_INTERNAL": + case 6: + message.latestVerificationResult = 6; + break; + case "ERROR_CUSTOMER_QUOTA_EXHAUSTED": + case 7: + message.latestVerificationResult = 7; + break; + case "ERROR_VERIFICATION_BYPASSED": + case 8: + message.latestVerificationResult = 8; + break; + case "ERROR_VERDICT_MISMATCH": + case 9: + message.latestVerificationResult = 9; + break; + } + if (object.username != null) + message.username = String(object.username); + return message; + }; + + /** + * Creates a plain object from an AccountVerificationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {google.cloud.recaptchaenterprise.v1.AccountVerificationInfo} message AccountVerificationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AccountVerificationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.endpoints = []; + if (options.defaults) { + object.username = ""; + object.languageCode = ""; + object.latestVerificationResult = options.enums === String ? "RESULT_UNSPECIFIED" : 0; + } + if (message.endpoints && message.endpoints.length) { + object.endpoints = []; + for (var j = 0; j < message.endpoints.length; ++j) + object.endpoints[j] = $root.google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo.toObject(message.endpoints[j], options); + } + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.latestVerificationResult != null && message.hasOwnProperty("latestVerificationResult")) + object.latestVerificationResult = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result[message.latestVerificationResult] === undefined ? message.latestVerificationResult : $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result[message.latestVerificationResult] : message.latestVerificationResult; + return object; + }; + + /** + * Converts this AccountVerificationInfo to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @instance + * @returns {Object.} JSON object + */ + AccountVerificationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AccountVerificationInfo + * @function getTypeUrl + * @memberof google.cloud.recaptchaenterprise.v1.AccountVerificationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AccountVerificationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.recaptchaenterprise.v1.AccountVerificationInfo"; + }; + + /** + * Result enum. + * @name google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result + * @enum {number} + * @property {number} RESULT_UNSPECIFIED=0 RESULT_UNSPECIFIED value + * @property {number} SUCCESS_USER_VERIFIED=1 SUCCESS_USER_VERIFIED value + * @property {number} ERROR_USER_NOT_VERIFIED=2 ERROR_USER_NOT_VERIFIED value + * @property {number} ERROR_SITE_ONBOARDING_INCOMPLETE=3 ERROR_SITE_ONBOARDING_INCOMPLETE value + * @property {number} ERROR_RECIPIENT_NOT_ALLOWED=4 ERROR_RECIPIENT_NOT_ALLOWED value + * @property {number} ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED=5 ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED value + * @property {number} ERROR_CRITICAL_INTERNAL=6 ERROR_CRITICAL_INTERNAL value + * @property {number} ERROR_CUSTOMER_QUOTA_EXHAUSTED=7 ERROR_CUSTOMER_QUOTA_EXHAUSTED value + * @property {number} ERROR_VERIFICATION_BYPASSED=8 ERROR_VERIFICATION_BYPASSED value + * @property {number} ERROR_VERDICT_MISMATCH=9 ERROR_VERDICT_MISMATCH value + */ + AccountVerificationInfo.Result = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESULT_UNSPECIFIED"] = 0; + values[valuesById[1] = "SUCCESS_USER_VERIFIED"] = 1; + values[valuesById[2] = "ERROR_USER_NOT_VERIFIED"] = 2; + values[valuesById[3] = "ERROR_SITE_ONBOARDING_INCOMPLETE"] = 3; + values[valuesById[4] = "ERROR_RECIPIENT_NOT_ALLOWED"] = 4; + values[valuesById[5] = "ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED"] = 5; + values[valuesById[6] = "ERROR_CRITICAL_INTERNAL"] = 6; + values[valuesById[7] = "ERROR_CUSTOMER_QUOTA_EXHAUSTED"] = 7; + values[valuesById[8] = "ERROR_VERIFICATION_BYPASSED"] = 8; + values[valuesById[9] = "ERROR_VERDICT_MISMATCH"] = 9; + return values; + })(); + + return AccountVerificationInfo; + })(); + v1.PrivatePasswordLeakVerification = (function() { /** @@ -1752,6 +2439,7 @@ * @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.IAccountVerificationInfo|null} [accountVerification] Assessment accountVerification * @property {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null} [accountDefenderAssessment] Assessment accountDefenderAssessment * @property {google.cloud.recaptchaenterprise.v1.IPrivatePasswordLeakVerification|null} [privatePasswordLeakVerification] Assessment privatePasswordLeakVerification */ @@ -1803,6 +2491,14 @@ */ Assessment.prototype.tokenProperties = null; + /** + * Assessment accountVerification. + * @member {google.cloud.recaptchaenterprise.v1.IAccountVerificationInfo|null|undefined} accountVerification + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.accountVerification = null; + /** * Assessment accountDefenderAssessment. * @member {google.cloud.recaptchaenterprise.v1.IAccountDefenderAssessment|null|undefined} accountDefenderAssessment @@ -1851,6 +2547,8 @@ $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.accountVerification != null && Object.hasOwnProperty.call(message, "accountVerification")) + $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.encode(message.accountVerification, writer.uint32(/* id 5, wireType 2 =*/42).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")) @@ -1905,6 +2603,10 @@ message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.decode(reader, reader.uint32()); break; } + case 5: { + message.accountVerification = $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.decode(reader, reader.uint32()); + break; + } case 6: { message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.decode(reader, reader.uint32()); break; @@ -1966,6 +2668,11 @@ if (error) return "tokenProperties." + error; } + if (message.accountVerification != null && message.hasOwnProperty("accountVerification")) { + var error = $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.verify(message.accountVerification); + if (error) + return "accountVerification." + error; + } if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) { var error = $root.google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.verify(message.accountDefenderAssessment); if (error) @@ -2008,6 +2715,11 @@ throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.tokenProperties: object expected"); message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.fromObject(object.tokenProperties); } + if (object.accountVerification != null) { + if (typeof object.accountVerification !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.accountVerification: object expected"); + message.accountVerification = $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.fromObject(object.accountVerification); + } if (object.accountDefenderAssessment != null) { if (typeof object.accountDefenderAssessment !== "object") throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.accountDefenderAssessment: object expected"); @@ -2039,6 +2751,7 @@ object.event = null; object.riskAnalysis = null; object.tokenProperties = null; + object.accountVerification = null; object.accountDefenderAssessment = null; object.privatePasswordLeakVerification = null; } @@ -2050,6 +2763,8 @@ 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.accountVerification != null && message.hasOwnProperty("accountVerification")) + object.accountVerification = $root.google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.toObject(message.accountVerification, 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")) @@ -2736,6 +3451,8 @@ * @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} [androidPackageName] TokenProperties androidPackageName + * @property {string|null} [iosBundleId] TokenProperties iosBundleId * @property {string|null} [action] TokenProperties action */ @@ -2786,6 +3503,22 @@ */ TokenProperties.prototype.hostname = ""; + /** + * TokenProperties androidPackageName. + * @member {string} androidPackageName + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.androidPackageName = ""; + + /** + * TokenProperties iosBundleId. + * @member {string} iosBundleId + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.iosBundleId = ""; + /** * TokenProperties action. * @member {string} action @@ -2828,6 +3561,10 @@ 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); + if (message.androidPackageName != null && Object.hasOwnProperty.call(message, "androidPackageName")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.androidPackageName); + if (message.iosBundleId != null && Object.hasOwnProperty.call(message, "iosBundleId")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.iosBundleId); return writer; }; @@ -2878,6 +3615,14 @@ message.hostname = reader.string(); break; } + case 8: { + message.androidPackageName = reader.string(); + break; + } + case 9: { + message.iosBundleId = reader.string(); + break; + } case 5: { message.action = reader.string(); break; @@ -2941,6 +3686,12 @@ if (message.hostname != null && message.hasOwnProperty("hostname")) if (!$util.isString(message.hostname)) return "hostname: string expected"; + if (message.androidPackageName != null && message.hasOwnProperty("androidPackageName")) + if (!$util.isString(message.androidPackageName)) + return "androidPackageName: string expected"; + if (message.iosBundleId != null && message.hasOwnProperty("iosBundleId")) + if (!$util.isString(message.iosBundleId)) + return "iosBundleId: string expected"; if (message.action != null && message.hasOwnProperty("action")) if (!$util.isString(message.action)) return "action: string expected"; @@ -3004,6 +3755,10 @@ } if (object.hostname != null) message.hostname = String(object.hostname); + if (object.androidPackageName != null) + message.androidPackageName = String(object.androidPackageName); + if (object.iosBundleId != null) + message.iosBundleId = String(object.iosBundleId); if (object.action != null) message.action = String(object.action); return message; @@ -3028,6 +3783,8 @@ object.createTime = null; object.hostname = ""; object.action = ""; + object.androidPackageName = ""; + object.iosBundleId = ""; } if (message.valid != null && message.hasOwnProperty("valid")) object.valid = message.valid; @@ -3039,6 +3796,10 @@ object.hostname = message.hostname; if (message.action != null && message.hasOwnProperty("action")) object.action = message.action; + if (message.androidPackageName != null && message.hasOwnProperty("androidPackageName")) + object.androidPackageName = message.androidPackageName; + if (message.iosBundleId != null && message.hasOwnProperty("iosBundleId")) + object.iosBundleId = message.iosBundleId; return object; }; @@ -4959,6 +5720,7 @@ * @memberof google.cloud.recaptchaenterprise.v1 * @interface IMigrateKeyRequest * @property {string|null} [name] MigrateKeyRequest name + * @property {boolean|null} [skipBillingCheck] MigrateKeyRequest skipBillingCheck */ /** @@ -4984,6 +5746,14 @@ */ MigrateKeyRequest.prototype.name = ""; + /** + * MigrateKeyRequest skipBillingCheck. + * @member {boolean} skipBillingCheck + * @memberof google.cloud.recaptchaenterprise.v1.MigrateKeyRequest + * @instance + */ + MigrateKeyRequest.prototype.skipBillingCheck = false; + /** * Creates a new MigrateKeyRequest instance using the specified properties. * @function create @@ -5010,6 +5780,8 @@ writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.skipBillingCheck != null && Object.hasOwnProperty.call(message, "skipBillingCheck")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.skipBillingCheck); return writer; }; @@ -5048,6 +5820,10 @@ message.name = reader.string(); break; } + case 2: { + message.skipBillingCheck = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -5086,6 +5862,9 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.skipBillingCheck != null && message.hasOwnProperty("skipBillingCheck")) + if (typeof message.skipBillingCheck !== "boolean") + return "skipBillingCheck: boolean expected"; return null; }; @@ -5103,6 +5882,8 @@ var message = new $root.google.cloud.recaptchaenterprise.v1.MigrateKeyRequest(); if (object.name != null) message.name = String(object.name); + if (object.skipBillingCheck != null) + message.skipBillingCheck = Boolean(object.skipBillingCheck); return message; }; @@ -5119,10 +5900,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.skipBillingCheck = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.skipBillingCheck != null && message.hasOwnProperty("skipBillingCheck")) + object.skipBillingCheck = message.skipBillingCheck; return object; }; diff --git a/packages/google-cloud-recaptchaenterprise/protos/protos.json b/packages/google-cloud-recaptchaenterprise/protos/protos.json index 305751757a8..30e689d5a78 100644 --- a/packages/google-cloud-recaptchaenterprise/protos/protos.json +++ b/packages/google-cloud-recaptchaenterprise/protos/protos.json @@ -342,6 +342,83 @@ "AnnotateAssessmentResponse": { "fields": {} }, + "EndpointVerificationInfo": { + "oneofs": { + "endpoint": { + "oneof": [ + "emailAddress", + "phoneNumber" + ] + } + }, + "fields": { + "emailAddress": { + "type": "string", + "id": 1 + }, + "phoneNumber": { + "type": "string", + "id": 2 + }, + "requestToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastVerificationTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "AccountVerificationInfo": { + "fields": { + "endpoints": { + "rule": "repeated", + "type": "EndpointVerificationInfo", + "id": 1 + }, + "languageCode": { + "type": "string", + "id": 3 + }, + "latestVerificationResult": { + "type": "Result", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "username": { + "type": "string", + "id": 2, + "options": { + "deprecated": true + } + } + }, + "nested": { + "Result": { + "values": { + "RESULT_UNSPECIFIED": 0, + "SUCCESS_USER_VERIFIED": 1, + "ERROR_USER_NOT_VERIFIED": 2, + "ERROR_SITE_ONBOARDING_INCOMPLETE": 3, + "ERROR_RECIPIENT_NOT_ALLOWED": 4, + "ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED": 5, + "ERROR_CRITICAL_INTERNAL": 6, + "ERROR_CUSTOMER_QUOTA_EXHAUSTED": 7, + "ERROR_VERIFICATION_BYPASSED": 8, + "ERROR_VERDICT_MISMATCH": 9 + } + } + } + }, "PrivatePasswordLeakVerification": { "fields": { "lookupHashPrefix": { @@ -406,6 +483,10 @@ "(google.api.field_behavior)": "OUTPUT_ONLY" } }, + "accountVerification": { + "type": "AccountVerificationInfo", + "id": 5 + }, "accountDefenderAssessment": { "type": "AccountDefenderAssessment", "id": 6 @@ -505,6 +586,14 @@ "type": "string", "id": 4 }, + "androidPackageName": { + "type": "string", + "id": 8 + }, + "iosBundleId": { + "type": "string", + "id": 9 + }, "action": { "type": "string", "id": 5 @@ -665,6 +754,13 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" } + }, + "skipBillingCheck": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, 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 index 24146c3cd7d..04fb366c8fa 100644 --- 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 @@ -34,13 +34,14 @@ function main(name) { */ // 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. + * 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. + * Optional. Optional reasons for the annotation that will be assigned to the + * Event. */ // const reasons = 1234 /** 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 index 097f294ce3c..523c80763c4 100644 --- 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 @@ -34,15 +34,14 @@ function main(parent) { */ // 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. + * 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. + * 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. 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 index 9be614706a0..d5edb77984c 100644 --- 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 @@ -29,20 +29,19 @@ function main(parent) { * 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}". + * 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. + * 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. + * 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. 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 index 7437784d6db..108ddc86c4e 100644 --- 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 @@ -33,6 +33,17 @@ function main(name) { * "projects/{project}/keys/{key}". */ // const name = 'abc123' + /** + * Optional. If true, skips the billing check. + * A reCAPTCHA Enterprise key or migrated key behaves differently than a + * reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see + * https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid + * any disruption of your usage, we check that a billing account is present. + * If your usage of reCAPTCHA is under the free quota, you can safely skip the + * billing check and proceed with the migration. See + * https://cloud.google.com/recaptcha-enterprise/docs/billing-information. + */ + // const skipBillingCheck = true // Imports the Recaptchaenterprise library const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; 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 index 95cb5eb22e9..f3575ba3070 100644 --- 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 @@ -29,8 +29,8 @@ function main(key) { * 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}". + * Required. The public key name linked to the requested secret key in the + * format "projects/{project}/keys/{key}". */ // const key = 'abc123' 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 index 1e85d154cb6..81bb0b2abf0 100644 --- 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 @@ -29,21 +29,21 @@ function main(project) { * 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}". + * 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. + * 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. + * 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 /** 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 index b7fc0fc86cd..b50005c503d 100644 --- 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 @@ -33,8 +33,8 @@ function main(key) { */ // 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. + * 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 = {} 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 index 8084719b40d..b4321984c71 100644 --- 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 @@ -66,7 +66,7 @@ "segments": [ { "start": 25, - "end": 72, + "end": 73, "type": "FULL" } ], @@ -374,7 +374,7 @@ "segments": [ { "start": 25, - "end": 54, + "end": 65, "type": "FULL" } ], @@ -386,6 +386,10 @@ { "name": "name", "type": "TYPE_STRING" + }, + { + "name": "skip_billing_check", + "type": "TYPE_BOOL" } ], "resultType": ".google.cloud.recaptchaenterprise.v1.Key", @@ -454,7 +458,7 @@ "segments": [ { "start": 25, - "end": 71, + "end": 70, "type": "FULL" } ], @@ -502,7 +506,7 @@ "segments": [ { "start": 25, - "end": 71, + "end": 70, "type": "FULL" } ], 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 index f4b28da6fb2..c292ed638c7 100644 --- a/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts +++ b/packages/google-cloud-recaptchaenterprise/src/v1/recaptcha_enterprise_service_client.ts @@ -121,6 +121,9 @@ export class RecaptchaEnterpriseServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // 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; @@ -480,11 +483,12 @@ export class RecaptchaEnterpriseServiceClient { * 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. + * 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. + * 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 @@ -683,8 +687,8 @@ export class RecaptchaEnterpriseServiceClient { * @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}". + * 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. @@ -879,8 +883,8 @@ export class RecaptchaEnterpriseServiceClient { * @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. + * 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. @@ -1070,6 +1074,15 @@ export class RecaptchaEnterpriseServiceClient { * @param {string} request.name * Required. The name of the key to be migrated, in the format * "projects/{project}/keys/{key}". + * @param {boolean} [request.skipBillingCheck] + * Optional. If true, skips the billing check. + * A reCAPTCHA Enterprise key or migrated key behaves differently than a + * reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see + * https://cloud.google.com/recaptcha-enterprise/quotas#quota_limit). To avoid + * any disruption of your usage, we check that a billing account is present. + * If your usage of reCAPTCHA is under the free quota, you can safely skip the + * billing check and proceed with the migration. See + * https://cloud.google.com/recaptcha-enterprise/docs/billing-information. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1452,16 +1465,15 @@ export class RecaptchaEnterpriseServiceClient { * @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}". + * 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. + * 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. + * 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 @@ -1563,16 +1575,15 @@ export class RecaptchaEnterpriseServiceClient { * @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}". + * 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. + * 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. + * 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 @@ -1618,16 +1629,15 @@ export class RecaptchaEnterpriseServiceClient { * @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}". + * 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. + * 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. + * 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 @@ -1675,13 +1685,12 @@ export class RecaptchaEnterpriseServiceClient { * 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. + * 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. + * 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 @@ -1786,13 +1795,12 @@ export class RecaptchaEnterpriseServiceClient { * 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. + * 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. + * 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 @@ -1842,13 +1850,12 @@ export class RecaptchaEnterpriseServiceClient { * 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. + * 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. + * 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 @@ -1894,17 +1901,17 @@ export class RecaptchaEnterpriseServiceClient { * @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}". + * 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. + * 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. + * 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 @@ -2010,17 +2017,17 @@ export class RecaptchaEnterpriseServiceClient { * @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}". + * 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. + * 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. + * 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 @@ -2071,17 +2078,17 @@ export class RecaptchaEnterpriseServiceClient { * @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}". + * 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. + * 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. + * 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 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 index be347ee16e4..744ed5f3d35 100644 --- 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 @@ -119,6 +119,9 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // 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;