From 14b8ac1f1137dba700b1940009c26e650d225877 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 4 May 2022 19:48:47 +0000 Subject: [PATCH 1/2] fix!: rename parent to project in SearchRelatedAccountGroupMembershipsRequest feat: introduced WafSettings PiperOrigin-RevId: 446496512 Source-Link: https://github.com/googleapis/googleapis/commit/63d4fbab332b66071ebfb06ad6c0d682271962d1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f168b29e44d1d09bc407e8ef09587b7c8fcfe622 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjE2OGIyOWU0NGQxZDA5YmM0MDdlOGVmMDk1ODdiN2M4ZmNmZTYyMiJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../v1/recaptchaenterprise.proto | 919 ++++++++ ..._enterprise_service.annotate_assessment.js | 77 + ...ha_enterprise_service.create_assessment.js | 64 + ...recaptcha_enterprise_service.create_key.js | 64 + ...recaptcha_enterprise_service.delete_key.js | 59 + .../recaptcha_enterprise_service.get_key.js | 59 + ...ecaptcha_enterprise_service.get_metrics.js | 59 + .../recaptcha_enterprise_service.list_keys.js | 71 + ....list_related_account_group_memberships.js | 76 + ...ise_service.list_related_account_groups.js | 76 + ...ecaptcha_enterprise_service.migrate_key.js | 59 + ...earch_related_account_group_memberships.js | 83 + ...recaptcha_enterprise_service.update_key.js | 63 + ...a.google.cloud.recaptchaenterprise.v1.json | 555 +++++ owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 159 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../v1/recaptcha_enterprise_service_client.ts | 1952 +++++++++++++++ ...tcha_enterprise_service_client_config.json | 81 + ...captcha_enterprise_service_proto_list.json | 3 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../gapic_recaptcha_enterprise_service_v1.ts | 2085 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1beta1/.eslintignore | 7 + owl-bot-staging/v1beta1/.eslintrc.json | 3 + owl-bot-staging/v1beta1/.gitignore | 14 + owl-bot-staging/v1beta1/.jsdoc.js | 55 + owl-bot-staging/v1beta1/.mocharc.js | 33 + owl-bot-staging/v1beta1/.prettierrc.js | 22 + owl-bot-staging/v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 16 + owl-bot-staging/v1beta1/package.json | 64 + .../v1beta1/recaptchaenterprise.proto | 350 +++ ...se_service_v1_beta1.annotate_assessment.js | 77 + ...rise_service_v1_beta1.create_assessment.js | 64 + ...gle.cloud.recaptchaenterprise.v1beta1.json | 111 + owl-bot-staging/v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 43 + owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 + ...tcha_enterprise_service_v1_beta1_client.ts | 527 +++++ ...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 | 400 ++++ owl-bot-staging/v1beta1/tsconfig.json | 19 + owl-bot-staging/v1beta1/webpack.config.js | 64 + 60 files changed, 9075 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_recaptcha_enterprise_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v1beta1/.eslintignore create mode 100644 owl-bot-staging/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1beta1/.gitignore create mode 100644 owl-bot-staging/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1beta1/README.md create mode 100644 owl-bot-staging/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1beta1/package.json create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json create mode 100644 owl-bot-staging/v1beta1/src/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts create mode 100644 owl-bot-staging/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/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/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..fd8d385 --- /dev/null +++ b/owl-bot-staging/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/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/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/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/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/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..57a5e16 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/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/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..ed347e9 --- /dev/null +++ b/owl-bot-staging/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/", + "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": "^2.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto new file mode 100644 index 0000000..7cf8073 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -0,0 +1,919 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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 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 the 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 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}/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. 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 { + +} + +// A recaptcha assessment resource. +message Assessment { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/Assessment" + pattern: "projects/{project}/assessments/{assessment}" + }; + + // Output only. The resource name for the Assessment in the format + // "projects/{project}/assessments/{assessment}". + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The event being assessed. + Event event = 2; + + // Output only. The risk analysis result for the event being assessed. + RiskAnalysis risk_analysis = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Properties of the provided event token. + TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Assessment returned by Account Defender when a hashed_account_id is + // provided. + AccountDefenderAssessment account_defender_assessment = 6; +} + +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]; +} + +// 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. + 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; +} + +// 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 get key request message. +message GetKeyRequest { + // Required. The name of the requested key, in the format + // "projects/{project}/keys/{key}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + +// The update key request message. +message UpdateKeyRequest { + // Required. The key to update. + Key key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields of the key get updated. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The delete key request message. +message DeleteKeyRequest { + // Required. The name of the key to be deleted, in the format + // "projects/{project}/keys/{key}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + +// The migrate key request message. +message MigrateKeyRequest { + // Required. The name of the key to be migrated, in the format + // "projects/{project}/keys/{key}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Key" + } + ]; +} + +// The get metrics request message. +message GetMetricsRequest { + // Required. The name of the requested metrics, in the format + // "projects/{project}/keys/{key}/metrics". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/Metrics" + } + ]; +} + +// Metrics for a single Key. +message Metrics { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/Metrics" + pattern: "projects/{project}/keys/{key}/metrics" + }; + + // Output only. The name of the metrics, in the format + // "projects/{project}/keys/{key}/metrics". + string name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Inclusive start time aligned to a day (UTC). + google.protobuf.Timestamp start_time = 1; + + // Metrics will be continuous and in order by dates, and in the granularity + // of day. All Key types should have score-based data. + repeated ScoreMetrics score_metrics = 2; + + // Metrics will be continuous and in order by dates, and in the granularity + // of day. Only challenge-based keys (CHECKBOX, INVISIBLE), will have + // challenge-based data. + repeated ChallengeMetrics challenge_metrics = 3; +} + +// 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 one + // platform, the one it has settings for. + oneof platform_settings { + // Settings for keys that can be used by websites. + WebKeySettings web_settings = 3; + + // Settings for keys that can be used by Android apps. + AndroidKeySettings android_settings = 4; + + // Settings for keys that can be used by iOS apps. + IOSKeySettings ios_settings = 5; + } + + // See + // Creating and managing labels. + map labels = 6; + + // The timestamp corresponding to the creation of this Key. + google.protobuf.Timestamp create_time = 7; + + // Options for user acceptance testing. + TestingOptions testing_options = 9; + + // Settings for WAF + WafSettings waf_settings = 10; +} + +// Options for user acceptance testing. +message TestingOptions { + // Enum that represents the challenge option for challenge-based (CHECKBOX, + // INVISIBLE) testing keys. + enum TestingChallenge { + // Perform the normal risk analysis and return either nocaptcha or a + // challenge depending on risk and trust factors. + TESTING_CHALLENGE_UNSPECIFIED = 0; + + // Challenge requests for this key always return a nocaptcha, which + // does not require a solution. + NOCAPTCHA = 1; + + // Challenge requests for this key always return an unsolvable + // challenge. + UNSOLVABLE_CHALLENGE = 2; + } + + // All assessments for this Key will return this score. Must be between 0 + // (likely not legitimate) and 1 (likely legitimate) inclusive. + float testing_score = 1; + + // For challenge-based keys only (CHECKBOX, INVISIBLE), all challenge requests + // for this site will return nocaptcha if NOCAPTCHA, or an unsolvable + // challenge if CHALLENGE. + TestingChallenge testing_challenge = 2; +} + +// Settings specific to keys that can be used by websites. +message WebKeySettings { + // Enum that represents the integration types for web keys. + enum IntegrationType { + // Default type that indicates this enum hasn't been specified. This is not + // a valid IntegrationType, one of the other types must be specified + // instead. + INTEGRATION_TYPE_UNSPECIFIED = 0; + + // Only used to produce scores. It doesn't display the "I'm not a robot" + // checkbox and never shows captcha challenges. + SCORE = 1; + + // Displays the "I'm not a robot" checkbox and may show captcha challenges + // after it is checked. + CHECKBOX = 2; + + // Doesn't display the "I'm not a robot" checkbox, but may show captcha + // challenges after risk analysis. + INVISIBLE = 3; + } + + // Enum that represents the possible challenge frequency and difficulty + // configurations for a web key. + enum ChallengeSecurityPreference { + // Default type that indicates this enum hasn't been specified. + CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0; + + // Key tends to show fewer and easier challenges. + USABILITY = 1; + + // Key tends to show balanced (in amount and difficulty) challenges. + BALANCE = 2; + + // Key tends to show more and harder challenges. + SECURITY = 3; + } + + // If set to true, it means allowed_domains will not be enforced. + bool allow_all_domains = 3; + + // Domains or subdomains of websites allowed to use the key. All subdomains + // of an allowed domain are automatically allowed. A valid domain requires a + // host and must not include any path, port, query or fragment. + // Examples: 'example.com' or 'subdomain.example.com' + repeated string allowed_domains = 1; + + // If set to true, the key can be used on AMP (Accelerated Mobile Pages) + // websites. This is supported only for the SCORE integration type. + bool allow_amp_traffic = 2; + + // Required. Describes how this key is integrated with the website. + IntegrationType integration_type = 4 [(google.api.field_behavior) = REQUIRED]; + + // Settings for the frequency and difficulty at which this key triggers + // captcha challenges. This should only be specified for IntegrationTypes + // CHECKBOX and INVISIBLE. + ChallengeSecurityPreference challenge_security_preference = 5; +} + +// Settings specific to keys that can be used by Android apps. +message AndroidKeySettings { + // If set to true, allowed_package_names are not enforced. + bool allow_all_package_names = 2; + + // Android package names of apps allowed to use the key. + // Example: 'com.companyname.appname' + repeated string allowed_package_names = 1; +} + +// Settings specific to keys that can be used by iOS apps. +message IOSKeySettings { + // If set to true, allowed_bundle_ids are not enforced. + bool allow_all_bundle_ids = 2; + + // iOS bundle ids of apps allowed to use the key. + // Example: 'com.companyname.productname.appname' + repeated string allowed_bundle_ids = 1; +} + +// Score distribution. +message ScoreDistribution { + // Map key is score value multiplied by 100. The scores are discrete values + // between [0, 1]. The maximum number of buckets is on order of a few dozen, + // but typically much lower (ie. 10). + map score_buckets = 1; +} + +// Metrics related to scoring. +message ScoreMetrics { + // Aggregated score metrics for all traffic. + ScoreDistribution overall_metrics = 1; + + // Action-based metrics. The map key is the action name which specified by the + // site owners at time of the "execute" client-side call. + // Populated only for SCORE keys. + map action_metrics = 2; +} + +// Metrics related to challenges. +message ChallengeMetrics { + // Count of reCAPTCHA checkboxes or badges rendered. This is mostly equivalent + // to a count of pageloads for pages that include reCAPTCHA. + int64 pageload_count = 1; + + // Count of nocaptchas (successful verification without a challenge) issued. + int64 nocaptcha_count = 2; + + // Count of submitted challenge solutions that were incorrect or otherwise + // deemed suspicious such that a subsequent challenge was triggered. + int64 failed_count = 3; + + // Count of nocaptchas (successful verification without a challenge) plus + // submitted challenge solutions that were correct and resulted in + // verification. + int64 passed_count = 4; +} + +// The request message to list memberships in a related account group. +message ListRelatedAccountGroupMembershipsRequest { + // Required. The resource name for the related account group in the format + // `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + ]; + + // Optional. The maximum number of accounts to return. The service may return fewer than + // this value. + // If unspecified, at most 50 accounts will be returned. + // The maximum value is 1000; values above 1000 will be 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 may return fewer than + // this value. + // If unspecified, at most 50 groups will be returned. + // The maximum value is 1000; values above 1000 will be 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, + // in the 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 may return fewer than + // this value. + // If unspecified, at most 50 groups will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous + // `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the + // subsequent page. + // + // When paginating, all other parameters provided to + // `SearchRelatedAccountGroupMemberships` must match the call that provided + // the page token. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response to a `SearchRelatedAccountGroupMemberships` call. +message SearchRelatedAccountGroupMembershipsResponse { + // The queried memberships. + repeated RelatedAccountGroupMembership related_account_group_memberships = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// A membership in a group of related accounts. +message RelatedAccountGroupMembership { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}" + }; + + // Required. The resource name for this membership in the format + // `projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" + } + ]; + + // The unique stable hashed user identifier of the member. The identifier + // corresponds to a `hashed_account_id` provided in a previous + // CreateAssessment or AnnotateAssessment call. + bytes hashed_account_id = 2; +} + +// A group of related accounts. +message RelatedAccountGroup { + option (google.api.resource) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup" + pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}" + }; + + // Required. The resource name for the related account group in the format + // `projects/{project}/relatedaccountgroups/{related_account_group}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup" + } + ]; +} + +// Settings specific to keys that can be used for WAF (Web Application +// Firewall). +message WafSettings { + // Supported WAF features. For more information, see + // https://cloud.google.com/recaptcha-enterprise/docs/usecase#comparison_of_features. + enum WafFeature { + // Undefined feature. + WAF_FEATURE_UNSPECIFIED = 0; + + // Redirects suspicious traffic to reCAPTCHA. + CHALLENGE_PAGE = 1; + + // Use reCAPTCHA session-tokens to protect the whole user session on the + // site's domain. + SESSION_TOKEN = 2; + + // Use reCAPTCHA action-tokens to protect user actions. + ACTION_TOKEN = 3; + } + + // Web Application Firewalls supported by reCAPTCHA Enterprise. + enum WafService { + // Undefined WAF + WAF_SERVICE_UNSPECIFIED = 0; + + // Cloud Armor + CA = 1; + } + + // Required. The WAF service that uses this key. + WafService waf_service = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The WAF feature for which this key is enabled. + WafFeature waf_feature = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js new file mode 100644 index 0000000..0ed78fb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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] + /** + * 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. 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/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js new file mode 100644 index 0000000..62cadd8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, assessment) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateAssessment_async] + /** + * 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/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js new file mode 100644 index 0000000..3a016b1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, key) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateKey_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project in which the key will be created, in the + * format "projects/{project}". + */ + // 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/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js new file mode 100644 index 0000000..4450343 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_DeleteKey_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the key to be deleted, in the format + * "projects/{project}/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/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js new file mode 100644 index 0000000..bc0923e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetKey_async] + /** + * 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/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js new file mode 100644 index 0000000..8f8c24e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_async] + /** + * 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/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js new file mode 100644 index 0000000..2f69a5e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListKeys_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project that contains the keys that will be + * listed, in the format "projects/{project}". + */ + // 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/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js new file mode 100644 index 0000000..c2853cd --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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] + /** + * 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 may return fewer than + * this value. + * If unspecified, at most 50 accounts will be returned. + * The maximum value is 1000; values above 1000 will be 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/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js new file mode 100644 index 0000000..c497252 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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] + /** + * 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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js new file mode 100644 index 0000000..1630b4e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the key to be migrated, in the format + * "projects/{project}/keys/{key}". + */ + // const name = 'abc123' + + // Imports the Recaptchaenterprise library + const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; + + // Instantiates a client + const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); + + async function callMigrateKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await recaptchaenterpriseClient.migrateKey(request); + console.log(response); + } + + callMigrateKey(); + // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js new file mode 100644 index 0000000..863ac5b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js @@ -0,0 +1,83 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(project) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_SearchRelatedAccountGroupMemberships_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project to search related account group memberships from, + * in the 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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js new file mode 100644 index 0000000..b4c91cd --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(key) { + // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_UpdateKey_async] + /** + * 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/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json new file mode 100644 index 0000000..f430286 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json @@ -0,0 +1,555 @@ +{ + "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": 56, + "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": 69, + "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": 56, + "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": 63, + "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_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": 51, + "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": 55, + "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": 51, + "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": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MigrateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.recaptchaenterprise.v1.Key", + "client": { + "shortName": "RecaptchaEnterpriseServiceClient", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" + }, + "method": { + "shortName": "MigrateKey", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", + "service": { + "shortName": "RecaptchaEnterpriseService", + "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" + } + } + } + }, + { + "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_async", + "title": "RecaptchaEnterpriseService getMetrics Sample", + "origin": "API_DEFINITION", + "description": " Get some aggregated metrics for a Key. This data can be used to build dashboards.", + "canonical": true, + "file": "recaptcha_enterprise_service.get_metrics.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "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": 68, + "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 the 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": 68, + "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": 75, + "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/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..51c1137 --- /dev/null +++ b/owl-bot-staging/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/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..09321f2 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,159 @@ +{ + "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" + ] + }, + "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" + ] + }, + "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/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..0d9bc26 --- /dev/null +++ b/owl-bot-staging/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/v1/src/v1/recaptcha_enterprise_service_client.ts b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client.ts new file mode 100644 index 0000000..8787c41 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client.ts @@ -0,0 +1,1952 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * 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/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof RecaptchaEnterpriseServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // 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 = gax.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', '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.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' + ] = gax.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. 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' + ] = gax.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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createKey(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' + ] = gax.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' + ] = gax.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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteKey(request, options, callback); + } +/** + * Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. + * Once a key is migrated, it can be used from either product. SiteVerify + * requests are billed as CreateAssessment calls. You must be + * authenticated as one of the current owners of the reCAPTCHA Site Key, and + * your user must have the reCAPTCHA Enterprise Admin IAM role in the + * destination project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the key to be migrated, in the format + * "projects/{project}/keys/{key}". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/recaptcha_enterprise_service.migrate_key.js + * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async + */ + migrateKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|undefined, {}|undefined + ]>; + migrateKey( + request: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, + {}|null|undefined>): void; + migrateKey( + request: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + callback: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, + {}|null|undefined>): void; + migrateKey( + request?: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.recaptchaenterprise.v1.IKey, + protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.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' + ] = gax.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' + ] = gax.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' + ] = gax.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 gax.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' + ] = gax.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 unknown as RequestType, + 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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 gax.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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Get the 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 may return fewer than + * this value. + * If unspecified, at most 50 accounts will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 may return fewer than + * this value. + * If unspecified, at most 50 accounts will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 gax.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 may return fewer than + * this value. + * If unspecified, at most 50 accounts will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 unknown as RequestType, + 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, + * in the 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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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, + * in the 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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 gax.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, + * in the 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 may return fewer than + * this value. + * If unspecified, at most 50 groups will be returned. + * The maximum value is 1000; values above 1000 will be 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' + ] = gax.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 unknown as RequestType, + 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/v1/src/v1/recaptcha_enterprise_service_client_config.json b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client_config.json new file mode 100644 index 0000000..66fe297 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client_config.json @@ -0,0 +1,81 @@ +{ + "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" + }, + "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/v1/src/v1/recaptcha_enterprise_service_proto_list.json b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_proto_list.json new file mode 100644 index 0000000..790fef9 --- /dev/null +++ b/owl-bot-staging/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/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..3df789b --- /dev/null +++ b/owl-bot-staging/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/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..1ba761a --- /dev/null +++ b/owl-bot-staging/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/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/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/v1/test/gapic_recaptcha_enterprise_service_v1.ts b/owl-bot-staging/v1/test/gapic_recaptcha_enterprise_service_v1.ts new file mode 100644 index 0000000..8fb0f47 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_recaptcha_enterprise_service_v1.ts @@ -0,0 +1,2085 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; + +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', () => { + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAssessment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAssessment(request), expectedError); + assert((client.innerApiCalls.createAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.annotateAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.annotateAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.annotateAssessment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.annotateAssessment(request), expectedError); + assert((client.innerApiCalls.annotateAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createKey(request), expectedError); + assert((client.innerApiCalls.createKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKey(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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getKey(request), expectedError); + assert((client.innerApiCalls.getKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + 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 = {}; + request.key.name = ''; + const expectedHeaderRequestParams = "key.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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 = {}; + request.key.name = ''; + const expectedHeaderRequestParams = "key.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.updateKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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 = {}; + request.key.name = ''; + const expectedHeaderRequestParams = "key.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateKey(request), expectedError); + assert((client.innerApiCalls.updateKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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 = {}; + request.key.name = ''; + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteKey = stubSimpleCall(expectedResponse); + const [response] = await client.deleteKey(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.deleteKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteKey(request), expectedError); + assert((client.innerApiCalls.deleteKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.migrateKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.migrateKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.migrateKey = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.migrateKey(request), expectedError); + assert((client.innerApiCalls.migrateKey as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getMetrics as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.getMetrics as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetrics = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMetrics(request), expectedError); + assert((client.innerApiCalls.getMetrics as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.listKeys as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.listKeys as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listKeys = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listKeys(request), expectedError); + assert((client.innerApiCalls.listKeys as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listKeys.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";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.strictEqual( + (client.descriptors.page.listKeys.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.listRelatedAccountGroups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.listRelatedAccountGroups as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listRelatedAccountGroups = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRelatedAccountGroups(request), expectedError); + assert((client.innerApiCalls.listRelatedAccountGroups as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listRelatedAccountGroups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listRelatedAccountGroups.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listRelatedAccountGroups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";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.strictEqual( + (client.descriptors.page.listRelatedAccountGroups.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listRelatedAccountGroupMemberships = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRelatedAccountGroupMemberships(request), expectedError); + assert((client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listRelatedAccountGroupMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listRelatedAccountGroupMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.strictEqual( + (client.descriptors.page.listRelatedAccountGroupMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";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.strictEqual( + (client.descriptors.page.listRelatedAccountGroupMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.project = ''; + const expectedHeaderRequestParams = "project="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.project = ''; + const expectedHeaderRequestParams = "project="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.project = ''; + const expectedHeaderRequestParams = "project="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchRelatedAccountGroupMemberships = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchRelatedAccountGroupMemberships(request), expectedError); + assert((client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.project = ''; + const expectedHeaderRequestParams = "project="; + 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.strictEqual( + (client.descriptors.page.searchRelatedAccountGroupMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.project = ''; + const expectedHeaderRequestParams = "project="; + 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.strictEqual( + (client.descriptors.page.searchRelatedAccountGroupMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.project = ''; + const expectedHeaderRequestParams = "project="; + 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.strictEqual( + (client.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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()); + request.project = ''; + const expectedHeaderRequestParams = "project=";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.strictEqual( + (client.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + 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/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/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/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..6a9d07d --- /dev/null +++ b/owl-bot-staging/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/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js new file mode 100644 index 0000000..fd8d385 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md new file mode 100644 index 0000000..57a5e16 --- /dev/null +++ b/owl-bot-staging/v1beta1/README.md @@ -0,0 +1 @@ +Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/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/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json new file mode 100644 index 0000000..539c5e4 --- /dev/null +++ b/owl-bot-staging/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/", + "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": "^2.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto b/owl-bot-staging/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto new file mode 100644 index 0000000..28a07a8 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js new file mode 100644 index 0000000..969aa7f --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js @@ -0,0 +1,77 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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] + /** + * 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/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js new file mode 100644 index 0000000..b0ceb63 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, assessment) { + // [START recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateAssessment_async] + /** + * 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/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json new file mode 100644 index 0000000..954b534 --- /dev/null +++ b/owl-bot-staging/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": 56, + "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": 69, + "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/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 0000000..6bdae5d --- /dev/null +++ b/owl-bot-staging/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/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 0000000..2a7ea77 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts new file mode 100644 index 0000000..7cf779e --- /dev/null +++ b/owl-bot-staging/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/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts new file mode 100644 index 0000000..00958cd --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -0,0 +1,527 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} 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/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof RecaptchaEnterpriseServiceV1Beta1Client; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // 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 = gax.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.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' + ] = gax.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' + ] = gax.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/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json new file mode 100644 index 0000000..7907ebe --- /dev/null +++ b/owl-bot-staging/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/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json new file mode 100644 index 0000000..35d2e75 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..2f544c3 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..0214f5c --- /dev/null +++ b/owl-bot-staging/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/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts new file mode 100644 index 0000000..7f1a3c8 --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts @@ -0,0 +1,400 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; + +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', () => { + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.createAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAssessment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createAssessment(request), expectedError); + assert((client.innerApiCalls.createAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.parent = ''; + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.annotateAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert((client.innerApiCalls.annotateAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + 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()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.annotateAssessment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.annotateAssessment(request), expectedError); + assert((client.innerApiCalls.annotateAssessment as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + 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()); + request.name = ''; + 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/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/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/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js new file mode 100644 index 0000000..a5030d6 --- /dev/null +++ b/owl-bot-staging/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 83c339353c5a1b84930c2ede38bcf3327168c723 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 4 May 2022 19:50:24 +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 --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../v1/recaptchaenterprise.proto | 919 -------- ..._enterprise_service.annotate_assessment.js | 77 - ...ha_enterprise_service.create_assessment.js | 64 - ...recaptcha_enterprise_service.create_key.js | 64 - ...recaptcha_enterprise_service.delete_key.js | 59 - .../recaptcha_enterprise_service.get_key.js | 59 - ...ecaptcha_enterprise_service.get_metrics.js | 59 - .../recaptcha_enterprise_service.list_keys.js | 71 - ....list_related_account_group_memberships.js | 76 - ...ise_service.list_related_account_groups.js | 76 - ...ecaptcha_enterprise_service.migrate_key.js | 59 - ...earch_related_account_group_memberships.js | 83 - ...recaptcha_enterprise_service.update_key.js | 63 - ...a.google.cloud.recaptchaenterprise.v1.json | 555 ----- owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 159 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../v1/recaptcha_enterprise_service_client.ts | 1952 --------------- ...tcha_enterprise_service_client_config.json | 81 - ...captcha_enterprise_service_proto_list.json | 3 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../gapic_recaptcha_enterprise_service_v1.ts | 2085 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1beta1/.eslintignore | 7 - owl-bot-staging/v1beta1/.eslintrc.json | 3 - owl-bot-staging/v1beta1/.gitignore | 14 - owl-bot-staging/v1beta1/.jsdoc.js | 55 - owl-bot-staging/v1beta1/.mocharc.js | 33 - owl-bot-staging/v1beta1/.prettierrc.js | 22 - owl-bot-staging/v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 16 - owl-bot-staging/v1beta1/package.json | 64 - .../v1beta1/recaptchaenterprise.proto | 350 --- ...se_service_v1_beta1.annotate_assessment.js | 77 - ...rise_service_v1_beta1.create_assessment.js | 64 - ...gle.cloud.recaptchaenterprise.v1beta1.json | 111 - owl-bot-staging/v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 43 - owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 - ...tcha_enterprise_service_v1_beta1_client.ts | 527 ----- ...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 | 400 ---- owl-bot-staging/v1beta1/tsconfig.json | 19 - owl-bot-staging/v1beta1/webpack.config.js | 64 - .../v1/recaptchaenterprise.proto | 57 +- protos/protos.d.ts | 127 +- protos/protos.js | 335 ++- protos/protos.json | 48 +- ...earch_related_account_group_memberships.js | 6 +- ...a.google.cloud.recaptchaenterprise.v1.json | 2 +- src/v1/recaptcha_enterprise_service_client.ts | 12 +- test/gapic_recaptcha_enterprise_service_v1.ts | 28 +- 68 files changed, 558 insertions(+), 9132 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_recaptcha_enterprise_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta1/.gitignore delete mode 100644 owl-bot-staging/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta1/README.md delete mode 100644 owl-bot-staging/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta1/package.json delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json delete mode 100644 owl-bot-staging/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts delete mode 100644 owl-bot-staging/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/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/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index fd8d385..0000000 --- a/owl-bot-staging/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/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/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/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/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/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 57a5e16..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/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/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index ed347e9..0000000 --- a/owl-bot-staging/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/", - "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": "^2.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto deleted file mode 100644 index 7cf8073..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto +++ /dev/null @@ -1,919 +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 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 the 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 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}/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. 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 { - -} - -// A recaptcha assessment resource. -message Assessment { - option (google.api.resource) = { - type: "recaptchaenterprise.googleapis.com/Assessment" - pattern: "projects/{project}/assessments/{assessment}" - }; - - // Output only. The resource name for the Assessment in the format - // "projects/{project}/assessments/{assessment}". - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The event being assessed. - Event event = 2; - - // Output only. The risk analysis result for the event being assessed. - RiskAnalysis risk_analysis = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Properties of the provided event token. - TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Assessment returned by Account Defender when a hashed_account_id is - // provided. - AccountDefenderAssessment account_defender_assessment = 6; -} - -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]; -} - -// 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. - 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; -} - -// 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 get key request message. -message GetKeyRequest { - // Required. The name of the requested key, in the format - // "projects/{project}/keys/{key}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "recaptchaenterprise.googleapis.com/Key" - } - ]; -} - -// The update key request message. -message UpdateKeyRequest { - // Required. The key to update. - Key key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The mask to control which fields of the key get updated. If the mask is not - // present, all fields will be updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The delete key request message. -message DeleteKeyRequest { - // Required. The name of the key to be deleted, in the format - // "projects/{project}/keys/{key}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "recaptchaenterprise.googleapis.com/Key" - } - ]; -} - -// The migrate key request message. -message MigrateKeyRequest { - // Required. The name of the key to be migrated, in the format - // "projects/{project}/keys/{key}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "recaptchaenterprise.googleapis.com/Key" - } - ]; -} - -// The get metrics request message. -message GetMetricsRequest { - // Required. The name of the requested metrics, in the format - // "projects/{project}/keys/{key}/metrics". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "recaptchaenterprise.googleapis.com/Metrics" - } - ]; -} - -// Metrics for a single Key. -message Metrics { - option (google.api.resource) = { - type: "recaptchaenterprise.googleapis.com/Metrics" - pattern: "projects/{project}/keys/{key}/metrics" - }; - - // Output only. The name of the metrics, in the format - // "projects/{project}/keys/{key}/metrics". - string name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Inclusive start time aligned to a day (UTC). - google.protobuf.Timestamp start_time = 1; - - // Metrics will be continuous and in order by dates, and in the granularity - // of day. All Key types should have score-based data. - repeated ScoreMetrics score_metrics = 2; - - // Metrics will be continuous and in order by dates, and in the granularity - // of day. Only challenge-based keys (CHECKBOX, INVISIBLE), will have - // challenge-based data. - repeated ChallengeMetrics challenge_metrics = 3; -} - -// 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 one - // platform, the one it has settings for. - oneof platform_settings { - // Settings for keys that can be used by websites. - WebKeySettings web_settings = 3; - - // Settings for keys that can be used by Android apps. - AndroidKeySettings android_settings = 4; - - // Settings for keys that can be used by iOS apps. - IOSKeySettings ios_settings = 5; - } - - // See - // Creating and managing labels. - map labels = 6; - - // The timestamp corresponding to the creation of this Key. - google.protobuf.Timestamp create_time = 7; - - // Options for user acceptance testing. - TestingOptions testing_options = 9; - - // Settings for WAF - WafSettings waf_settings = 10; -} - -// Options for user acceptance testing. -message TestingOptions { - // Enum that represents the challenge option for challenge-based (CHECKBOX, - // INVISIBLE) testing keys. - enum TestingChallenge { - // Perform the normal risk analysis and return either nocaptcha or a - // challenge depending on risk and trust factors. - TESTING_CHALLENGE_UNSPECIFIED = 0; - - // Challenge requests for this key always return a nocaptcha, which - // does not require a solution. - NOCAPTCHA = 1; - - // Challenge requests for this key always return an unsolvable - // challenge. - UNSOLVABLE_CHALLENGE = 2; - } - - // All assessments for this Key will return this score. Must be between 0 - // (likely not legitimate) and 1 (likely legitimate) inclusive. - float testing_score = 1; - - // For challenge-based keys only (CHECKBOX, INVISIBLE), all challenge requests - // for this site will return nocaptcha if NOCAPTCHA, or an unsolvable - // challenge if CHALLENGE. - TestingChallenge testing_challenge = 2; -} - -// Settings specific to keys that can be used by websites. -message WebKeySettings { - // Enum that represents the integration types for web keys. - enum IntegrationType { - // Default type that indicates this enum hasn't been specified. This is not - // a valid IntegrationType, one of the other types must be specified - // instead. - INTEGRATION_TYPE_UNSPECIFIED = 0; - - // Only used to produce scores. It doesn't display the "I'm not a robot" - // checkbox and never shows captcha challenges. - SCORE = 1; - - // Displays the "I'm not a robot" checkbox and may show captcha challenges - // after it is checked. - CHECKBOX = 2; - - // Doesn't display the "I'm not a robot" checkbox, but may show captcha - // challenges after risk analysis. - INVISIBLE = 3; - } - - // Enum that represents the possible challenge frequency and difficulty - // configurations for a web key. - enum ChallengeSecurityPreference { - // Default type that indicates this enum hasn't been specified. - CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0; - - // Key tends to show fewer and easier challenges. - USABILITY = 1; - - // Key tends to show balanced (in amount and difficulty) challenges. - BALANCE = 2; - - // Key tends to show more and harder challenges. - SECURITY = 3; - } - - // If set to true, it means allowed_domains will not be enforced. - bool allow_all_domains = 3; - - // Domains or subdomains of websites allowed to use the key. All subdomains - // of an allowed domain are automatically allowed. A valid domain requires a - // host and must not include any path, port, query or fragment. - // Examples: 'example.com' or 'subdomain.example.com' - repeated string allowed_domains = 1; - - // If set to true, the key can be used on AMP (Accelerated Mobile Pages) - // websites. This is supported only for the SCORE integration type. - bool allow_amp_traffic = 2; - - // Required. Describes how this key is integrated with the website. - IntegrationType integration_type = 4 [(google.api.field_behavior) = REQUIRED]; - - // Settings for the frequency and difficulty at which this key triggers - // captcha challenges. This should only be specified for IntegrationTypes - // CHECKBOX and INVISIBLE. - ChallengeSecurityPreference challenge_security_preference = 5; -} - -// Settings specific to keys that can be used by Android apps. -message AndroidKeySettings { - // If set to true, allowed_package_names are not enforced. - bool allow_all_package_names = 2; - - // Android package names of apps allowed to use the key. - // Example: 'com.companyname.appname' - repeated string allowed_package_names = 1; -} - -// Settings specific to keys that can be used by iOS apps. -message IOSKeySettings { - // If set to true, allowed_bundle_ids are not enforced. - bool allow_all_bundle_ids = 2; - - // iOS bundle ids of apps allowed to use the key. - // Example: 'com.companyname.productname.appname' - repeated string allowed_bundle_ids = 1; -} - -// Score distribution. -message ScoreDistribution { - // Map key is score value multiplied by 100. The scores are discrete values - // between [0, 1]. The maximum number of buckets is on order of a few dozen, - // but typically much lower (ie. 10). - map score_buckets = 1; -} - -// Metrics related to scoring. -message ScoreMetrics { - // Aggregated score metrics for all traffic. - ScoreDistribution overall_metrics = 1; - - // Action-based metrics. The map key is the action name which specified by the - // site owners at time of the "execute" client-side call. - // Populated only for SCORE keys. - map action_metrics = 2; -} - -// Metrics related to challenges. -message ChallengeMetrics { - // Count of reCAPTCHA checkboxes or badges rendered. This is mostly equivalent - // to a count of pageloads for pages that include reCAPTCHA. - int64 pageload_count = 1; - - // Count of nocaptchas (successful verification without a challenge) issued. - int64 nocaptcha_count = 2; - - // Count of submitted challenge solutions that were incorrect or otherwise - // deemed suspicious such that a subsequent challenge was triggered. - int64 failed_count = 3; - - // Count of nocaptchas (successful verification without a challenge) plus - // submitted challenge solutions that were correct and resulted in - // verification. - int64 passed_count = 4; -} - -// The request message to list memberships in a related account group. -message ListRelatedAccountGroupMembershipsRequest { - // Required. The resource name for the related account group in the format - // `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" - } - ]; - - // Optional. The maximum number of accounts to return. The service may return fewer than - // this value. - // If unspecified, at most 50 accounts will be returned. - // The maximum value is 1000; values above 1000 will be 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 may return fewer than - // this value. - // If unspecified, at most 50 groups will be returned. - // The maximum value is 1000; values above 1000 will be 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, - // in the 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 may return fewer than - // this value. - // If unspecified, at most 50 groups will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous - // `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the - // subsequent page. - // - // When paginating, all other parameters provided to - // `SearchRelatedAccountGroupMemberships` must match the call that provided - // the page token. - string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response to a `SearchRelatedAccountGroupMemberships` call. -message SearchRelatedAccountGroupMembershipsResponse { - // The queried memberships. - repeated RelatedAccountGroupMembership related_account_group_memberships = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// A membership in a group of related accounts. -message RelatedAccountGroupMembership { - option (google.api.resource) = { - type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" - pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}" - }; - - // Required. The resource name for this membership in the format - // `projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" - } - ]; - - // The unique stable hashed user identifier of the member. The identifier - // corresponds to a `hashed_account_id` provided in a previous - // CreateAssessment or AnnotateAssessment call. - bytes hashed_account_id = 2; -} - -// A group of related accounts. -message RelatedAccountGroup { - option (google.api.resource) = { - type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup" - pattern: "projects/{project}/relatedaccountgroups/{relatedaccountgroup}" - }; - - // Required. The resource name for the related account group in the format - // `projects/{project}/relatedaccountgroups/{related_account_group}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "recaptchaenterprise.googleapis.com/RelatedAccountGroup" - } - ]; -} - -// Settings specific to keys that can be used for WAF (Web Application -// Firewall). -message WafSettings { - // Supported WAF features. For more information, see - // https://cloud.google.com/recaptcha-enterprise/docs/usecase#comparison_of_features. - enum WafFeature { - // Undefined feature. - WAF_FEATURE_UNSPECIFIED = 0; - - // Redirects suspicious traffic to reCAPTCHA. - CHALLENGE_PAGE = 1; - - // Use reCAPTCHA session-tokens to protect the whole user session on the - // site's domain. - SESSION_TOKEN = 2; - - // Use reCAPTCHA action-tokens to protect user actions. - ACTION_TOKEN = 3; - } - - // Web Application Firewalls supported by reCAPTCHA Enterprise. - enum WafService { - // Undefined WAF - WAF_SERVICE_UNSPECIFIED = 0; - - // Cloud Armor - CA = 1; - } - - // Required. The WAF service that uses this key. - WafService waf_service = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The WAF feature for which this key is enabled. - WafFeature waf_feature = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js deleted file mode 100644 index 0ed78fb..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.annotate_assessment.js +++ /dev/null @@ -1,77 +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] - /** - * 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. 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/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js deleted file mode 100644 index 62cadd8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_assessment.js +++ /dev/null @@ -1,64 +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] - /** - * 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/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js deleted file mode 100644 index 3a016b1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.create_key.js +++ /dev/null @@ -1,64 +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] - /** - * 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/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js deleted file mode 100644 index 4450343..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.delete_key.js +++ /dev/null @@ -1,59 +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] - /** - * 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/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js deleted file mode 100644 index bc0923e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_key.js +++ /dev/null @@ -1,59 +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] - /** - * 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/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js deleted file mode 100644 index 8f8c24e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.get_metrics.js +++ /dev/null @@ -1,59 +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] - /** - * 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/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js deleted file mode 100644 index 2f69a5e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_keys.js +++ /dev/null @@ -1,71 +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] - /** - * 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/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js deleted file mode 100644 index c2853cd..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_group_memberships.js +++ /dev/null @@ -1,76 +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] - /** - * 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 may return fewer than - * this value. - * If unspecified, at most 50 accounts will be returned. - * The maximum value is 1000; values above 1000 will be 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/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js deleted file mode 100644 index c497252..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.list_related_account_groups.js +++ /dev/null @@ -1,76 +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] - /** - * 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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js deleted file mode 100644 index 1630b4e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.migrate_key.js +++ /dev/null @@ -1,59 +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] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the key to be migrated, in the format - * "projects/{project}/keys/{key}". - */ - // const name = 'abc123' - - // Imports the Recaptchaenterprise library - const {RecaptchaEnterpriseServiceClient} = require('@google-cloud/recaptcha-enterprise').v1; - - // Instantiates a client - const recaptchaenterpriseClient = new RecaptchaEnterpriseServiceClient(); - - async function callMigrateKey() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await recaptchaenterpriseClient.migrateKey(request); - console.log(response); - } - - callMigrateKey(); - // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js deleted file mode 100644 index 863ac5b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js +++ /dev/null @@ -1,83 +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] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project to search related account group memberships from, - * in the 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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js b/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js deleted file mode 100644 index b4c91cd..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/recaptcha_enterprise_service.update_key.js +++ /dev/null @@ -1,63 +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] - /** - * 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/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json deleted file mode 100644 index f430286..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json +++ /dev/null @@ -1,555 +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": 56, - "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": 69, - "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": 56, - "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": 63, - "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_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": 51, - "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": 55, - "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": 51, - "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": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "MigrateKey", - "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.recaptchaenterprise.v1.Key", - "client": { - "shortName": "RecaptchaEnterpriseServiceClient", - "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient" - }, - "method": { - "shortName": "MigrateKey", - "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.MigrateKey", - "service": { - "shortName": "RecaptchaEnterpriseService", - "fullName": "google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService" - } - } - } - }, - { - "regionTag": "recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_async", - "title": "RecaptchaEnterpriseService getMetrics Sample", - "origin": "API_DEFINITION", - "description": " Get some aggregated metrics for a Key. This data can be used to build dashboards.", - "canonical": true, - "file": "recaptcha_enterprise_service.get_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "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": 68, - "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 the 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": 68, - "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": 75, - "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/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 51c1137..0000000 --- a/owl-bot-staging/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/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 09321f2..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,159 +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" - ] - }, - "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" - ] - }, - "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/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index 0d9bc26..0000000 --- a/owl-bot-staging/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/v1/src/v1/recaptcha_enterprise_service_client.ts b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client.ts deleted file mode 100644 index 8787c41..0000000 --- a/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client.ts +++ /dev/null @@ -1,1952 +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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * 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/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RecaptchaEnterpriseServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // 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 = gax.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', '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.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' - ] = gax.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. 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' - ] = gax.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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createKey(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' - ] = gax.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' - ] = gax.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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteKey(request, options, callback); - } -/** - * Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. - * Once a key is migrated, it can be used from either product. SiteVerify - * requests are billed as CreateAssessment calls. You must be - * authenticated as one of the current owners of the reCAPTCHA Site Key, and - * your user must have the reCAPTCHA Enterprise Admin IAM role in the - * destination project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the key to be migrated, in the format - * "projects/{project}/keys/{key}". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/recaptcha_enterprise_service.migrate_key.js - * region_tag:recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_async - */ - migrateKey( - request?: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.recaptchaenterprise.v1.IKey, - protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|undefined, {}|undefined - ]>; - migrateKey( - request: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1.IKey, - protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, - {}|null|undefined>): void; - migrateKey( - request: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1.IKey, - protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, - {}|null|undefined>): void; - migrateKey( - request?: protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.recaptchaenterprise.v1.IKey, - protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.recaptchaenterprise.v1.IKey, - protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.recaptchaenterprise.v1.IKey, - protos.google.cloud.recaptchaenterprise.v1.IMigrateKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.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' - ] = gax.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' - ] = gax.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' - ] = gax.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 gax.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' - ] = gax.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 unknown as RequestType, - 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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 gax.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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Get the 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 may return fewer than - * this value. - * If unspecified, at most 50 accounts will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 may return fewer than - * this value. - * If unspecified, at most 50 accounts will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 gax.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 may return fewer than - * this value. - * If unspecified, at most 50 accounts will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 unknown as RequestType, - 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, - * in the 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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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, - * in the 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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 gax.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, - * in the 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 may return fewer than - * this value. - * If unspecified, at most 50 groups will be returned. - * The maximum value is 1000; values above 1000 will be 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' - ] = gax.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 unknown as RequestType, - 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/v1/src/v1/recaptcha_enterprise_service_client_config.json b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client_config.json deleted file mode 100644 index 66fe297..0000000 --- a/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_client_config.json +++ /dev/null @@ -1,81 +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" - }, - "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/v1/src/v1/recaptcha_enterprise_service_proto_list.json b/owl-bot-staging/v1/src/v1/recaptcha_enterprise_service_proto_list.json deleted file mode 100644 index 790fef9..0000000 --- a/owl-bot-staging/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/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 3df789b..0000000 --- a/owl-bot-staging/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/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 1ba761a..0000000 --- a/owl-bot-staging/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/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/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/v1/test/gapic_recaptcha_enterprise_service_v1.ts b/owl-bot-staging/v1/test/gapic_recaptcha_enterprise_service_v1.ts deleted file mode 100644 index 8fb0f47..0000000 --- a/owl-bot-staging/v1/test/gapic_recaptcha_enterprise_service_v1.ts +++ /dev/null @@ -1,2085 +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'; - -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', () => { - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createAssessment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAssessment(request), expectedError); - assert((client.innerApiCalls.createAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.annotateAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.annotateAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.annotateAssessment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.annotateAssessment(request), expectedError); - assert((client.innerApiCalls.annotateAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKey(request), expectedError); - assert((client.innerApiCalls.createKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createKey(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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKey(request), expectedError); - assert((client.innerApiCalls.getKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - 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 = {}; - request.key.name = ''; - const expectedHeaderRequestParams = "key.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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 = {}; - request.key.name = ''; - const expectedHeaderRequestParams = "key.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.updateKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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 = {}; - request.key.name = ''; - const expectedHeaderRequestParams = "key.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateKey(request), expectedError); - assert((client.innerApiCalls.updateKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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 = {}; - request.key.name = ''; - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteKey = stubSimpleCall(expectedResponse); - const [response] = await client.deleteKey(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.deleteKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteKey(request), expectedError); - assert((client.innerApiCalls.deleteKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.migrateKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.migrateKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.migrateKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.migrateKey(request), expectedError); - assert((client.innerApiCalls.migrateKey as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getMetrics as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.getMetrics as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetrics = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetrics(request), expectedError); - assert((client.innerApiCalls.getMetrics as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.listKeys as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.listKeys as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKeys(request), expectedError); - assert((client.innerApiCalls.listKeys as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";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.strictEqual( - (client.descriptors.page.listKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.listRelatedAccountGroups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.listRelatedAccountGroups as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listRelatedAccountGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRelatedAccountGroups(request), expectedError); - assert((client.innerApiCalls.listRelatedAccountGroups as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listRelatedAccountGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listRelatedAccountGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listRelatedAccountGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";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.strictEqual( - (client.descriptors.page.listRelatedAccountGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listRelatedAccountGroupMemberships = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRelatedAccountGroupMemberships(request), expectedError); - assert((client.innerApiCalls.listRelatedAccountGroupMemberships as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listRelatedAccountGroupMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listRelatedAccountGroupMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.strictEqual( - (client.descriptors.page.listRelatedAccountGroupMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";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.strictEqual( - (client.descriptors.page.listRelatedAccountGroupMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.project = ''; - const expectedHeaderRequestParams = "project="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.project = ''; - const expectedHeaderRequestParams = "project="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.project = ''; - const expectedHeaderRequestParams = "project="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.searchRelatedAccountGroupMemberships = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchRelatedAccountGroupMemberships(request), expectedError); - assert((client.innerApiCalls.searchRelatedAccountGroupMemberships as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.project = ''; - const expectedHeaderRequestParams = "project="; - 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.strictEqual( - (client.descriptors.page.searchRelatedAccountGroupMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.project = ''; - const expectedHeaderRequestParams = "project="; - 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.strictEqual( - (client.descriptors.page.searchRelatedAccountGroupMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.project = ''; - const expectedHeaderRequestParams = "project="; - 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.strictEqual( - (client.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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()); - request.project = ''; - const expectedHeaderRequestParams = "project=";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.strictEqual( - (client.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - 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/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/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/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 6a9d07d..0000000 --- a/owl-bot-staging/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/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/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/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js deleted file mode 100644 index fd8d385..0000000 --- a/owl-bot-staging/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/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/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/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/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/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md deleted file mode 100644 index 57a5e16..0000000 --- a/owl-bot-staging/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Recaptchaenterprise: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/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/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json deleted file mode 100644 index 539c5e4..0000000 --- a/owl-bot-staging/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/", - "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": "^2.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto b/owl-bot-staging/v1beta1/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto deleted file mode 100644 index 28a07a8..0000000 --- a/owl-bot-staging/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/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js deleted file mode 100644 index 969aa7f..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js +++ /dev/null @@ -1,77 +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] - /** - * 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/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js deleted file mode 100644 index b0ceb63..0000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_assessment.js +++ /dev/null @@ -1,64 +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] - /** - * 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/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json deleted file mode 100644 index 954b534..0000000 --- a/owl-bot-staging/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": 56, - "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": 69, - "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/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 6bdae5d..0000000 --- a/owl-bot-staging/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/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 2a7ea77..0000000 --- a/owl-bot-staging/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/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index 7cf779e..0000000 --- a/owl-bot-staging/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/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts deleted file mode 100644 index 00958cd..0000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ /dev/null @@ -1,527 +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 * as gax from 'google-gax'; -import {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/master/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RecaptchaEnterpriseServiceV1Beta1Client; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // 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 = gax.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.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' - ] = gax.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' - ] = gax.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/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json deleted file mode 100644 index 7907ebe..0000000 --- a/owl-bot-staging/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/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/recaptcha_enterprise_service_v1_beta1_proto_list.json deleted file mode 100644 index 35d2e75..0000000 --- a/owl-bot-staging/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/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2f544c3..0000000 --- a/owl-bot-staging/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/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 0214f5c..0000000 --- a/owl-bot-staging/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/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/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/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts deleted file mode 100644 index 7f1a3c8..0000000 --- a/owl-bot-staging/v1beta1/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts +++ /dev/null @@ -1,400 +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'; - -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', () => { - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.createAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createAssessment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAssessment(request), expectedError); - assert((client.innerApiCalls.createAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.parent = ''; - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.annotateAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - 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); - assert((client.innerApiCalls.annotateAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - 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()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.annotateAssessment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.annotateAssessment(request), expectedError); - assert((client.innerApiCalls.annotateAssessment as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - 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()); - request.name = ''; - 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/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/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/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js deleted file mode 100644 index a5030d6..0000000 --- a/owl-bot-staging/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/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto index 1be736a..7cf8073 100644 --- a/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto +++ b/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -135,10 +135,10 @@ service RecaptchaEnterpriseService { // Search group memberships related to a given account. rpc SearchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest) returns (SearchRelatedAccountGroupMembershipsResponse) { option (google.api.http) = { - post: "/v1/{parent=projects/*}/relatedaccountgroupmemberships:search" + post: "/v1/{project=projects/*}/relatedaccountgroupmemberships:search" body: "*" }; - option (google.api.method_signature) = "parent,hashed_account_id"; + option (google.api.method_signature) = "project,hashed_account_id"; } } @@ -186,18 +186,18 @@ message AnnotateAssessmentRequest { // Default unspecified reason. REASON_UNSPECIFIED = 0; - // Indicates a chargeback was issued for the transaction associated with the - // assessment, with no other details. When possible, specify the type by - // using CHARGEBACK_FRAUD or CHARGEBACK_DISPUTE instead. + // 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 perspective of the cardholder (for example, the card number was + // 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 but allegedly not being satisfied with the purchase + // card details but allegedly not being satisfied with the purchase // (for example, misrepresentation, attempted cancellation). CHARGEBACK_DISPUTE = 9; @@ -578,6 +578,9 @@ message Key { // Options for user acceptance testing. TestingOptions testing_options = 9; + + // Settings for WAF + WafSettings waf_settings = 10; } // Options for user acceptance testing. @@ -802,7 +805,7 @@ message ListRelatedAccountGroupsResponse { message SearchRelatedAccountGroupMembershipsRequest { // Required. The name of the project to search related account group memberships from, // in the format "projects/{project}". - string parent = 1 [ + string project = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { child_type: "recaptchaenterprise.googleapis.com/RelatedAccountGroupMembership" @@ -878,3 +881,39 @@ message RelatedAccountGroup { } ]; } + +// Settings specific to keys that can be used for WAF (Web Application +// Firewall). +message WafSettings { + // Supported WAF features. For more information, see + // https://cloud.google.com/recaptcha-enterprise/docs/usecase#comparison_of_features. + enum WafFeature { + // Undefined feature. + WAF_FEATURE_UNSPECIFIED = 0; + + // Redirects suspicious traffic to reCAPTCHA. + CHALLENGE_PAGE = 1; + + // Use reCAPTCHA session-tokens to protect the whole user session on the + // site's domain. + SESSION_TOKEN = 2; + + // Use reCAPTCHA action-tokens to protect user actions. + ACTION_TOKEN = 3; + } + + // Web Application Firewalls supported by reCAPTCHA Enterprise. + enum WafService { + // Undefined WAF + WAF_SERVICE_UNSPECIFIED = 0; + + // Cloud Armor + CA = 1; + } + + // Required. The WAF service that uses this key. + WafService waf_service = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The WAF feature for which this key is enabled. + WafFeature waf_feature = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index ab69c80..8f8090d 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -2073,6 +2073,9 @@ export namespace google { /** Key testingOptions */ testingOptions?: (google.cloud.recaptchaenterprise.v1.ITestingOptions|null); + + /** Key wafSettings */ + wafSettings?: (google.cloud.recaptchaenterprise.v1.IWafSettings|null); } /** Represents a Key. */ @@ -2108,6 +2111,9 @@ export namespace google { /** Key testingOptions. */ public testingOptions?: (google.cloud.recaptchaenterprise.v1.ITestingOptions|null); + /** Key wafSettings. */ + public wafSettings?: (google.cloud.recaptchaenterprise.v1.IWafSettings|null); + /** Key platformSettings. */ public platformSettings?: ("webSettings"|"androidSettings"|"iosSettings"); @@ -3306,8 +3312,8 @@ export namespace google { /** Properties of a SearchRelatedAccountGroupMembershipsRequest. */ interface ISearchRelatedAccountGroupMembershipsRequest { - /** SearchRelatedAccountGroupMembershipsRequest parent */ - parent?: (string|null); + /** SearchRelatedAccountGroupMembershipsRequest project */ + project?: (string|null); /** SearchRelatedAccountGroupMembershipsRequest hashedAccountId */ hashedAccountId?: (Uint8Array|string|null); @@ -3328,8 +3334,8 @@ export namespace google { */ constructor(properties?: google.cloud.recaptchaenterprise.v1.ISearchRelatedAccountGroupMembershipsRequest); - /** SearchRelatedAccountGroupMembershipsRequest parent. */ - public parent: string; + /** SearchRelatedAccountGroupMembershipsRequest project. */ + public project: string; /** SearchRelatedAccountGroupMembershipsRequest hashedAccountId. */ public hashedAccountId: (Uint8Array|string); @@ -3692,6 +3698,119 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** Properties of a WafSettings. */ + interface IWafSettings { + + /** WafSettings wafService */ + wafService?: (google.cloud.recaptchaenterprise.v1.WafSettings.WafService|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafService|null); + + /** WafSettings wafFeature */ + wafFeature?: (google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|null); + } + + /** Represents a WafSettings. */ + class WafSettings implements IWafSettings { + + /** + * Constructs a new WafSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IWafSettings); + + /** WafSettings wafService. */ + public wafService: (google.cloud.recaptchaenterprise.v1.WafSettings.WafService|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafService); + + /** WafSettings wafFeature. */ + public wafFeature: (google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|keyof typeof google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature); + + /** + * Creates a new WafSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns WafSettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IWafSettings): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Encodes the specified WafSettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @param message WafSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IWafSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WafSettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @param message WafSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IWafSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WafSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Decodes a WafSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Verifies a WafSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WafSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WafSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.WafSettings; + + /** + * Creates a plain object from a WafSettings message. Also converts values to other types if specified. + * @param message WafSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.WafSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WafSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace WafSettings { + + /** WafFeature enum. */ + enum WafFeature { + WAF_FEATURE_UNSPECIFIED = 0, + CHALLENGE_PAGE = 1, + SESSION_TOKEN = 2, + ACTION_TOKEN = 3 + } + + /** WafService enum. */ + enum WafService { + WAF_SERVICE_UNSPECIFIED = 0, + CA = 1 + } + } } /** Namespace v1beta1. */ diff --git a/protos/protos.js b/protos/protos.js index b798ec9..ee43780 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -4754,6 +4754,7 @@ * @property {Object.|null} [labels] Key labels * @property {google.protobuf.ITimestamp|null} [createTime] Key createTime * @property {google.cloud.recaptchaenterprise.v1.ITestingOptions|null} [testingOptions] Key testingOptions + * @property {google.cloud.recaptchaenterprise.v1.IWafSettings|null} [wafSettings] Key wafSettings */ /** @@ -4836,6 +4837,14 @@ */ Key.prototype.testingOptions = null; + /** + * Key wafSettings. + * @member {google.cloud.recaptchaenterprise.v1.IWafSettings|null|undefined} wafSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.wafSettings = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -4891,6 +4900,8 @@ $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.testingOptions != null && Object.hasOwnProperty.call(message, "testingOptions")) $root.google.cloud.recaptchaenterprise.v1.TestingOptions.encode(message.testingOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.wafSettings != null && Object.hasOwnProperty.call(message, "wafSettings")) + $root.google.cloud.recaptchaenterprise.v1.WafSettings.encode(message.wafSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); return writer; }; @@ -4968,6 +4979,9 @@ case 9: message.testingOptions = $root.google.cloud.recaptchaenterprise.v1.TestingOptions.decode(reader, reader.uint32()); break; + case 10: + message.wafSettings = $root.google.cloud.recaptchaenterprise.v1.WafSettings.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -5056,6 +5070,11 @@ if (error) return "testingOptions." + error; } + if (message.wafSettings != null && message.hasOwnProperty("wafSettings")) { + var error = $root.google.cloud.recaptchaenterprise.v1.WafSettings.verify(message.wafSettings); + if (error) + return "wafSettings." + error; + } return null; }; @@ -5107,6 +5126,11 @@ throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.testingOptions: object expected"); message.testingOptions = $root.google.cloud.recaptchaenterprise.v1.TestingOptions.fromObject(object.testingOptions); } + if (object.wafSettings != null) { + if (typeof object.wafSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.wafSettings: object expected"); + message.wafSettings = $root.google.cloud.recaptchaenterprise.v1.WafSettings.fromObject(object.wafSettings); + } return message; }; @@ -5130,6 +5154,7 @@ object.displayName = ""; object.createTime = null; object.testingOptions = null; + object.wafSettings = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -5160,6 +5185,8 @@ object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); if (message.testingOptions != null && message.hasOwnProperty("testingOptions")) object.testingOptions = $root.google.cloud.recaptchaenterprise.v1.TestingOptions.toObject(message.testingOptions, options); + if (message.wafSettings != null && message.hasOwnProperty("wafSettings")) + object.wafSettings = $root.google.cloud.recaptchaenterprise.v1.WafSettings.toObject(message.wafSettings, options); return object; }; @@ -7982,7 +8009,7 @@ * Properties of a SearchRelatedAccountGroupMembershipsRequest. * @memberof google.cloud.recaptchaenterprise.v1 * @interface ISearchRelatedAccountGroupMembershipsRequest - * @property {string|null} [parent] SearchRelatedAccountGroupMembershipsRequest parent + * @property {string|null} [project] SearchRelatedAccountGroupMembershipsRequest project * @property {Uint8Array|null} [hashedAccountId] SearchRelatedAccountGroupMembershipsRequest hashedAccountId * @property {number|null} [pageSize] SearchRelatedAccountGroupMembershipsRequest pageSize * @property {string|null} [pageToken] SearchRelatedAccountGroupMembershipsRequest pageToken @@ -8004,12 +8031,12 @@ } /** - * SearchRelatedAccountGroupMembershipsRequest parent. - * @member {string} parent + * SearchRelatedAccountGroupMembershipsRequest project. + * @member {string} project * @memberof google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest * @instance */ - SearchRelatedAccountGroupMembershipsRequest.prototype.parent = ""; + SearchRelatedAccountGroupMembershipsRequest.prototype.project = ""; /** * SearchRelatedAccountGroupMembershipsRequest hashedAccountId. @@ -8059,8 +8086,8 @@ SearchRelatedAccountGroupMembershipsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hashedAccountId); if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) @@ -8102,7 +8129,7 @@ var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + message.project = reader.string(); break; case 2: message.hashedAccountId = reader.bytes(); @@ -8148,9 +8175,9 @@ SearchRelatedAccountGroupMembershipsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) return "hashedAccountId: buffer expected"; @@ -8175,8 +8202,8 @@ if (object instanceof $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest) return object; var message = new $root.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest(); - if (object.parent != null) - message.parent = String(object.parent); + if (object.project != null) + message.project = String(object.project); if (object.hashedAccountId != null) if (typeof object.hashedAccountId === "string") $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); @@ -8203,7 +8230,7 @@ options = {}; var object = {}; if (options.defaults) { - object.parent = ""; + object.project = ""; if (options.bytes === String) object.hashedAccountId = ""; else { @@ -8214,8 +8241,8 @@ object.pageSize = 0; object.pageToken = ""; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; if (message.pageSize != null && message.hasOwnProperty("pageSize")) @@ -8876,6 +8903,284 @@ return RelatedAccountGroup; })(); + v1.WafSettings = (function() { + + /** + * Properties of a WafSettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IWafSettings + * @property {google.cloud.recaptchaenterprise.v1.WafSettings.WafService|null} [wafService] WafSettings wafService + * @property {google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature|null} [wafFeature] WafSettings wafFeature + */ + + /** + * Constructs a new WafSettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a WafSettings. + * @implements IWafSettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings=} [properties] Properties to set + */ + function WafSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WafSettings wafService. + * @member {google.cloud.recaptchaenterprise.v1.WafSettings.WafService} wafService + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @instance + */ + WafSettings.prototype.wafService = 0; + + /** + * WafSettings wafFeature. + * @member {google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature} wafFeature + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @instance + */ + WafSettings.prototype.wafFeature = 0; + + /** + * Creates a new WafSettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings instance + */ + WafSettings.create = function create(properties) { + return new WafSettings(properties); + }; + + /** + * Encodes the specified WafSettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings} message WafSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WafSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.wafService != null && Object.hasOwnProperty.call(message, "wafService")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.wafService); + if (message.wafFeature != null && Object.hasOwnProperty.call(message, "wafFeature")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.wafFeature); + return writer; + }; + + /** + * Encodes the specified WafSettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WafSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWafSettings} message WafSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WafSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WafSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WafSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.WafSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.wafService = reader.int32(); + break; + case 2: + message.wafFeature = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WafSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WafSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WafSettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WafSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.wafService != null && message.hasOwnProperty("wafService")) + switch (message.wafService) { + default: + return "wafService: enum value expected"; + case 0: + case 1: + break; + } + if (message.wafFeature != null && message.hasOwnProperty("wafFeature")) + switch (message.wafFeature) { + default: + return "wafFeature: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a WafSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.WafSettings} WafSettings + */ + WafSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.WafSettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.WafSettings(); + switch (object.wafService) { + case "WAF_SERVICE_UNSPECIFIED": + case 0: + message.wafService = 0; + break; + case "CA": + case 1: + message.wafService = 1; + break; + } + switch (object.wafFeature) { + case "WAF_FEATURE_UNSPECIFIED": + case 0: + message.wafFeature = 0; + break; + case "CHALLENGE_PAGE": + case 1: + message.wafFeature = 1; + break; + case "SESSION_TOKEN": + case 2: + message.wafFeature = 2; + break; + case "ACTION_TOKEN": + case 3: + message.wafFeature = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a WafSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.WafSettings} message WafSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WafSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.wafService = options.enums === String ? "WAF_SERVICE_UNSPECIFIED" : 0; + object.wafFeature = options.enums === String ? "WAF_FEATURE_UNSPECIFIED" : 0; + } + if (message.wafService != null && message.hasOwnProperty("wafService")) + object.wafService = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WafSettings.WafService[message.wafService] : message.wafService; + if (message.wafFeature != null && message.hasOwnProperty("wafFeature")) + object.wafFeature = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature[message.wafFeature] : message.wafFeature; + return object; + }; + + /** + * Converts this WafSettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.WafSettings + * @instance + * @returns {Object.} JSON object + */ + WafSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * WafFeature enum. + * @name google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature + * @enum {number} + * @property {number} WAF_FEATURE_UNSPECIFIED=0 WAF_FEATURE_UNSPECIFIED value + * @property {number} CHALLENGE_PAGE=1 CHALLENGE_PAGE value + * @property {number} SESSION_TOKEN=2 SESSION_TOKEN value + * @property {number} ACTION_TOKEN=3 ACTION_TOKEN value + */ + WafSettings.WafFeature = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WAF_FEATURE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CHALLENGE_PAGE"] = 1; + values[valuesById[2] = "SESSION_TOKEN"] = 2; + values[valuesById[3] = "ACTION_TOKEN"] = 3; + return values; + })(); + + /** + * WafService enum. + * @name google.cloud.recaptchaenterprise.v1.WafSettings.WafService + * @enum {number} + * @property {number} WAF_SERVICE_UNSPECIFIED=0 WAF_SERVICE_UNSPECIFIED value + * @property {number} CA=1 CA value + */ + WafSettings.WafService = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WAF_SERVICE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CA"] = 1; + return values; + })(); + + return WafSettings; + })(); + return v1; })(); diff --git a/protos/protos.json b/protos/protos.json index 6b0daf1..cc2b5b0 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -212,19 +212,19 @@ "requestType": "SearchRelatedAccountGroupMembershipsRequest", "responseType": "SearchRelatedAccountGroupMembershipsResponse", "options": { - "(google.api.http).post": "/v1/{parent=projects/*}/relatedaccountgroupmemberships:search", + "(google.api.http).post": "/v1/{project=projects/*}/relatedaccountgroupmemberships:search", "(google.api.http).body": "*", - "(google.api.method_signature)": "parent,hashed_account_id" + "(google.api.method_signature)": "project,hashed_account_id" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v1/{parent=projects/*}/relatedaccountgroupmemberships:search", + "post": "/v1/{project=projects/*}/relatedaccountgroupmemberships:search", "body": "*" } }, { - "(google.api.method_signature)": "parent,hashed_account_id" + "(google.api.method_signature)": "project,hashed_account_id" } ] } @@ -676,6 +676,10 @@ "testingOptions": { "type": "TestingOptions", "id": 9 + }, + "wafSettings": { + "type": "WafSettings", + "id": 10 } } }, @@ -894,7 +898,7 @@ }, "SearchRelatedAccountGroupMembershipsRequest": { "fields": { - "parent": { + "project": { "type": "string", "id": 1, "options": { @@ -973,6 +977,40 @@ } } } + }, + "WafSettings": { + "fields": { + "wafService": { + "type": "WafService", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "wafFeature": { + "type": "WafFeature", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "WafFeature": { + "values": { + "WAF_FEATURE_UNSPECIFIED": 0, + "CHALLENGE_PAGE": 1, + "SESSION_TOKEN": 2, + "ACTION_TOKEN": 3 + } + }, + "WafService": { + "values": { + "WAF_SERVICE_UNSPECIFIED": 0, + "CA": 1 + } + } + } } } }, diff --git a/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js b/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js index 4c02dc4..863ac5b 100644 --- a/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js +++ b/samples/generated/v1/recaptcha_enterprise_service.search_related_account_group_memberships.js @@ -20,7 +20,7 @@ 'use strict'; -function main(parent) { +function main(project) { // [START recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_SearchRelatedAccountGroupMemberships_async] /** * TODO(developer): Uncomment these variables before running the sample. @@ -29,7 +29,7 @@ function main(parent) { * Required. The name of the project to search related account group memberships from, * in the format "projects/{project}". */ - // const parent = 'abc123' + // 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 @@ -62,7 +62,7 @@ function main(parent) { async function callSearchRelatedAccountGroupMemberships() { // Construct request const request = { - parent, + project, }; // Run request diff --git a/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json b/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json index 4427fd0..578b6b4 100644 --- a/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json +++ b/samples/generated/v1/snippet_metadata.google.cloud.recaptchaenterprise.v1.json @@ -520,7 +520,7 @@ "async": true, "parameters": [ { - "name": "parent", + "name": "project", "type": "TYPE_STRING" }, { diff --git a/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts index c0be33b..b4ed5ed 100644 --- a/src/v1/recaptcha_enterprise_service_client.ts +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -1776,7 +1776,7 @@ export class RecaptchaEnterpriseServiceClient { * * @param {Object} request * The request object that will be sent. - * @param {string} request.parent + * @param {string} request.project * Required. The name of the project to search related account group memberships from, * in the format "projects/{project}". * @param {Buffer} [request.hashedAccountId] @@ -1878,7 +1878,7 @@ export class RecaptchaEnterpriseServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - parent: request.parent || '', + project: request.project || '', }); this.initialize(); return this.innerApiCalls.searchRelatedAccountGroupMemberships( @@ -1892,7 +1892,7 @@ export class RecaptchaEnterpriseServiceClient { * 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 + * @param {string} request.project * Required. The name of the project to search related account group memberships from, * in the format "projects/{project}". * @param {Buffer} [request.hashedAccountId] @@ -1934,7 +1934,7 @@ export class RecaptchaEnterpriseServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - parent: request.parent || '', + project: request.project || '', }); const defaultCallSettings = this._defaults['searchRelatedAccountGroupMemberships']; @@ -1953,7 +1953,7 @@ export class RecaptchaEnterpriseServiceClient { * `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 + * @param {string} request.project * Required. The name of the project to search related account group memberships from, * in the format "projects/{project}". * @param {Buffer} [request.hashedAccountId] @@ -1996,7 +1996,7 @@ export class RecaptchaEnterpriseServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - parent: request.parent || '', + project: request.project || '', }); const defaultCallSettings = this._defaults['searchRelatedAccountGroupMemberships']; diff --git a/test/gapic_recaptcha_enterprise_service_v1.ts b/test/gapic_recaptcha_enterprise_service_v1.ts index 3f4a957..eb80d91 100644 --- a/test/gapic_recaptcha_enterprise_service_v1.ts +++ b/test/gapic_recaptcha_enterprise_service_v1.ts @@ -2363,8 +2363,8 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.project = ''; + const expectedHeaderRequestParams = 'project='; const expectedOptions = { otherArgs: { headers: { @@ -2408,8 +2408,8 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.project = ''; + const expectedHeaderRequestParams = 'project='; const expectedOptions = { otherArgs: { headers: { @@ -2468,8 +2468,8 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.project = ''; + const expectedHeaderRequestParams = 'project='; const expectedOptions = { otherArgs: { headers: { @@ -2503,8 +2503,8 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.project = ''; + const expectedHeaderRequestParams = 'project='; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() @@ -2571,8 +2571,8 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.project = ''; + const expectedHeaderRequestParams = 'project='; const expectedError = new Error('expected'); client.descriptors.page.searchRelatedAccountGroupMemberships.createStream = stubPageStreamingCall(undefined, expectedError); @@ -2628,8 +2628,8 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.project = ''; + const expectedHeaderRequestParams = 'project='; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership() @@ -2679,8 +2679,8 @@ describe('v1.RecaptchaEnterpriseServiceClient', () => { const request = generateSampleMessage( new protos.google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + request.project = ''; + const expectedHeaderRequestParams = 'project='; const expectedError = new Error('expected'); client.descriptors.page.searchRelatedAccountGroupMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError);