From deea4c10051bcda60e082864eddb14599f9c0e64 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Tue, 24 Mar 2020 16:44:05 -0700 Subject: [PATCH 1/2] feat: add the v1 API surface --- .github/workflows/ci.yaml | 8 +- .jsdoc.js | 2 +- .../v1/recaptchaenterprise.proto | 459 ++ protos/protos.d.ts | 1933 +++++++ protos/protos.js | 4532 +++++++++++++++++ protos/protos.json | 477 ++ samples/quickstart.js | 4 +- samples/test/samples.test.js | 2 +- src/index.ts | 6 +- src/v1/index.ts | 19 + src/v1/recaptcha_enterprise_service_client.ts | 1080 ++++ ...tcha_enterprise_service_client_config.json | 61 + ...captcha_enterprise_service_proto_list.json | 3 + src/v1beta1/index.ts | 2 +- ...tcha_enterprise_service_v1_beta1_client.ts | 12 +- synth.metadata | 24 +- synth.py | 2 +- system-test/fixtures/sample/src/index.js | 2 +- system-test/fixtures/sample/src/index.ts | 2 +- system-test/install.ts | 2 +- test/gapic-recaptcha_enterprise_service-v1.ts | 512 ++ ...cha_enterprise_service_v1_beta1-v1beta1.ts | 2 +- webpack.config.js | 2 +- 23 files changed, 9117 insertions(+), 31 deletions(-) create mode 100644 protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto create mode 100644 src/v1/index.ts create mode 100644 src/v1/recaptcha_enterprise_service_client.ts create mode 100644 src/v1/recaptcha_enterprise_service_client_config.json create mode 100644 src/v1/recaptcha_enterprise_service_proto_list.json create mode 100644 test/gapic-recaptcha_enterprise_service-v1.ts diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5cbc55..92394b1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: matrix: node: [8, 10, 12, 13] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} @@ -30,7 +30,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 12 @@ -39,7 +39,7 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 12 @@ -48,7 +48,7 @@ jobs: coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: 13 diff --git a/.jsdoc.js b/.jsdoc.js index 177f672..367a9d8 100644 --- a/.jsdoc.js +++ b/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto new file mode 100644 index 0000000..68c331b --- /dev/null +++ b/protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -0,0 +1,459 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.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"; + +// 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 fradulent. + 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/*}" + }; + } +} + +// 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 reprensents 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. + PASSWORD_CORRECT = 3; + + // Provides information that the event was related to a login event in which + // the user typed the incorrect password. + PASSWORD_INCORRECT = 4; + } + + // 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" + } + ]; + + // Required. The annotation that will be assigned to the Event. + Annotation annotation = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// 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]; +} + +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]; +} + +// Risk analysis result for an event. +message RiskAnalysis { + // LINT.IfChange(classification_reason) + // 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 { + // LINT.IfChange + // 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; + } + + // 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; +} + +// 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 field 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" + } + ]; +} + +// 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; + } + + // Optional. See + // Creating and managing labels. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; + + // The timestamp corresponding to the creation of this Key. + google.protobuf.Timestamp create_time = 7; +} + +// 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; + + // Required. Whether this key can be used on AMP (Accelerated Mobile Pages) websites. + bool allow_amp_traffic = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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 { + // 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 { + // iOS bundle ids of apps allowed to use the key. + // Example: 'com.companyname.productname.appname' + repeated string allowed_bundle_ids = 1; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index a65b651..9b6337d 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -23,6 +23,1939 @@ export namespace google { /** Namespace recaptchaenterprise. */ namespace recaptchaenterprise { + /** Namespace v1. */ + namespace v1 { + + /** Represents a RecaptchaEnterpriseService */ + class RecaptchaEnterpriseService extends $protobuf.rpc.Service { + + /** + * Constructs a new RecaptchaEnterpriseService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new RecaptchaEnterpriseService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): RecaptchaEnterpriseService; + + /** + * Calls CreateAssessment. + * @param request CreateAssessmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Assessment + */ + public createAssessment(request: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateAssessmentCallback): void; + + /** + * Calls CreateAssessment. + * @param request CreateAssessmentRequest message or plain object + * @returns Promise + */ + public createAssessment(request: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest): Promise; + + /** + * Calls AnnotateAssessment. + * @param request AnnotateAssessmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnnotateAssessmentResponse + */ + public annotateAssessment(request: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.AnnotateAssessmentCallback): void; + + /** + * Calls AnnotateAssessment. + * @param request AnnotateAssessmentRequest message or plain object + * @returns Promise + */ + public annotateAssessment(request: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest): Promise; + + /** + * Calls CreateKey. + * @param request CreateKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Key + */ + public createKey(request: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateKeyCallback): void; + + /** + * Calls CreateKey. + * @param request CreateKeyRequest message or plain object + * @returns Promise + */ + public createKey(request: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest): Promise; + + /** + * Calls ListKeys. + * @param request ListKeysRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListKeysResponse + */ + public listKeys(request: google.cloud.recaptchaenterprise.v1.IListKeysRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListKeysCallback): void; + + /** + * Calls ListKeys. + * @param request ListKeysRequest message or plain object + * @returns Promise + */ + public listKeys(request: google.cloud.recaptchaenterprise.v1.IListKeysRequest): Promise; + + /** + * Calls GetKey. + * @param request GetKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Key + */ + public getKey(request: google.cloud.recaptchaenterprise.v1.IGetKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetKeyCallback): void; + + /** + * Calls GetKey. + * @param request GetKeyRequest message or plain object + * @returns Promise + */ + public getKey(request: google.cloud.recaptchaenterprise.v1.IGetKeyRequest): Promise; + + /** + * Calls UpdateKey. + * @param request UpdateKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Key + */ + public updateKey(request: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.UpdateKeyCallback): void; + + /** + * Calls UpdateKey. + * @param request UpdateKeyRequest message or plain object + * @returns Promise + */ + public updateKey(request: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest): Promise; + + /** + * Calls DeleteKey. + * @param request DeleteKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteKey(request: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, callback: google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.DeleteKeyCallback): void; + + /** + * Calls DeleteKey. + * @param request DeleteKeyRequest message or plain object + * @returns Promise + */ + public deleteKey(request: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest): Promise; + } + + namespace RecaptchaEnterpriseService { + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#createAssessment}. + * @param error Error, if any + * @param [response] Assessment + */ + type CreateAssessmentCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Assessment) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#annotateAssessment}. + * @param error Error, if any + * @param [response] AnnotateAssessmentResponse + */ + type AnnotateAssessmentCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#createKey}. + * @param error Error, if any + * @param [response] Key + */ + type CreateKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Key) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#listKeys}. + * @param error Error, if any + * @param [response] ListKeysResponse + */ + type ListKeysCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.ListKeysResponse) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#getKey}. + * @param error Error, if any + * @param [response] Key + */ + type GetKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Key) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#updateKey}. + * @param error Error, if any + * @param [response] Key + */ + type UpdateKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1.Key) => void; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#deleteKey}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteKeyCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a CreateAssessmentRequest. */ + interface ICreateAssessmentRequest { + + /** CreateAssessmentRequest parent */ + parent?: (string|null); + + /** CreateAssessmentRequest assessment */ + assessment?: (google.cloud.recaptchaenterprise.v1.IAssessment|null); + } + + /** Represents a CreateAssessmentRequest. */ + class CreateAssessmentRequest implements ICreateAssessmentRequest { + + /** + * Constructs a new CreateAssessmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest); + + /** CreateAssessmentRequest parent. */ + public parent: string; + + /** CreateAssessmentRequest assessment. */ + public assessment?: (google.cloud.recaptchaenterprise.v1.IAssessment|null); + + /** + * Creates a new CreateAssessmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateAssessmentRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Encodes the specified CreateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @param message CreateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @param message CreateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Verifies a CreateAssessmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateAssessmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest; + + /** + * Creates a plain object from a CreateAssessmentRequest message. Also converts values to other types if specified. + * @param message CreateAssessmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateAssessmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AnnotateAssessmentRequest. */ + interface IAnnotateAssessmentRequest { + + /** AnnotateAssessmentRequest name */ + name?: (string|null); + + /** AnnotateAssessmentRequest annotation */ + annotation?: (google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|null); + } + + /** Represents an AnnotateAssessmentRequest. */ + class AnnotateAssessmentRequest implements IAnnotateAssessmentRequest { + + /** + * Constructs a new AnnotateAssessmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest); + + /** AnnotateAssessmentRequest name. */ + public name: string; + + /** AnnotateAssessmentRequest annotation. */ + public annotation: (google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation); + + /** + * Creates a new AnnotateAssessmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotateAssessmentRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Encodes the specified AnnotateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @param message AnnotateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @param message AnnotateAssessmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Verifies an AnnotateAssessmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AnnotateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotateAssessmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest; + + /** + * Creates a plain object from an AnnotateAssessmentRequest message. Also converts values to other types if specified. + * @param message AnnotateAssessmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotateAssessmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace AnnotateAssessmentRequest { + + /** Annotation enum. */ + enum Annotation { + ANNOTATION_UNSPECIFIED = 0, + LEGITIMATE = 1, + FRAUDULENT = 2, + PASSWORD_CORRECT = 3, + PASSWORD_INCORRECT = 4 + } + } + + /** Properties of an AnnotateAssessmentResponse. */ + interface IAnnotateAssessmentResponse { + } + + /** Represents an AnnotateAssessmentResponse. */ + class AnnotateAssessmentResponse implements IAnnotateAssessmentResponse { + + /** + * Constructs a new AnnotateAssessmentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse); + + /** + * Creates a new AnnotateAssessmentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotateAssessmentResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Encodes the specified AnnotateAssessmentResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @param message AnnotateAssessmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotateAssessmentResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @param message AnnotateAssessmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Verifies an AnnotateAssessmentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AnnotateAssessmentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotateAssessmentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse; + + /** + * Creates a plain object from an AnnotateAssessmentResponse message. Also converts values to other types if specified. + * @param message AnnotateAssessmentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotateAssessmentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Assessment. */ + interface IAssessment { + + /** Assessment name */ + name?: (string|null); + + /** Assessment event */ + event?: (google.cloud.recaptchaenterprise.v1.IEvent|null); + + /** Assessment riskAnalysis */ + riskAnalysis?: (google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null); + + /** Assessment tokenProperties */ + tokenProperties?: (google.cloud.recaptchaenterprise.v1.ITokenProperties|null); + } + + /** Represents an Assessment. */ + class Assessment implements IAssessment { + + /** + * Constructs a new Assessment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAssessment); + + /** Assessment name. */ + public name: string; + + /** Assessment event. */ + public event?: (google.cloud.recaptchaenterprise.v1.IEvent|null); + + /** Assessment riskAnalysis. */ + public riskAnalysis?: (google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null); + + /** Assessment tokenProperties. */ + public tokenProperties?: (google.cloud.recaptchaenterprise.v1.ITokenProperties|null); + + /** + * Creates a new Assessment instance using the specified properties. + * @param [properties] Properties to set + * @returns Assessment instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAssessment): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Assessment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Decodes an Assessment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Verifies an Assessment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Assessment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.Assessment; + + /** + * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * @param message Assessment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.Assessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Assessment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Event. */ + interface IEvent { + + /** Event token */ + token?: (string|null); + + /** Event siteKey */ + siteKey?: (string|null); + + /** Event userAgent */ + userAgent?: (string|null); + + /** Event userIpAddress */ + userIpAddress?: (string|null); + + /** Event expectedAction */ + expectedAction?: (string|null); + } + + /** Represents an Event. */ + class Event implements IEvent { + + /** + * Constructs a new Event. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IEvent); + + /** Event token. */ + public token: string; + + /** Event siteKey. */ + public siteKey: string; + + /** Event userAgent. */ + public userAgent: string; + + /** Event userIpAddress. */ + public userIpAddress: string; + + /** Event expectedAction. */ + public expectedAction: string; + + /** + * Creates a new Event instance using the specified properties. + * @param [properties] Properties to set + * @returns Event instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IEvent): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Event message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Verifies an Event message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Event + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.Event; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @param message Event + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.Event, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Event to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RiskAnalysis. */ + interface IRiskAnalysis { + + /** RiskAnalysis score */ + score?: (number|null); + + /** RiskAnalysis reasons */ + reasons?: (google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[]|null); + } + + /** Represents a RiskAnalysis. */ + class RiskAnalysis implements IRiskAnalysis { + + /** + * Constructs a new RiskAnalysis. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IRiskAnalysis); + + /** RiskAnalysis score. */ + public score: number; + + /** RiskAnalysis reasons. */ + public reasons: google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[]; + + /** + * Creates a new RiskAnalysis instance using the specified properties. + * @param [properties] Properties to set + * @returns RiskAnalysis instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IRiskAnalysis): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Encodes the specified RiskAnalysis message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @param message RiskAnalysis message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IRiskAnalysis, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RiskAnalysis message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @param message RiskAnalysis message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IRiskAnalysis, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Verifies a RiskAnalysis message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RiskAnalysis message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RiskAnalysis + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.RiskAnalysis; + + /** + * Creates a plain object from a RiskAnalysis message. Also converts values to other types if specified. + * @param message RiskAnalysis + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.RiskAnalysis, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RiskAnalysis to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace RiskAnalysis { + + /** ClassificationReason enum. */ + enum ClassificationReason { + CLASSIFICATION_REASON_UNSPECIFIED = 0, + AUTOMATION = 1, + UNEXPECTED_ENVIRONMENT = 2, + TOO_MUCH_TRAFFIC = 3, + UNEXPECTED_USAGE_PATTERNS = 4, + LOW_CONFIDENCE_SCORE = 5 + } + } + + /** Properties of a TokenProperties. */ + interface ITokenProperties { + + /** TokenProperties valid */ + valid?: (boolean|null); + + /** TokenProperties invalidReason */ + invalidReason?: (google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|keyof typeof google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|null); + + /** TokenProperties createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname */ + hostname?: (string|null); + + /** TokenProperties action */ + action?: (string|null); + } + + /** Represents a TokenProperties. */ + class TokenProperties implements ITokenProperties { + + /** + * Constructs a new TokenProperties. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ITokenProperties); + + /** TokenProperties valid. */ + public valid: boolean; + + /** TokenProperties invalidReason. */ + public invalidReason: (google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|keyof typeof google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason); + + /** TokenProperties createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname. */ + public hostname: string; + + /** TokenProperties action. */ + public action: string; + + /** + * Creates a new TokenProperties instance using the specified properties. + * @param [properties] Properties to set + * @returns TokenProperties instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ITokenProperties): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TokenProperties message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Verifies a TokenProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TokenProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.TokenProperties; + + /** + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * @param message TokenProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.TokenProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TokenProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TokenProperties { + + /** InvalidReason enum. */ + enum InvalidReason { + INVALID_REASON_UNSPECIFIED = 0, + UNKNOWN_INVALID_REASON = 1, + MALFORMED = 2, + EXPIRED = 3, + DUPE = 4, + MISSING = 5 + } + } + + /** Properties of a CreateKeyRequest. */ + interface ICreateKeyRequest { + + /** CreateKeyRequest parent */ + parent?: (string|null); + + /** CreateKeyRequest key */ + key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + } + + /** Represents a CreateKeyRequest. */ + class CreateKeyRequest implements ICreateKeyRequest { + + /** + * Constructs a new CreateKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest); + + /** CreateKeyRequest parent. */ + public parent: string; + + /** CreateKeyRequest key. */ + public key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + + /** + * Creates a new CreateKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Encodes the specified CreateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @param message CreateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @param message CreateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Verifies a CreateKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.CreateKeyRequest; + + /** + * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. + * @param message CreateKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.CreateKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListKeysRequest. */ + interface IListKeysRequest { + + /** ListKeysRequest parent */ + parent?: (string|null); + + /** ListKeysRequest pageSize */ + pageSize?: (number|null); + + /** ListKeysRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListKeysRequest. */ + class ListKeysRequest implements IListKeysRequest { + + /** + * Constructs a new ListKeysRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListKeysRequest); + + /** ListKeysRequest parent. */ + public parent: string; + + /** ListKeysRequest pageSize. */ + public pageSize: number; + + /** ListKeysRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListKeysRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKeysRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListKeysRequest): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Encodes the specified ListKeysRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @param message ListKeysRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListKeysRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKeysRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @param message ListKeysRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListKeysRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Verifies a ListKeysRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKeysRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKeysRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListKeysRequest; + + /** + * Creates a plain object from a ListKeysRequest message. Also converts values to other types if specified. + * @param message ListKeysRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListKeysRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKeysRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListKeysResponse. */ + interface IListKeysResponse { + + /** ListKeysResponse keys */ + keys?: (google.cloud.recaptchaenterprise.v1.IKey[]|null); + + /** ListKeysResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListKeysResponse. */ + class ListKeysResponse implements IListKeysResponse { + + /** + * Constructs a new ListKeysResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IListKeysResponse); + + /** ListKeysResponse keys. */ + public keys: google.cloud.recaptchaenterprise.v1.IKey[]; + + /** ListKeysResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListKeysResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKeysResponse instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IListKeysResponse): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @param message ListKeysResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IListKeysResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @param message ListKeysResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IListKeysResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Verifies a ListKeysResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKeysResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKeysResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.ListKeysResponse; + + /** + * Creates a plain object from a ListKeysResponse message. Also converts values to other types if specified. + * @param message ListKeysResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.ListKeysResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKeysResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetKeyRequest. */ + interface IGetKeyRequest { + + /** GetKeyRequest name */ + name?: (string|null); + } + + /** Represents a GetKeyRequest. */ + class GetKeyRequest implements IGetKeyRequest { + + /** + * Constructs a new GetKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IGetKeyRequest); + + /** GetKeyRequest name. */ + public name: string; + + /** + * Creates a new GetKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IGetKeyRequest): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Encodes the specified GetKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @param message GetKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IGetKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @param message GetKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IGetKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Decodes a GetKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Verifies a GetKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.GetKeyRequest; + + /** + * Creates a plain object from a GetKeyRequest message. Also converts values to other types if specified. + * @param message GetKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.GetKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateKeyRequest. */ + interface IUpdateKeyRequest { + + /** UpdateKeyRequest key */ + key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + + /** UpdateKeyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateKeyRequest. */ + class UpdateKeyRequest implements IUpdateKeyRequest { + + /** + * Constructs a new UpdateKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest); + + /** UpdateKeyRequest key. */ + public key?: (google.cloud.recaptchaenterprise.v1.IKey|null); + + /** UpdateKeyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Encodes the specified UpdateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @param message UpdateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @param message UpdateKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Verifies an UpdateKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.UpdateKeyRequest; + + /** + * Creates a plain object from an UpdateKeyRequest message. Also converts values to other types if specified. + * @param message UpdateKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.UpdateKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteKeyRequest. */ + interface IDeleteKeyRequest { + + /** DeleteKeyRequest name */ + name?: (string|null); + } + + /** Represents a DeleteKeyRequest. */ + class DeleteKeyRequest implements IDeleteKeyRequest { + + /** + * Constructs a new DeleteKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest); + + /** DeleteKeyRequest name. */ + public name: string; + + /** + * Creates a new DeleteKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Encodes the specified DeleteKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @param message DeleteKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @param message DeleteKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Decodes a DeleteKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Verifies a DeleteKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.DeleteKeyRequest; + + /** + * Creates a plain object from a DeleteKeyRequest message. Also converts values to other types if specified. + * @param message DeleteKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.DeleteKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Key. */ + interface IKey { + + /** Key name */ + name?: (string|null); + + /** Key displayName */ + displayName?: (string|null); + + /** Key webSettings */ + webSettings?: (google.cloud.recaptchaenterprise.v1.IWebKeySettings|null); + + /** Key androidSettings */ + androidSettings?: (google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null); + + /** Key iosSettings */ + iosSettings?: (google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null); + + /** Key labels */ + labels?: ({ [k: string]: string }|null); + + /** Key createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Key. */ + class Key implements IKey { + + /** + * Constructs a new Key. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IKey); + + /** Key name. */ + public name: string; + + /** Key displayName. */ + public displayName: string; + + /** Key webSettings. */ + public webSettings?: (google.cloud.recaptchaenterprise.v1.IWebKeySettings|null); + + /** Key androidSettings. */ + public androidSettings?: (google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null); + + /** Key iosSettings. */ + public iosSettings?: (google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null); + + /** Key labels. */ + public labels: { [k: string]: string }; + + /** Key createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Key platformSettings. */ + public platformSettings?: ("webSettings"|"androidSettings"|"iosSettings"); + + /** + * Creates a new Key instance using the specified properties. + * @param [properties] Properties to set + * @returns Key instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IKey): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Encodes the specified Key message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @param message Key message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Key message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @param message Key message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Key message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Decodes a Key message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Verifies a Key message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Key message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Key + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.Key; + + /** + * Creates a plain object from a Key message. Also converts values to other types if specified. + * @param message Key + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.Key, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Key to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a WebKeySettings. */ + interface IWebKeySettings { + + /** WebKeySettings allowAllDomains */ + allowAllDomains?: (boolean|null); + + /** WebKeySettings allowedDomains */ + allowedDomains?: (string[]|null); + + /** WebKeySettings allowAmpTraffic */ + allowAmpTraffic?: (boolean|null); + + /** WebKeySettings integrationType */ + integrationType?: (google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|null); + + /** WebKeySettings challengeSecurityPreference */ + challengeSecurityPreference?: (google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|null); + } + + /** Represents a WebKeySettings. */ + class WebKeySettings implements IWebKeySettings { + + /** + * Constructs a new WebKeySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IWebKeySettings); + + /** WebKeySettings allowAllDomains. */ + public allowAllDomains: boolean; + + /** WebKeySettings allowedDomains. */ + public allowedDomains: string[]; + + /** WebKeySettings allowAmpTraffic. */ + public allowAmpTraffic: boolean; + + /** WebKeySettings integrationType. */ + public integrationType: (google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType); + + /** WebKeySettings challengeSecurityPreference. */ + public challengeSecurityPreference: (google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|keyof typeof google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference); + + /** + * Creates a new WebKeySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns WebKeySettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IWebKeySettings): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Encodes the specified WebKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @param message WebKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IWebKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @param message WebKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IWebKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Verifies a WebKeySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebKeySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebKeySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.WebKeySettings; + + /** + * Creates a plain object from a WebKeySettings message. Also converts values to other types if specified. + * @param message WebKeySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.WebKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebKeySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace WebKeySettings { + + /** IntegrationType enum. */ + enum IntegrationType { + INTEGRATION_TYPE_UNSPECIFIED = 0, + SCORE = 1, + CHECKBOX = 2, + INVISIBLE = 3 + } + + /** ChallengeSecurityPreference enum. */ + enum ChallengeSecurityPreference { + CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0, + USABILITY = 1, + BALANCE = 2, + SECURITY = 3 + } + } + + /** Properties of an AndroidKeySettings. */ + interface IAndroidKeySettings { + + /** AndroidKeySettings allowedPackageNames */ + allowedPackageNames?: (string[]|null); + } + + /** Represents an AndroidKeySettings. */ + class AndroidKeySettings implements IAndroidKeySettings { + + /** + * Constructs a new AndroidKeySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings); + + /** AndroidKeySettings allowedPackageNames. */ + public allowedPackageNames: string[]; + + /** + * Creates a new AndroidKeySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns AndroidKeySettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Encodes the specified AndroidKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @param message AndroidKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AndroidKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @param message AndroidKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IAndroidKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Verifies an AndroidKeySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AndroidKeySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AndroidKeySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.AndroidKeySettings; + + /** + * Creates a plain object from an AndroidKeySettings message. Also converts values to other types if specified. + * @param message AndroidKeySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.AndroidKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AndroidKeySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a IOSKeySettings. */ + interface IIOSKeySettings { + + /** IOSKeySettings allowedBundleIds */ + allowedBundleIds?: (string[]|null); + } + + /** Represents a IOSKeySettings. */ + class IOSKeySettings implements IIOSKeySettings { + + /** + * Constructs a new IOSKeySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1.IIOSKeySettings); + + /** IOSKeySettings allowedBundleIds. */ + public allowedBundleIds: string[]; + + /** + * Creates a new IOSKeySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns IOSKeySettings instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1.IIOSKeySettings): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Encodes the specified IOSKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @param message IOSKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1.IIOSKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IOSKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @param message IOSKeySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1.IIOSKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Verifies a IOSKeySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a IOSKeySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IOSKeySettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1.IOSKeySettings; + + /** + * Creates a plain object from a IOSKeySettings message. Also converts values to other types if specified. + * @param message IOSKeySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1.IOSKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IOSKeySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Namespace v1beta1. */ namespace v1beta1 { diff --git a/protos/protos.js b/protos/protos.js index 584780d..9db953e 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -57,6 +57,4538 @@ */ var recaptchaenterprise = {}; + recaptchaenterprise.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.recaptchaenterprise + * @namespace + */ + var v1 = {}; + + v1.RecaptchaEnterpriseService = (function() { + + /** + * Constructs a new RecaptchaEnterpriseService service. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RecaptchaEnterpriseService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function RecaptchaEnterpriseService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (RecaptchaEnterpriseService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = RecaptchaEnterpriseService; + + /** + * Creates new RecaptchaEnterpriseService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {RecaptchaEnterpriseService} RPC service. Useful where requests and/or responses are streamed. + */ + RecaptchaEnterpriseService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#createAssessment}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef CreateAssessmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Assessment} [response] Assessment + */ + + /** + * Calls CreateAssessment. + * @function createAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} request CreateAssessmentRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateAssessmentCallback} callback Node-style callback called with the error, if any, and Assessment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.createAssessment = function createAssessment(request, callback) { + return this.rpcCall(createAssessment, $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest, $root.google.cloud.recaptchaenterprise.v1.Assessment, request, callback); + }, "name", { value: "CreateAssessment" }); + + /** + * Calls CreateAssessment. + * @function createAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} request CreateAssessmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#annotateAssessment}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef AnnotateAssessmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} [response] AnnotateAssessmentResponse + */ + + /** + * Calls AnnotateAssessment. + * @function annotateAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} request AnnotateAssessmentRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.AnnotateAssessmentCallback} callback Node-style callback called with the error, if any, and AnnotateAssessmentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.annotateAssessment = function annotateAssessment(request, callback) { + return this.rpcCall(annotateAssessment, $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest, $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse, request, callback); + }, "name", { value: "AnnotateAssessment" }); + + /** + * Calls AnnotateAssessment. + * @function annotateAssessment + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} request AnnotateAssessmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#createKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef CreateKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Key} [response] Key + */ + + /** + * Calls CreateKey. + * @function createKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} request CreateKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.CreateKeyCallback} callback Node-style callback called with the error, if any, and Key + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.createKey = function createKey(request, callback) { + return this.rpcCall(createKey, $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest, $root.google.cloud.recaptchaenterprise.v1.Key, request, callback); + }, "name", { value: "CreateKey" }); + + /** + * Calls CreateKey. + * @function createKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} request CreateKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#listKeys}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef ListKeysCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.ListKeysResponse} [response] ListKeysResponse + */ + + /** + * Calls ListKeys. + * @function listKeys + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} request ListKeysRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.ListKeysCallback} callback Node-style callback called with the error, if any, and ListKeysResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.listKeys = function listKeys(request, callback) { + return this.rpcCall(listKeys, $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest, $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse, request, callback); + }, "name", { value: "ListKeys" }); + + /** + * Calls ListKeys. + * @function listKeys + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} request ListKeysRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#getKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef GetKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Key} [response] Key + */ + + /** + * Calls GetKey. + * @function getKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} request GetKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.GetKeyCallback} callback Node-style callback called with the error, if any, and Key + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.getKey = function getKey(request, callback) { + return this.rpcCall(getKey, $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest, $root.google.cloud.recaptchaenterprise.v1.Key, request, callback); + }, "name", { value: "GetKey" }); + + /** + * Calls GetKey. + * @function getKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} request GetKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#updateKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef UpdateKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.recaptchaenterprise.v1.Key} [response] Key + */ + + /** + * Calls UpdateKey. + * @function updateKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} request UpdateKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.UpdateKeyCallback} callback Node-style callback called with the error, if any, and Key + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.updateKey = function updateKey(request, callback) { + return this.rpcCall(updateKey, $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest, $root.google.cloud.recaptchaenterprise.v1.Key, request, callback); + }, "name", { value: "UpdateKey" }); + + /** + * Calls UpdateKey. + * @function updateKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} request UpdateKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService#deleteKey}. + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @typedef DeleteKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteKey. + * @function deleteKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} request DeleteKeyRequest message or plain object + * @param {google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService.DeleteKeyCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(RecaptchaEnterpriseService.prototype.deleteKey = function deleteKey(request, callback) { + return this.rpcCall(deleteKey, $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteKey" }); + + /** + * Calls DeleteKey. + * @function deleteKey + * @memberof google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseService + * @instance + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} request DeleteKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return RecaptchaEnterpriseService; + })(); + + v1.CreateAssessmentRequest = (function() { + + /** + * Properties of a CreateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ICreateAssessmentRequest + * @property {string|null} [parent] CreateAssessmentRequest parent + * @property {google.cloud.recaptchaenterprise.v1.IAssessment|null} [assessment] CreateAssessmentRequest assessment + */ + + /** + * Constructs a new CreateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a CreateAssessmentRequest. + * @implements ICreateAssessmentRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest=} [properties] Properties to set + */ + function CreateAssessmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateAssessmentRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @instance + */ + CreateAssessmentRequest.prototype.parent = ""; + + /** + * CreateAssessmentRequest assessment. + * @member {google.cloud.recaptchaenterprise.v1.IAssessment|null|undefined} assessment + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @instance + */ + CreateAssessmentRequest.prototype.assessment = null; + + /** + * Creates a new CreateAssessmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest instance + */ + CreateAssessmentRequest.create = function create(properties) { + return new CreateAssessmentRequest(properties); + }; + + /** + * Encodes the specified CreateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} message CreateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAssessmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.assessment != null && message.hasOwnProperty("assessment")) + $root.google.cloud.recaptchaenterprise.v1.Assessment.encode(message.assessment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest} message CreateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAssessmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAssessmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.assessment = $root.google.cloud.recaptchaenterprise.v1.Assessment.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateAssessmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAssessmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateAssessmentRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateAssessmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.assessment != null && message.hasOwnProperty("assessment")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Assessment.verify(message.assessment); + if (error) + return "assessment." + error; + } + return null; + }; + + /** + * Creates a CreateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} CreateAssessmentRequest + */ + CreateAssessmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.assessment != null) { + if (typeof object.assessment !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest.assessment: object expected"); + message.assessment = $root.google.cloud.recaptchaenterprise.v1.Assessment.fromObject(object.assessment); + } + return message; + }; + + /** + * Creates a plain object from a CreateAssessmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest} message CreateAssessmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateAssessmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.assessment = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.assessment != null && message.hasOwnProperty("assessment")) + object.assessment = $root.google.cloud.recaptchaenterprise.v1.Assessment.toObject(message.assessment, options); + return object; + }; + + /** + * Converts this CreateAssessmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateAssessmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateAssessmentRequest; + })(); + + v1.AnnotateAssessmentRequest = (function() { + + /** + * Properties of an AnnotateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAnnotateAssessmentRequest + * @property {string|null} [name] AnnotateAssessmentRequest name + * @property {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation|null} [annotation] AnnotateAssessmentRequest annotation + */ + + /** + * Constructs a new AnnotateAssessmentRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AnnotateAssessmentRequest. + * @implements IAnnotateAssessmentRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest=} [properties] Properties to set + */ + function AnnotateAssessmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnnotateAssessmentRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.name = ""; + + /** + * AnnotateAssessmentRequest annotation. + * @member {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation} annotation + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.annotation = 0; + + /** + * Creates a new AnnotateAssessmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest instance + */ + AnnotateAssessmentRequest.create = function create(properties) { + return new AnnotateAssessmentRequest(properties); + }; + + /** + * Encodes the specified AnnotateAssessmentRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} message AnnotateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.annotation != null && message.hasOwnProperty("annotation")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.annotation); + return writer; + }; + + /** + * Encodes the specified AnnotateAssessmentRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest} message AnnotateAssessmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.annotation = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotateAssessmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotateAssessmentRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotateAssessmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) + switch (message.annotation) { + default: + return "annotation: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates an AnnotateAssessmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} AnnotateAssessmentRequest + */ + AnnotateAssessmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest(); + if (object.name != null) + message.name = String(object.name); + switch (object.annotation) { + case "ANNOTATION_UNSPECIFIED": + case 0: + message.annotation = 0; + break; + case "LEGITIMATE": + case 1: + message.annotation = 1; + break; + case "FRAUDULENT": + case 2: + message.annotation = 2; + break; + case "PASSWORD_CORRECT": + case 3: + message.annotation = 3; + break; + case "PASSWORD_INCORRECT": + case 4: + message.annotation = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from an AnnotateAssessmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest} message AnnotateAssessmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotateAssessmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.annotation = options.enums === String ? "ANNOTATION_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.annotation != null && message.hasOwnProperty("annotation")) + object.annotation = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation[message.annotation] : message.annotation; + return object; + }; + + /** + * Converts this AnnotateAssessmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest + * @instance + * @returns {Object.} JSON object + */ + AnnotateAssessmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Annotation enum. + * @name google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation + * @enum {string} + * @property {number} ANNOTATION_UNSPECIFIED=0 ANNOTATION_UNSPECIFIED value + * @property {number} LEGITIMATE=1 LEGITIMATE value + * @property {number} FRAUDULENT=2 FRAUDULENT value + * @property {number} PASSWORD_CORRECT=3 PASSWORD_CORRECT value + * @property {number} PASSWORD_INCORRECT=4 PASSWORD_INCORRECT value + */ + AnnotateAssessmentRequest.Annotation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ANNOTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "LEGITIMATE"] = 1; + values[valuesById[2] = "FRAUDULENT"] = 2; + values[valuesById[3] = "PASSWORD_CORRECT"] = 3; + values[valuesById[4] = "PASSWORD_INCORRECT"] = 4; + return values; + })(); + + return AnnotateAssessmentRequest; + })(); + + v1.AnnotateAssessmentResponse = (function() { + + /** + * Properties of an AnnotateAssessmentResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAnnotateAssessmentResponse + */ + + /** + * Constructs a new AnnotateAssessmentResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AnnotateAssessmentResponse. + * @implements IAnnotateAssessmentResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse=} [properties] Properties to set + */ + function AnnotateAssessmentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AnnotateAssessmentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse instance + */ + AnnotateAssessmentResponse.create = function create(properties) { + return new AnnotateAssessmentResponse(properties); + }; + + /** + * Encodes the specified AnnotateAssessmentResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse} message AnnotateAssessmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AnnotateAssessmentResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse} message AnnotateAssessmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotateAssessmentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotateAssessmentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotateAssessmentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotateAssessmentResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotateAssessmentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AnnotateAssessmentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} AnnotateAssessmentResponse + */ + AnnotateAssessmentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse) + return object; + return new $root.google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse(); + }; + + /** + * Creates a plain object from an AnnotateAssessmentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse} message AnnotateAssessmentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotateAssessmentResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AnnotateAssessmentResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse + * @instance + * @returns {Object.} JSON object + */ + AnnotateAssessmentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AnnotateAssessmentResponse; + })(); + + v1.Assessment = (function() { + + /** + * Properties of an Assessment. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAssessment + * @property {string|null} [name] Assessment name + * @property {google.cloud.recaptchaenterprise.v1.IEvent|null} [event] Assessment event + * @property {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null} [riskAnalysis] Assessment riskAnalysis + * @property {google.cloud.recaptchaenterprise.v1.ITokenProperties|null} [tokenProperties] Assessment tokenProperties + */ + + /** + * Constructs a new Assessment. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an Assessment. + * @implements IAssessment + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set + */ + function Assessment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Assessment name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.name = ""; + + /** + * Assessment event. + * @member {google.cloud.recaptchaenterprise.v1.IEvent|null|undefined} event + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.event = null; + + /** + * Assessment riskAnalysis. + * @member {google.cloud.recaptchaenterprise.v1.IRiskAnalysis|null|undefined} riskAnalysis + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.riskAnalysis = null; + + /** + * Assessment tokenProperties. + * @member {google.cloud.recaptchaenterprise.v1.ITokenProperties|null|undefined} tokenProperties + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + */ + Assessment.prototype.tokenProperties = null; + + /** + * Creates a new Assessment instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment instance + */ + Assessment.create = function create(properties) { + return new Assessment(properties); + }; + + /** + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Assessment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.event != null && message.hasOwnProperty("event")) + $root.google.cloud.recaptchaenterprise.v1.Event.encode(message.event, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) + $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.encode(message.riskAnalysis, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) + $root.google.cloud.recaptchaenterprise.v1.TokenProperties.encode(message.tokenProperties, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Assessment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAssessment} message Assessment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Assessment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Assessment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Assessment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.event = $root.google.cloud.recaptchaenterprise.v1.Event.decode(reader, reader.uint32()); + break; + case 3: + message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.decode(reader, reader.uint32()); + break; + case 4: + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Assessment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Assessment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Assessment message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Assessment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.event != null && message.hasOwnProperty("event")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Event.verify(message.event); + if (error) + return "event." + error; + } + if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) { + var error = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify(message.riskAnalysis); + if (error) + return "riskAnalysis." + error; + } + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) { + var error = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.verify(message.tokenProperties); + if (error) + return "tokenProperties." + error; + } + return null; + }; + + /** + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.Assessment} Assessment + */ + Assessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Assessment) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.Assessment(); + if (object.name != null) + message.name = String(object.name); + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.event: object expected"); + message.event = $root.google.cloud.recaptchaenterprise.v1.Event.fromObject(object.event); + } + if (object.riskAnalysis != null) { + if (typeof object.riskAnalysis !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.riskAnalysis: object expected"); + message.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.fromObject(object.riskAnalysis); + } + if (object.tokenProperties != null) { + if (typeof object.tokenProperties !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Assessment.tokenProperties: object expected"); + message.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.fromObject(object.tokenProperties); + } + return message; + }; + + /** + * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @static + * @param {google.cloud.recaptchaenterprise.v1.Assessment} message Assessment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Assessment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.event = null; + object.riskAnalysis = null; + object.tokenProperties = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.event != null && message.hasOwnProperty("event")) + object.event = $root.google.cloud.recaptchaenterprise.v1.Event.toObject(message.event, options); + if (message.riskAnalysis != null && message.hasOwnProperty("riskAnalysis")) + object.riskAnalysis = $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.toObject(message.riskAnalysis, options); + if (message.tokenProperties != null && message.hasOwnProperty("tokenProperties")) + object.tokenProperties = $root.google.cloud.recaptchaenterprise.v1.TokenProperties.toObject(message.tokenProperties, options); + return object; + }; + + /** + * Converts this Assessment to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.Assessment + * @instance + * @returns {Object.} JSON object + */ + Assessment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Assessment; + })(); + + v1.Event = (function() { + + /** + * Properties of an Event. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IEvent + * @property {string|null} [token] Event token + * @property {string|null} [siteKey] Event siteKey + * @property {string|null} [userAgent] Event userAgent + * @property {string|null} [userIpAddress] Event userIpAddress + * @property {string|null} [expectedAction] Event expectedAction + */ + + /** + * Constructs a new Event. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an Event. + * @implements IEvent + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set + */ + function Event(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Event token. + * @member {string} token + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.token = ""; + + /** + * Event siteKey. + * @member {string} siteKey + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.siteKey = ""; + + /** + * Event userAgent. + * @member {string} userAgent + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.userAgent = ""; + + /** + * Event userIpAddress. + * @member {string} userIpAddress + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.userIpAddress = ""; + + /** + * Event expectedAction. + * @member {string} expectedAction + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + */ + Event.prototype.expectedAction = ""; + + /** + * Creates a new Event instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event instance + */ + Event.create = function create(properties) { + return new Event(properties); + }; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.token != null && message.hasOwnProperty("token")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.token); + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.siteKey); + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.userIpAddress); + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.expectedAction); + return writer; + }; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Event.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Event message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Event(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.token = reader.string(); + break; + case 2: + message.siteKey = reader.string(); + break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.userIpAddress = reader.string(); + break; + case 5: + message.expectedAction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Event message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Event.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.token != null && message.hasOwnProperty("token")) + if (!$util.isString(message.token)) + return "token: string expected"; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + if (!$util.isString(message.siteKey)) + return "siteKey: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + if (!$util.isString(message.userIpAddress)) + return "userIpAddress: string expected"; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + if (!$util.isString(message.expectedAction)) + return "expectedAction: string expected"; + return null; + }; + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.Event} Event + */ + Event.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Event) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.Event(); + if (object.token != null) + message.token = String(object.token); + if (object.siteKey != null) + message.siteKey = String(object.siteKey); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.userIpAddress != null) + message.userIpAddress = String(object.userIpAddress); + if (object.expectedAction != null) + message.expectedAction = String(object.expectedAction); + return message; + }; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @static + * @param {google.cloud.recaptchaenterprise.v1.Event} message Event + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Event.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.token = ""; + object.siteKey = ""; + object.userAgent = ""; + object.userIpAddress = ""; + object.expectedAction = ""; + } + if (message.token != null && message.hasOwnProperty("token")) + object.token = message.token; + if (message.siteKey != null && message.hasOwnProperty("siteKey")) + object.siteKey = message.siteKey; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + object.userIpAddress = message.userIpAddress; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + object.expectedAction = message.expectedAction; + return object; + }; + + /** + * Converts this Event to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.Event + * @instance + * @returns {Object.} JSON object + */ + Event.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Event; + })(); + + v1.RiskAnalysis = (function() { + + /** + * Properties of a RiskAnalysis. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IRiskAnalysis + * @property {number|null} [score] RiskAnalysis score + * @property {Array.|null} [reasons] RiskAnalysis reasons + */ + + /** + * Constructs a new RiskAnalysis. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a RiskAnalysis. + * @implements IRiskAnalysis + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set + */ + function RiskAnalysis(properties) { + this.reasons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RiskAnalysis score. + * @member {number} score + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @instance + */ + RiskAnalysis.prototype.score = 0; + + /** + * RiskAnalysis reasons. + * @member {Array.} reasons + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @instance + */ + RiskAnalysis.prototype.reasons = $util.emptyArray; + + /** + * Creates a new RiskAnalysis instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis instance + */ + RiskAnalysis.create = function create(properties) { + return new RiskAnalysis(properties); + }; + + /** + * Encodes the specified RiskAnalysis message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RiskAnalysis.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.score); + if (message.reasons != null && message.reasons.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.reasons.length; ++i) + writer.int32(message.reasons[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified RiskAnalysis message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.RiskAnalysis.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.IRiskAnalysis} message RiskAnalysis message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RiskAnalysis.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RiskAnalysis.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.score = reader.float(); + break; + case 2: + if (!(message.reasons && message.reasons.length)) + message.reasons = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.reasons.push(reader.int32()); + } else + message.reasons.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RiskAnalysis message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RiskAnalysis.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RiskAnalysis message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RiskAnalysis.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.reasons != null && message.hasOwnProperty("reasons")) { + if (!Array.isArray(message.reasons)) + return "reasons: array expected"; + for (var i = 0; i < message.reasons.length; ++i) + switch (message.reasons[i]) { + default: + return "reasons: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + } + return null; + }; + + /** + * Creates a RiskAnalysis message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.RiskAnalysis} RiskAnalysis + */ + RiskAnalysis.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis(); + if (object.score != null) + message.score = Number(object.score); + if (object.reasons) { + if (!Array.isArray(object.reasons)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.RiskAnalysis.reasons: array expected"); + message.reasons = []; + for (var i = 0; i < object.reasons.length; ++i) + switch (object.reasons[i]) { + default: + case "CLASSIFICATION_REASON_UNSPECIFIED": + case 0: + message.reasons[i] = 0; + break; + case "AUTOMATION": + case 1: + message.reasons[i] = 1; + break; + case "UNEXPECTED_ENVIRONMENT": + case 2: + message.reasons[i] = 2; + break; + case "TOO_MUCH_TRAFFIC": + case 3: + message.reasons[i] = 3; + break; + case "UNEXPECTED_USAGE_PATTERNS": + case 4: + message.reasons[i] = 4; + break; + case "LOW_CONFIDENCE_SCORE": + case 5: + message.reasons[i] = 5; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a RiskAnalysis message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @static + * @param {google.cloud.recaptchaenterprise.v1.RiskAnalysis} message RiskAnalysis + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RiskAnalysis.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.reasons = []; + if (options.defaults) + object.score = 0; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.reasons && message.reasons.length) { + object.reasons = []; + for (var j = 0; j < message.reasons.length; ++j) + object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason[message.reasons[j]] : message.reasons[j]; + } + return object; + }; + + /** + * Converts this RiskAnalysis to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.RiskAnalysis + * @instance + * @returns {Object.} JSON object + */ + RiskAnalysis.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ClassificationReason enum. + * @name google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason + * @enum {string} + * @property {number} CLASSIFICATION_REASON_UNSPECIFIED=0 CLASSIFICATION_REASON_UNSPECIFIED value + * @property {number} AUTOMATION=1 AUTOMATION value + * @property {number} UNEXPECTED_ENVIRONMENT=2 UNEXPECTED_ENVIRONMENT value + * @property {number} TOO_MUCH_TRAFFIC=3 TOO_MUCH_TRAFFIC value + * @property {number} UNEXPECTED_USAGE_PATTERNS=4 UNEXPECTED_USAGE_PATTERNS value + * @property {number} LOW_CONFIDENCE_SCORE=5 LOW_CONFIDENCE_SCORE value + */ + RiskAnalysis.ClassificationReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLASSIFICATION_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATION"] = 1; + values[valuesById[2] = "UNEXPECTED_ENVIRONMENT"] = 2; + values[valuesById[3] = "TOO_MUCH_TRAFFIC"] = 3; + values[valuesById[4] = "UNEXPECTED_USAGE_PATTERNS"] = 4; + values[valuesById[5] = "LOW_CONFIDENCE_SCORE"] = 5; + return values; + })(); + + return RiskAnalysis; + })(); + + v1.TokenProperties = (function() { + + /** + * Properties of a TokenProperties. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ITokenProperties + * @property {boolean|null} [valid] TokenProperties valid + * @property {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason|null} [invalidReason] TokenProperties invalidReason + * @property {google.protobuf.ITimestamp|null} [createTime] TokenProperties createTime + * @property {string|null} [hostname] TokenProperties hostname + * @property {string|null} [action] TokenProperties action + */ + + /** + * Constructs a new TokenProperties. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a TokenProperties. + * @implements ITokenProperties + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set + */ + function TokenProperties(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TokenProperties valid. + * @member {boolean} valid + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.valid = false; + + /** + * TokenProperties invalidReason. + * @member {google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason} invalidReason + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.invalidReason = 0; + + /** + * TokenProperties createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.createTime = null; + + /** + * TokenProperties hostname. + * @member {string} hostname + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.hostname = ""; + + /** + * TokenProperties action. + * @member {string} action + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + */ + TokenProperties.prototype.action = ""; + + /** + * Creates a new TokenProperties instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties instance + */ + TokenProperties.create = function create(properties) { + return new TokenProperties(properties); + }; + + /** + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TokenProperties.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.valid != null && message.hasOwnProperty("valid")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.valid); + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.invalidReason); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.hostname != null && message.hasOwnProperty("hostname")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.hostname); + if (message.action != null && message.hasOwnProperty("action")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.action); + return writer; + }; + + /** + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.TokenProperties.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.ITokenProperties} message TokenProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TokenProperties.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TokenProperties message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TokenProperties.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.valid = reader.bool(); + break; + case 2: + message.invalidReason = reader.int32(); + break; + case 3: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.hostname = reader.string(); + break; + case 5: + message.action = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TokenProperties.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TokenProperties message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TokenProperties.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.valid != null && message.hasOwnProperty("valid")) + if (typeof message.valid !== "boolean") + return "valid: boolean expected"; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + switch (message.invalidReason) { + default: + return "invalidReason: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.hostname != null && message.hasOwnProperty("hostname")) + if (!$util.isString(message.hostname)) + return "hostname: string expected"; + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; + return null; + }; + + /** + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.TokenProperties} TokenProperties + */ + TokenProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.TokenProperties) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.TokenProperties(); + if (object.valid != null) + message.valid = Boolean(object.valid); + switch (object.invalidReason) { + case "INVALID_REASON_UNSPECIFIED": + case 0: + message.invalidReason = 0; + break; + case "UNKNOWN_INVALID_REASON": + case 1: + message.invalidReason = 1; + break; + case "MALFORMED": + case 2: + message.invalidReason = 2; + break; + case "EXPIRED": + case 3: + message.invalidReason = 3; + break; + case "DUPE": + case 4: + message.invalidReason = 4; + break; + case "MISSING": + case 5: + message.invalidReason = 5; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.TokenProperties.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.hostname != null) + message.hostname = String(object.hostname); + if (object.action != null) + message.action = String(object.action); + return message; + }; + + /** + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @static + * @param {google.cloud.recaptchaenterprise.v1.TokenProperties} message TokenProperties + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TokenProperties.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.valid = false; + object.invalidReason = options.enums === String ? "INVALID_REASON_UNSPECIFIED" : 0; + object.createTime = null; + object.hostname = ""; + object.action = ""; + } + if (message.valid != null && message.hasOwnProperty("valid")) + object.valid = message.valid; + if (message.invalidReason != null && message.hasOwnProperty("invalidReason")) + object.invalidReason = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason[message.invalidReason] : message.invalidReason; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.hostname != null && message.hasOwnProperty("hostname")) + object.hostname = message.hostname; + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; + return object; + }; + + /** + * Converts this TokenProperties to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.TokenProperties + * @instance + * @returns {Object.} JSON object + */ + TokenProperties.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * InvalidReason enum. + * @name google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason + * @enum {string} + * @property {number} INVALID_REASON_UNSPECIFIED=0 INVALID_REASON_UNSPECIFIED value + * @property {number} UNKNOWN_INVALID_REASON=1 UNKNOWN_INVALID_REASON value + * @property {number} MALFORMED=2 MALFORMED value + * @property {number} EXPIRED=3 EXPIRED value + * @property {number} DUPE=4 DUPE value + * @property {number} MISSING=5 MISSING value + */ + TokenProperties.InvalidReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INVALID_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "UNKNOWN_INVALID_REASON"] = 1; + values[valuesById[2] = "MALFORMED"] = 2; + values[valuesById[3] = "EXPIRED"] = 3; + values[valuesById[4] = "DUPE"] = 4; + values[valuesById[5] = "MISSING"] = 5; + return values; + })(); + + return TokenProperties; + })(); + + v1.CreateKeyRequest = (function() { + + /** + * Properties of a CreateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface ICreateKeyRequest + * @property {string|null} [parent] CreateKeyRequest parent + * @property {google.cloud.recaptchaenterprise.v1.IKey|null} [key] CreateKeyRequest key + */ + + /** + * Constructs a new CreateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a CreateKeyRequest. + * @implements ICreateKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest=} [properties] Properties to set + */ + function CreateKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateKeyRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @instance + */ + CreateKeyRequest.prototype.parent = ""; + + /** + * CreateKeyRequest key. + * @member {google.cloud.recaptchaenterprise.v1.IKey|null|undefined} key + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @instance + */ + CreateKeyRequest.prototype.key = null; + + /** + * Creates a new CreateKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest instance + */ + CreateKeyRequest.create = function create(properties) { + return new CreateKeyRequest(properties); + }; + + /** + * Encodes the specified CreateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.key != null && message.hasOwnProperty("key")) + $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.CreateKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.key); + if (error) + return "key." + error; + } + return null; + }; + + /** + * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} CreateKeyRequest + */ + CreateKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.CreateKeyRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.CreateKeyRequest.key: object expected"); + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.key); + } + return message; + }; + + /** + * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.CreateKeyRequest} message CreateKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.key = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.key, options); + return object; + }; + + /** + * Converts this CreateKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.CreateKeyRequest + * @instance + * @returns {Object.} JSON object + */ + CreateKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateKeyRequest; + })(); + + v1.ListKeysRequest = (function() { + + /** + * Properties of a ListKeysRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListKeysRequest + * @property {string|null} [parent] ListKeysRequest parent + * @property {number|null} [pageSize] ListKeysRequest pageSize + * @property {string|null} [pageToken] ListKeysRequest pageToken + */ + + /** + * Constructs a new ListKeysRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListKeysRequest. + * @implements IListKeysRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest=} [properties] Properties to set + */ + function ListKeysRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKeysRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + */ + ListKeysRequest.prototype.parent = ""; + + /** + * ListKeysRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + */ + ListKeysRequest.prototype.pageSize = 0; + + /** + * ListKeysRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + */ + ListKeysRequest.prototype.pageToken = ""; + + /** + * Creates a new ListKeysRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest instance + */ + ListKeysRequest.create = function create(properties) { + return new ListKeysRequest(properties); + }; + + /** + * Encodes the specified ListKeysRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} message ListKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListKeysRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysRequest} message ListKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKeysRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKeysRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListKeysRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysRequest} ListKeysRequest + */ + ListKeysRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListKeysRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListKeysRequest} message ListKeysRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKeysRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListKeysRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysRequest + * @instance + * @returns {Object.} JSON object + */ + ListKeysRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListKeysRequest; + })(); + + v1.ListKeysResponse = (function() { + + /** + * Properties of a ListKeysResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IListKeysResponse + * @property {Array.|null} [keys] ListKeysResponse keys + * @property {string|null} [nextPageToken] ListKeysResponse nextPageToken + */ + + /** + * Constructs a new ListKeysResponse. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a ListKeysResponse. + * @implements IListKeysResponse + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set + */ + function ListKeysResponse(properties) { + this.keys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKeysResponse keys. + * @member {Array.} keys + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + */ + ListKeysResponse.prototype.keys = $util.emptyArray; + + /** + * ListKeysResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + */ + ListKeysResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListKeysResponse instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse instance + */ + ListKeysResponse.create = function create(properties) { + return new ListKeysResponse(properties); + }; + + /** + * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.keys[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.ListKeysResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.IListKeysResponse} message ListKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push($root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKeysResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeysResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKeysResponse message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKeysResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) { + var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.keys[i]); + if (error) + return "keys." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListKeysResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.ListKeysResponse} ListKeysResponse + */ + ListKeysResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.ListKeysResponse(); + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) { + if (typeof object.keys[i] !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.ListKeysResponse.keys: object expected"); + message.keys[i] = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.keys[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListKeysResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @static + * @param {google.cloud.recaptchaenterprise.v1.ListKeysResponse} message ListKeysResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKeysResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keys = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.keys[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListKeysResponse to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.ListKeysResponse + * @instance + * @returns {Object.} JSON object + */ + ListKeysResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListKeysResponse; + })(); + + v1.GetKeyRequest = (function() { + + /** + * Properties of a GetKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IGetKeyRequest + * @property {string|null} [name] GetKeyRequest name + */ + + /** + * Constructs a new GetKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a GetKeyRequest. + * @implements IGetKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest=} [properties] Properties to set + */ + function GetKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetKeyRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @instance + */ + GetKeyRequest.prototype.name = ""; + + /** + * Creates a new GetKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest instance + */ + GetKeyRequest.create = function create(properties) { + return new GetKeyRequest(properties); + }; + + /** + * Encodes the specified GetKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} message GetKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.GetKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IGetKeyRequest} message GetKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.GetKeyRequest} GetKeyRequest + */ + GetKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.GetKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.GetKeyRequest} message GetKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.GetKeyRequest + * @instance + * @returns {Object.} JSON object + */ + GetKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetKeyRequest; + })(); + + v1.UpdateKeyRequest = (function() { + + /** + * Properties of an UpdateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IUpdateKeyRequest + * @property {google.cloud.recaptchaenterprise.v1.IKey|null} [key] UpdateKeyRequest key + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateKeyRequest updateMask + */ + + /** + * Constructs a new UpdateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an UpdateKeyRequest. + * @implements IUpdateKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest=} [properties] Properties to set + */ + function UpdateKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateKeyRequest key. + * @member {google.cloud.recaptchaenterprise.v1.IKey|null|undefined} key + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @instance + */ + UpdateKeyRequest.prototype.key = null; + + /** + * UpdateKeyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @instance + */ + UpdateKeyRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest instance + */ + UpdateKeyRequest.create = function create(properties) { + return new UpdateKeyRequest(properties); + }; + + /** + * Encodes the specified UpdateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} message UpdateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && message.hasOwnProperty("key")) + $root.google.cloud.recaptchaenterprise.v1.Key.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest} message UpdateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.google.cloud.recaptchaenterprise.v1.Key.verify(message.key); + if (error) + return "key." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} UpdateKeyRequest + */ + UpdateKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.UpdateKeyRequest(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.key: object expected"); + message.key = $root.google.cloud.recaptchaenterprise.v1.Key.fromObject(object.key); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.UpdateKeyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.UpdateKeyRequest} message UpdateKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.updateMask = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.google.cloud.recaptchaenterprise.v1.Key.toObject(message.key, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.UpdateKeyRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateKeyRequest; + })(); + + v1.DeleteKeyRequest = (function() { + + /** + * Properties of a DeleteKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IDeleteKeyRequest + * @property {string|null} [name] DeleteKeyRequest name + */ + + /** + * Constructs a new DeleteKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a DeleteKeyRequest. + * @implements IDeleteKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest=} [properties] Properties to set + */ + function DeleteKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteKeyRequest name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @instance + */ + DeleteKeyRequest.prototype.name = ""; + + /** + * Creates a new DeleteKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest instance + */ + DeleteKeyRequest.create = function create(properties) { + return new DeleteKeyRequest(properties); + }; + + /** + * Encodes the specified DeleteKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} message DeleteKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.DeleteKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest} message DeleteKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} DeleteKeyRequest + */ + DeleteKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.DeleteKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1.DeleteKeyRequest} message DeleteKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.DeleteKeyRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteKeyRequest; + })(); + + v1.Key = (function() { + + /** + * Properties of a Key. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IKey + * @property {string|null} [name] Key name + * @property {string|null} [displayName] Key displayName + * @property {google.cloud.recaptchaenterprise.v1.IWebKeySettings|null} [webSettings] Key webSettings + * @property {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null} [androidSettings] Key androidSettings + * @property {google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null} [iosSettings] Key iosSettings + * @property {Object.|null} [labels] Key labels + * @property {google.protobuf.ITimestamp|null} [createTime] Key createTime + */ + + /** + * Constructs a new Key. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a Key. + * @implements IKey + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IKey=} [properties] Properties to set + */ + function Key(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Key name. + * @member {string} name + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.name = ""; + + /** + * Key displayName. + * @member {string} displayName + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.displayName = ""; + + /** + * Key webSettings. + * @member {google.cloud.recaptchaenterprise.v1.IWebKeySettings|null|undefined} webSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.webSettings = null; + + /** + * Key androidSettings. + * @member {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings|null|undefined} androidSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.androidSettings = null; + + /** + * Key iosSettings. + * @member {google.cloud.recaptchaenterprise.v1.IIOSKeySettings|null|undefined} iosSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.iosSettings = null; + + /** + * Key labels. + * @member {Object.} labels + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.labels = $util.emptyObject; + + /** + * Key createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Key.prototype.createTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Key platformSettings. + * @member {"webSettings"|"androidSettings"|"iosSettings"|undefined} platformSettings + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + */ + Object.defineProperty(Key.prototype, "platformSettings", { + get: $util.oneOfGetter($oneOfFields = ["webSettings", "androidSettings", "iosSettings"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Key instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.IKey=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key instance + */ + Key.create = function create(properties) { + return new Key(properties); + }; + + /** + * Encodes the specified Key message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.IKey} message Key message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Key.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && message.hasOwnProperty("displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.webSettings != null && message.hasOwnProperty("webSettings")) + $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.encode(message.webSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.androidSettings != null && message.hasOwnProperty("androidSettings")) + $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.encode(message.androidSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.iosSettings != null && message.hasOwnProperty("iosSettings")) + $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.encode(message.iosSettings, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.labels != null && message.hasOwnProperty("labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Key message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.Key.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.IKey} message Key message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Key.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Key message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Key.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.Key(), key; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.webSettings = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.decode(reader, reader.uint32()); + break; + case 4: + message.androidSettings = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.decode(reader, reader.uint32()); + break; + case 5: + message.iosSettings = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.decode(reader, reader.uint32()); + break; + case 6: + reader.skip().pos++; + if (message.labels === $util.emptyObject) + message.labels = {}; + key = reader.string(); + reader.pos++; + message.labels[key] = reader.string(); + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Key message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Key.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Key message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Key.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.webSettings != null && message.hasOwnProperty("webSettings")) { + properties.platformSettings = 1; + { + var error = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.verify(message.webSettings); + if (error) + return "webSettings." + error; + } + } + if (message.androidSettings != null && message.hasOwnProperty("androidSettings")) { + if (properties.platformSettings === 1) + return "platformSettings: multiple values"; + properties.platformSettings = 1; + { + var error = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify(message.androidSettings); + if (error) + return "androidSettings." + error; + } + } + if (message.iosSettings != null && message.hasOwnProperty("iosSettings")) { + if (properties.platformSettings === 1) + return "platformSettings: multiple values"; + properties.platformSettings = 1; + { + var error = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify(message.iosSettings); + if (error) + return "iosSettings." + error; + } + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a Key message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.Key} Key + */ + Key.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.Key) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.Key(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.webSettings != null) { + if (typeof object.webSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.webSettings: object expected"); + message.webSettings = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.fromObject(object.webSettings); + } + if (object.androidSettings != null) { + if (typeof object.androidSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.androidSettings: object expected"); + message.androidSettings = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.fromObject(object.androidSettings); + } + if (object.iosSettings != null) { + if (typeof object.iosSettings !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.iosSettings: object expected"); + message.iosSettings = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.fromObject(object.iosSettings); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1.Key.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a Key message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @static + * @param {google.cloud.recaptchaenterprise.v1.Key} message Key + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Key.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.createTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.webSettings != null && message.hasOwnProperty("webSettings")) { + object.webSettings = $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.toObject(message.webSettings, options); + if (options.oneofs) + object.platformSettings = "webSettings"; + } + if (message.androidSettings != null && message.hasOwnProperty("androidSettings")) { + object.androidSettings = $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings.toObject(message.androidSettings, options); + if (options.oneofs) + object.platformSettings = "androidSettings"; + } + if (message.iosSettings != null && message.hasOwnProperty("iosSettings")) { + object.iosSettings = $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings.toObject(message.iosSettings, options); + if (options.oneofs) + object.platformSettings = "iosSettings"; + } + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this Key to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.Key + * @instance + * @returns {Object.} JSON object + */ + Key.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Key; + })(); + + v1.WebKeySettings = (function() { + + /** + * Properties of a WebKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IWebKeySettings + * @property {boolean|null} [allowAllDomains] WebKeySettings allowAllDomains + * @property {Array.|null} [allowedDomains] WebKeySettings allowedDomains + * @property {boolean|null} [allowAmpTraffic] WebKeySettings allowAmpTraffic + * @property {google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType|null} [integrationType] WebKeySettings integrationType + * @property {google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference|null} [challengeSecurityPreference] WebKeySettings challengeSecurityPreference + */ + + /** + * Constructs a new WebKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a WebKeySettings. + * @implements IWebKeySettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings=} [properties] Properties to set + */ + function WebKeySettings(properties) { + this.allowedDomains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebKeySettings allowAllDomains. + * @member {boolean} allowAllDomains + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.allowAllDomains = false; + + /** + * WebKeySettings allowedDomains. + * @member {Array.} allowedDomains + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.allowedDomains = $util.emptyArray; + + /** + * WebKeySettings allowAmpTraffic. + * @member {boolean} allowAmpTraffic + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.allowAmpTraffic = false; + + /** + * WebKeySettings integrationType. + * @member {google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType} integrationType + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.integrationType = 0; + + /** + * WebKeySettings challengeSecurityPreference. + * @member {google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference} challengeSecurityPreference + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + */ + WebKeySettings.prototype.challengeSecurityPreference = 0; + + /** + * Creates a new WebKeySettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings instance + */ + WebKeySettings.create = function create(properties) { + return new WebKeySettings(properties); + }; + + /** + * Encodes the specified WebKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings} message WebKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebKeySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedDomains != null && message.allowedDomains.length) + for (var i = 0; i < message.allowedDomains.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedDomains[i]); + if (message.allowAmpTraffic != null && message.hasOwnProperty("allowAmpTraffic")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAmpTraffic); + if (message.allowAllDomains != null && message.hasOwnProperty("allowAllDomains")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowAllDomains); + if (message.integrationType != null && message.hasOwnProperty("integrationType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.integrationType); + if (message.challengeSecurityPreference != null && message.hasOwnProperty("challengeSecurityPreference")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.challengeSecurityPreference); + return writer; + }; + + /** + * Encodes the specified WebKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.WebKeySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IWebKeySettings} message WebKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebKeySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebKeySettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.WebKeySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.allowAllDomains = reader.bool(); + break; + case 1: + if (!(message.allowedDomains && message.allowedDomains.length)) + message.allowedDomains = []; + message.allowedDomains.push(reader.string()); + break; + case 2: + message.allowAmpTraffic = reader.bool(); + break; + case 4: + message.integrationType = reader.int32(); + break; + case 5: + message.challengeSecurityPreference = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebKeySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebKeySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebKeySettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebKeySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAllDomains != null && message.hasOwnProperty("allowAllDomains")) + if (typeof message.allowAllDomains !== "boolean") + return "allowAllDomains: boolean expected"; + if (message.allowedDomains != null && message.hasOwnProperty("allowedDomains")) { + if (!Array.isArray(message.allowedDomains)) + return "allowedDomains: array expected"; + for (var i = 0; i < message.allowedDomains.length; ++i) + if (!$util.isString(message.allowedDomains[i])) + return "allowedDomains: string[] expected"; + } + if (message.allowAmpTraffic != null && message.hasOwnProperty("allowAmpTraffic")) + if (typeof message.allowAmpTraffic !== "boolean") + return "allowAmpTraffic: boolean expected"; + if (message.integrationType != null && message.hasOwnProperty("integrationType")) + switch (message.integrationType) { + default: + return "integrationType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.challengeSecurityPreference != null && message.hasOwnProperty("challengeSecurityPreference")) + switch (message.challengeSecurityPreference) { + default: + return "challengeSecurityPreference: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a WebKeySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.WebKeySettings} WebKeySettings + */ + WebKeySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.WebKeySettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.WebKeySettings(); + if (object.allowAllDomains != null) + message.allowAllDomains = Boolean(object.allowAllDomains); + if (object.allowedDomains) { + if (!Array.isArray(object.allowedDomains)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.WebKeySettings.allowedDomains: array expected"); + message.allowedDomains = []; + for (var i = 0; i < object.allowedDomains.length; ++i) + message.allowedDomains[i] = String(object.allowedDomains[i]); + } + if (object.allowAmpTraffic != null) + message.allowAmpTraffic = Boolean(object.allowAmpTraffic); + switch (object.integrationType) { + case "INTEGRATION_TYPE_UNSPECIFIED": + case 0: + message.integrationType = 0; + break; + case "SCORE": + case 1: + message.integrationType = 1; + break; + case "CHECKBOX": + case 2: + message.integrationType = 2; + break; + case "INVISIBLE": + case 3: + message.integrationType = 3; + break; + } + switch (object.challengeSecurityPreference) { + case "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED": + case 0: + message.challengeSecurityPreference = 0; + break; + case "USABILITY": + case 1: + message.challengeSecurityPreference = 1; + break; + case "BALANCE": + case 2: + message.challengeSecurityPreference = 2; + break; + case "SECURITY": + case 3: + message.challengeSecurityPreference = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a WebKeySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.WebKeySettings} message WebKeySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebKeySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.allowedDomains = []; + if (options.defaults) { + object.allowAmpTraffic = false; + object.allowAllDomains = false; + object.integrationType = options.enums === String ? "INTEGRATION_TYPE_UNSPECIFIED" : 0; + object.challengeSecurityPreference = options.enums === String ? "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED" : 0; + } + if (message.allowedDomains && message.allowedDomains.length) { + object.allowedDomains = []; + for (var j = 0; j < message.allowedDomains.length; ++j) + object.allowedDomains[j] = message.allowedDomains[j]; + } + if (message.allowAmpTraffic != null && message.hasOwnProperty("allowAmpTraffic")) + object.allowAmpTraffic = message.allowAmpTraffic; + if (message.allowAllDomains != null && message.hasOwnProperty("allowAllDomains")) + object.allowAllDomains = message.allowAllDomains; + if (message.integrationType != null && message.hasOwnProperty("integrationType")) + object.integrationType = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType[message.integrationType] : message.integrationType; + if (message.challengeSecurityPreference != null && message.hasOwnProperty("challengeSecurityPreference")) + object.challengeSecurityPreference = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference[message.challengeSecurityPreference] : message.challengeSecurityPreference; + return object; + }; + + /** + * Converts this WebKeySettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.WebKeySettings + * @instance + * @returns {Object.} JSON object + */ + WebKeySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * IntegrationType enum. + * @name google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType + * @enum {string} + * @property {number} INTEGRATION_TYPE_UNSPECIFIED=0 INTEGRATION_TYPE_UNSPECIFIED value + * @property {number} SCORE=1 SCORE value + * @property {number} CHECKBOX=2 CHECKBOX value + * @property {number} INVISIBLE=3 INVISIBLE value + */ + WebKeySettings.IntegrationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INTEGRATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SCORE"] = 1; + values[valuesById[2] = "CHECKBOX"] = 2; + values[valuesById[3] = "INVISIBLE"] = 3; + return values; + })(); + + /** + * ChallengeSecurityPreference enum. + * @name google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference + * @enum {string} + * @property {number} CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED=0 CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED value + * @property {number} USABILITY=1 USABILITY value + * @property {number} BALANCE=2 BALANCE value + * @property {number} SECURITY=3 SECURITY value + */ + WebKeySettings.ChallengeSecurityPreference = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED"] = 0; + values[valuesById[1] = "USABILITY"] = 1; + values[valuesById[2] = "BALANCE"] = 2; + values[valuesById[3] = "SECURITY"] = 3; + return values; + })(); + + return WebKeySettings; + })(); + + v1.AndroidKeySettings = (function() { + + /** + * Properties of an AndroidKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IAndroidKeySettings + * @property {Array.|null} [allowedPackageNames] AndroidKeySettings allowedPackageNames + */ + + /** + * Constructs a new AndroidKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents an AndroidKeySettings. + * @implements IAndroidKeySettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings=} [properties] Properties to set + */ + function AndroidKeySettings(properties) { + this.allowedPackageNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AndroidKeySettings allowedPackageNames. + * @member {Array.} allowedPackageNames + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @instance + */ + AndroidKeySettings.prototype.allowedPackageNames = $util.emptyArray; + + /** + * Creates a new AndroidKeySettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings instance + */ + AndroidKeySettings.create = function create(properties) { + return new AndroidKeySettings(properties); + }; + + /** + * Encodes the specified AndroidKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings} message AndroidKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AndroidKeySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedPackageNames != null && message.allowedPackageNames.length) + for (var i = 0; i < message.allowedPackageNames.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedPackageNames[i]); + return writer; + }; + + /** + * Encodes the specified AndroidKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.AndroidKeySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IAndroidKeySettings} message AndroidKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AndroidKeySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AndroidKeySettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.allowedPackageNames && message.allowedPackageNames.length)) + message.allowedPackageNames = []; + message.allowedPackageNames.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AndroidKeySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AndroidKeySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AndroidKeySettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AndroidKeySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowedPackageNames != null && message.hasOwnProperty("allowedPackageNames")) { + if (!Array.isArray(message.allowedPackageNames)) + return "allowedPackageNames: array expected"; + for (var i = 0; i < message.allowedPackageNames.length; ++i) + if (!$util.isString(message.allowedPackageNames[i])) + return "allowedPackageNames: string[] expected"; + } + return null; + }; + + /** + * Creates an AndroidKeySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} AndroidKeySettings + */ + AndroidKeySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.AndroidKeySettings(); + if (object.allowedPackageNames) { + if (!Array.isArray(object.allowedPackageNames)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.AndroidKeySettings.allowedPackageNames: array expected"); + message.allowedPackageNames = []; + for (var i = 0; i < object.allowedPackageNames.length; ++i) + message.allowedPackageNames[i] = String(object.allowedPackageNames[i]); + } + return message; + }; + + /** + * Creates a plain object from an AndroidKeySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.AndroidKeySettings} message AndroidKeySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AndroidKeySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.allowedPackageNames = []; + if (message.allowedPackageNames && message.allowedPackageNames.length) { + object.allowedPackageNames = []; + for (var j = 0; j < message.allowedPackageNames.length; ++j) + object.allowedPackageNames[j] = message.allowedPackageNames[j]; + } + return object; + }; + + /** + * Converts this AndroidKeySettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.AndroidKeySettings + * @instance + * @returns {Object.} JSON object + */ + AndroidKeySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AndroidKeySettings; + })(); + + v1.IOSKeySettings = (function() { + + /** + * Properties of a IOSKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @interface IIOSKeySettings + * @property {Array.|null} [allowedBundleIds] IOSKeySettings allowedBundleIds + */ + + /** + * Constructs a new IOSKeySettings. + * @memberof google.cloud.recaptchaenterprise.v1 + * @classdesc Represents a IOSKeySettings. + * @implements IIOSKeySettings + * @constructor + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings=} [properties] Properties to set + */ + function IOSKeySettings(properties) { + this.allowedBundleIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IOSKeySettings allowedBundleIds. + * @member {Array.} allowedBundleIds + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @instance + */ + IOSKeySettings.prototype.allowedBundleIds = $util.emptyArray; + + /** + * Creates a new IOSKeySettings instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings instance + */ + IOSKeySettings.create = function create(properties) { + return new IOSKeySettings(properties); + }; + + /** + * Encodes the specified IOSKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings} message IOSKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IOSKeySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedBundleIds != null && message.allowedBundleIds.length) + for (var i = 0; i < message.allowedBundleIds.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedBundleIds[i]); + return writer; + }; + + /** + * Encodes the specified IOSKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1.IOSKeySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IIOSKeySettings} message IOSKeySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IOSKeySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IOSKeySettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.allowedBundleIds && message.allowedBundleIds.length)) + message.allowedBundleIds = []; + message.allowedBundleIds.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a IOSKeySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IOSKeySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a IOSKeySettings message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IOSKeySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowedBundleIds != null && message.hasOwnProperty("allowedBundleIds")) { + if (!Array.isArray(message.allowedBundleIds)) + return "allowedBundleIds: array expected"; + for (var i = 0; i < message.allowedBundleIds.length; ++i) + if (!$util.isString(message.allowedBundleIds[i])) + return "allowedBundleIds: string[] expected"; + } + return null; + }; + + /** + * Creates a IOSKeySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1.IOSKeySettings} IOSKeySettings + */ + IOSKeySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1.IOSKeySettings(); + if (object.allowedBundleIds) { + if (!Array.isArray(object.allowedBundleIds)) + throw TypeError(".google.cloud.recaptchaenterprise.v1.IOSKeySettings.allowedBundleIds: array expected"); + message.allowedBundleIds = []; + for (var i = 0; i < object.allowedBundleIds.length; ++i) + message.allowedBundleIds[i] = String(object.allowedBundleIds[i]); + } + return message; + }; + + /** + * Creates a plain object from a IOSKeySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @static + * @param {google.cloud.recaptchaenterprise.v1.IOSKeySettings} message IOSKeySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IOSKeySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.allowedBundleIds = []; + if (message.allowedBundleIds && message.allowedBundleIds.length) { + object.allowedBundleIds = []; + for (var j = 0; j < message.allowedBundleIds.length; ++j) + object.allowedBundleIds[j] = message.allowedBundleIds[j]; + } + return object; + }; + + /** + * Converts this IOSKeySettings to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1.IOSKeySettings + * @instance + * @returns {Object.} JSON object + */ + IOSKeySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IOSKeySettings; + })(); + + return v1; + })(); + recaptchaenterprise.v1beta1 = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index f71a34b..371c77f 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -6,6 +6,483 @@ "nested": { "recaptchaenterprise": { "nested": { + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.RecaptchaEnterprise.V1", + "go_package": "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1;recaptchaenterprise", + "java_multiple_files": true, + "java_outer_classname": "RecaptchaEnterpriseProto", + "java_package": "com.google.recaptchaenterprise.v1", + "objc_class_prefix": "GCRE", + "php_namespace": "Google\\Cloud\\RecaptchaEnterprise\\V1" + }, + "nested": { + "RecaptchaEnterpriseService": { + "options": { + "(google.api.default_host)": "recaptchaenterprise.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateAssessment": { + "requestType": "CreateAssessmentRequest", + "responseType": "Assessment", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/assessments", + "(google.api.http).body": "assessment", + "(google.api.method_signature)": "parent,assessment" + } + }, + "AnnotateAssessment": { + "requestType": "AnnotateAssessmentRequest", + "responseType": "AnnotateAssessmentResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/assessments/*}:annotate", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,annotation" + } + }, + "CreateKey": { + "requestType": "CreateKeyRequest", + "responseType": "Key", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/keys", + "(google.api.http).body": "key" + } + }, + "ListKeys": { + "requestType": "ListKeysRequest", + "responseType": "ListKeysResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*}/keys" + } + }, + "GetKey": { + "requestType": "GetKeyRequest", + "responseType": "Key", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/keys/*}" + } + }, + "UpdateKey": { + "requestType": "UpdateKeyRequest", + "responseType": "Key", + "options": { + "(google.api.http).patch": "/v1/{key.name=projects/*/keys/*}", + "(google.api.http).body": "key" + } + }, + "DeleteKey": { + "requestType": "DeleteKeyRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/keys/*}" + } + } + } + }, + "CreateAssessmentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "assessment": { + "type": "Assessment", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AnnotateAssessmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Assessment" + } + }, + "annotation": { + "type": "Annotation", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "Annotation": { + "values": { + "ANNOTATION_UNSPECIFIED": 0, + "LEGITIMATE": 1, + "FRAUDULENT": 2, + "PASSWORD_CORRECT": 3, + "PASSWORD_INCORRECT": 4 + } + } + } + }, + "AnnotateAssessmentResponse": { + "fields": {} + }, + "Assessment": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Assessment", + "(google.api.resource).pattern": "projects/{project}/assessments/{assessment}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "event": { + "type": "Event", + "id": 2 + }, + "riskAnalysis": { + "type": "RiskAnalysis", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "tokenProperties": { + "type": "TokenProperties", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "Event": { + "fields": { + "token": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "siteKey": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userAgent": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userIpAddress": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "expectedAction": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "RiskAnalysis": { + "fields": { + "score": { + "type": "float", + "id": 1 + }, + "reasons": { + "rule": "repeated", + "type": "ClassificationReason", + "id": 2 + } + }, + "nested": { + "ClassificationReason": { + "values": { + "CLASSIFICATION_REASON_UNSPECIFIED": 0, + "AUTOMATION": 1, + "UNEXPECTED_ENVIRONMENT": 2, + "TOO_MUCH_TRAFFIC": 3, + "UNEXPECTED_USAGE_PATTERNS": 4, + "LOW_CONFIDENCE_SCORE": 5 + } + } + } + }, + "TokenProperties": { + "fields": { + "valid": { + "type": "bool", + "id": 1 + }, + "invalidReason": { + "type": "InvalidReason", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "hostname": { + "type": "string", + "id": 4 + }, + "action": { + "type": "string", + "id": 5 + } + }, + "nested": { + "InvalidReason": { + "values": { + "INVALID_REASON_UNSPECIFIED": 0, + "UNKNOWN_INVALID_REASON": 1, + "MALFORMED": 2, + "EXPIRED": 3, + "DUPE": 4, + "MISSING": 5 + } + } + } + }, + "CreateKeyRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "key": { + "type": "Key", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListKeysRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListKeysResponse": { + "fields": { + "keys": { + "rule": "repeated", + "type": "Key", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "UpdateKeyRequest": { + "fields": { + "key": { + "type": "Key", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "Key": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Key", + "(google.api.resource).pattern": "projects/{project}/keys/{key}" + }, + "oneofs": { + "platformSettings": { + "oneof": [ + "webSettings", + "androidSettings", + "iosSettings" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "webSettings": { + "type": "WebKeySettings", + "id": 3 + }, + "androidSettings": { + "type": "AndroidKeySettings", + "id": 4 + }, + "iosSettings": { + "type": "IOSKeySettings", + "id": 5 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + } + } + }, + "WebKeySettings": { + "fields": { + "allowAllDomains": { + "type": "bool", + "id": 3 + }, + "allowedDomains": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "allowAmpTraffic": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "integrationType": { + "type": "IntegrationType", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "challengeSecurityPreference": { + "type": "ChallengeSecurityPreference", + "id": 5 + } + }, + "nested": { + "IntegrationType": { + "values": { + "INTEGRATION_TYPE_UNSPECIFIED": 0, + "SCORE": 1, + "CHECKBOX": 2, + "INVISIBLE": 3 + } + }, + "ChallengeSecurityPreference": { + "values": { + "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED": 0, + "USABILITY": 1, + "BALANCE": 2, + "SECURITY": 3 + } + } + } + }, + "AndroidKeySettings": { + "fields": { + "allowedPackageNames": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "IOSKeySettings": { + "fields": { + "allowedBundleIds": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } + }, "v1beta1": { "options": { "csharp_namespace": "Google.Cloud.RecaptchaEnterprise.V1Beta1", diff --git a/samples/quickstart.js b/samples/quickstart.js index 170c977..4785a4e 100644 --- a/samples/quickstart.js +++ b/samples/quickstart.js @@ -22,9 +22,9 @@ async function main(projectNumber) { // Create the reCAPTCHA client library. const { - RecaptchaEnterpriseServiceV1Beta1Client, + RecaptchaEnterpriseServiceClient, } = require('@google-cloud/recaptcha-enterprise'); - const client = new RecaptchaEnterpriseServiceV1Beta1Client(); + const client = new RecaptchaEnterpriseServiceClient(); // format the path to the project (it should be prefaced with projects/). const formattedParent = client.projectPath(projectNumber); diff --git a/samples/test/samples.test.js b/samples/test/samples.test.js index e3a3e6b..d24c716 100644 --- a/samples/test/samples.test.js +++ b/samples/test/samples.test.js @@ -27,6 +27,6 @@ describe('Quickstart', () => { // TODO: work on setting up a proper integration test. assert.throws(() => { execSync(`node quickstart.js 123456`, {cwd}); - }, /Requested entity was not found/); + }, /Permission denied on resource project #123456/); }); }); diff --git a/src/index.ts b/src/index.ts index 2370fbe..1b192b8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,11 +17,13 @@ // ** All changes to this file may be overwritten. ** import * as v1beta1 from './v1beta1'; +import * as v1 from './v1'; const RecaptchaEnterpriseServiceV1Beta1Client = v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; -export {v1beta1, RecaptchaEnterpriseServiceV1Beta1Client}; +const RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; +export {v1, v1beta1, RecaptchaEnterpriseServiceV1Beta1Client, RecaptchaEnterpriseServiceClient}; // For compatibility with JavaScript libraries we need to provide this default export: // tslint:disable-next-line no-default-export -export default {v1beta1, RecaptchaEnterpriseServiceV1Beta1Client}; +export default {v1, v1beta1, RecaptchaEnterpriseServiceV1Beta1Client, RecaptchaEnterpriseServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/src/v1/index.ts b/src/v1/index.ts new file mode 100644 index 0000000..3759da4 --- /dev/null +++ b/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR 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/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts new file mode 100644 index 0000000..bf61e9d --- /dev/null +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -0,0 +1,1080 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR 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 gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + PaginationResponse, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import * as protosTypes from '../../protos/protos'; +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 _descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + private _opts: ClientOptions; + 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; + recaptchaEnterpriseServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RecaptchaEnterpriseServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @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. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this + .constructor as typeof RecaptchaEnterpriseServiceClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this + .constructor as typeof RecaptchaEnterpriseServiceClient).scopes; + 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; + + // 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}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // 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}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this._descriptors.page = { + listKeys: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'keys' + ), + }; + + // 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 = {}; + } + + /** + * 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' + ) + : // tslint:disable-next-line no-any + (this._protos as any).google.cloud.recaptchaenterprise.v1 + .RecaptchaEnterpriseService, + this._opts + ) 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', + ]; + + for (const methodName of recaptchaEnterpriseServiceStubMethods) { + const innerCallPromise = 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 apiCall = this._gaxModule.createApiCall( + innerCallPromise, + this._defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + + return this.recaptchaEnterpriseServiceStub; + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'recaptchaenterprise.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'recaptchaenterprise.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + 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. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createAssessment( + request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IAssessment, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | undefined + ), + {} | undefined + ] + >; + createAssessment( + request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IAssessment, + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | undefined, + {} | undefined + > + ): void; + /** + * 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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createAssessment( + request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IAssessment, + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IAssessment, + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IAssessment, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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); + } + annotateAssessment( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | undefined + ), + {} | undefined + ] + >; + annotateAssessment( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + | protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | undefined, + {} | undefined + > + ): void; + /** + * 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}/assessments/{assessment}". + * @param {google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation} request.annotation + * Required. The annotation that will be assigned to the Event. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + annotateAssessment( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + | protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + | protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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); + } + createKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | undefined + ), + {} | undefined + ] + >; + createKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | undefined, + {} | undefined + > + ): void; + /** + * 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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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); + } + getKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | undefined + ), + {} | undefined + ] + >; + getKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | undefined, + {} | undefined + > + ): void; + /** + * 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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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); + } + updateKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | undefined + ), + {} | undefined + ] + >; + updateKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | undefined, + {} | undefined + > + ): void; + /** + * 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 field 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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + | protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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); + } + deleteKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | undefined + ), + {} | undefined + ] + >; + deleteKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | undefined, + {} | undefined + > + ): void; + /** + * 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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteKey( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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); + } + + listKeys( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey[], + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest | null, + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysResponse + ] + >; + listKeys( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey[], + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest | null, + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysResponse + > + ): void; + /** + * 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 support 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. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Key]{@link google.cloud.recaptchaenterprise.v1.Key} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListKeysRequest]{@link google.cloud.recaptchaenterprise.v1.ListKeysRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListKeysResponse]{@link google.cloud.recaptchaenterprise.v1.ListKeysResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listKeys( + request: protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey[], + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest | null, + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysResponse + >, + callback?: Callback< + protosTypes.google.cloud.recaptchaenterprise.v1.IKey[], + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest | null, + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysResponse + > + ): Promise< + [ + protosTypes.google.cloud.recaptchaenterprise.v1.IKey[], + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest | null, + protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.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 {@link listKeys}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listKeys} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @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. + */ + listKeysStream( + request?: protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest, + options?: gax.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 callSettings = new gax.CallSettings(options); + this.initialize(); + return this._descriptors.page.listKeys.createStream( + this._innerApiCalls.listKeys as gax.GaxCall, + request, + callSettings + ); + } + // -------------------- + // -- 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, + 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, + 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 project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this._pathTemplates.projectPathTemplate.render({ + 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. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.recaptchaEnterpriseServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v1/recaptcha_enterprise_service_client_config.json b/src/v1/recaptcha_enterprise_service_client_config.json new file mode 100644 index 0000000..20e3110 --- /dev/null +++ b/src/v1/recaptcha_enterprise_service_client_config.json @@ -0,0 +1,61 @@ +{ + "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" + } + } + } + } +} diff --git a/src/v1/recaptcha_enterprise_service_proto_list.json b/src/v1/recaptcha_enterprise_service_proto_list.json new file mode 100644 index 0000000..790fef9 --- /dev/null +++ b/src/v1/recaptcha_enterprise_service_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto" +] diff --git a/src/v1beta1/index.ts b/src/v1beta1/index.ts index 879b003..1361289 100644 --- a/src/v1beta1/index.ts +++ b/src/v1beta1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index b8c39a5..ab23a5c 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,7 +40,12 @@ const version = require('../../../package.json').version; * @memberof v1beta1 */ export class RecaptchaEnterpriseServiceV1Beta1Client { - private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; private _innerApiCalls: {[name: string]: Function}; private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; @@ -234,7 +239,8 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { if (this._terminated) { return Promise.reject('The client has already been closed.'); } - return stub[methodName].apply(stub, args); + const func = stub[methodName]; + return func.apply(stub, args); }, (err: Error | null | undefined) => () => { throw err; diff --git a/synth.metadata b/synth.metadata index 40ceba4..3fe97aa 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,24 +1,26 @@ { - "updateTime": "2020-03-05T23:13:05.861046Z", + "updateTime": "2020-03-24T22:49:54.494972Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "f0b581b5bdf803e45201ecdb3688b60e381628a8", - "internalRef": "299181282", - "log": "f0b581b5bdf803e45201ecdb3688b60e381628a8\nfix: recommendationengine/v1beta1 update some comments\n\nPiperOrigin-RevId: 299181282\n\n10e9a0a833dc85ff8f05b2c67ebe5ac785fe04ff\nbuild: add generated BUILD file for Routes Preferred API\n\nPiperOrigin-RevId: 299164808\n\n86738c956a8238d7c77f729be78b0ed887a6c913\npublish v1p1beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299152383\n\n73d9f2ad4591de45c2e1f352bc99d70cbd2a6d95\npublish v1: update with absolute address in comments\n\nPiperOrigin-RevId: 299147194\n\nd2158f24cb77b0b0ccfe68af784c6a628705e3c6\npublish v1beta2: update with absolute address in comments\n\nPiperOrigin-RevId: 299147086\n\n7fca61292c11b4cd5b352cee1a50bf88819dd63b\npublish v1p2beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146903\n\n583b7321624736e2c490e328f4b1957335779295\npublish v1p3beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146674\n\n638253bf86d1ce1c314108a089b7351440c2f0bf\nfix: add java_multiple_files option for automl text_sentiment.proto\n\nPiperOrigin-RevId: 298971070\n\n373d655703bf914fb8b0b1cc4071d772bac0e0d1\nUpdate Recs AI Beta public bazel file\n\nPiperOrigin-RevId: 298961623\n\ndcc5d00fc8a8d8b56f16194d7c682027b2c66a3b\nfix: add java_multiple_files option for automl classification.proto\n\nPiperOrigin-RevId: 298953301\n\na3f791827266f3496a6a5201d58adc4bb265c2a3\nchore: automl/v1 publish annotations and retry config\n\nPiperOrigin-RevId: 298942178\n\n01c681586d8d6dbd60155289b587aee678530bd9\nMark return_immediately in PullRequest deprecated.\n\nPiperOrigin-RevId: 298893281\n\nc9f5e9c4bfed54bbd09227e990e7bded5f90f31c\nRemove out of date documentation for predicate support on the Storage API\n\nPiperOrigin-RevId: 298883309\n\nfd5b3b8238d783b04692a113ffe07c0363f5de0f\ngenerate webrisk v1 proto\n\nPiperOrigin-RevId: 298847934\n\n541b1ded4abadcc38e8178680b0677f65594ea6f\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 298686266\n\nc0d171acecb4f5b0bfd2c4ca34fc54716574e300\n Updated to include the Notification v1 API.\n\nPiperOrigin-RevId: 298652775\n\n2346a9186c0bff2c9cc439f2459d558068637e05\nAdd Service Directory v1beta1 protos and configs\n\nPiperOrigin-RevId: 298625638\n\na78ed801b82a5c6d9c5368e24b1412212e541bb7\nPublishing v3 protos and configs.\n\nPiperOrigin-RevId: 298607357\n\n4a180bfff8a21645b3a935c2756e8d6ab18a74e0\nautoml/v1beta1 publish proto updates\n\nPiperOrigin-RevId: 298484782\n\n6de6e938b7df1cd62396563a067334abeedb9676\nchore: use the latest gapic-generator and protoc-java-resource-name-plugin in Bazel workspace.\n\nPiperOrigin-RevId: 298474513\n\n244ab2b83a82076a1fa7be63b7e0671af73f5c02\nAdds service config definition for bigqueryreservation v1\n\nPiperOrigin-RevId: 298455048\n\n" - } - }, - { - "template": { - "name": "node_library", - "origin": "synthtool.gcp", - "version": "2020.2.4" + "sha": "71d6c56a14bb433beb1237dccb48dabcd9597924", + "internalRef": "302735422", + "log": "71d6c56a14bb433beb1237dccb48dabcd9597924\nRefresh monitoring client libraries.\nRename to Cloud Monitoring API.\nAdded support for TimeSeriesQueryLanguageCondition condition type in alert policies.\n\nPiperOrigin-RevId: 302735422\n\n25a1781c096974df99d556cc5888fefa82bc6425\nbazel: migrate all go_gapic_library targets to microgenerator implementation\n\n* update rules_go and gazelle bazel dependencies\n* update gapic-generator bazel dependency (with build file generator changes)\n\nPiperOrigin-RevId: 302730217\n\n36c0febd0fa7267ab66d14408eec2afd1b6bec4e\nUpdate GAPIC configurations to v2 .yaml.\n\nPiperOrigin-RevId: 302639621\n\n078f222366ed344509a48f2f084944ef61476613\nFix containeranalysis v1beta1 assembly target name\n\nPiperOrigin-RevId: 302529186\n\n0be7105dc52590fa9a24e784052298ae37ce53aa\nAdd BUILD.bazel file to asset/v1p1beta1\n\nPiperOrigin-RevId: 302154871\n\n6c248fd13e8543f8d22cbf118d978301a9fbe2a8\nAdd missing resource annotations and additional_bindings to dialogflow v2 API.\n\nPiperOrigin-RevId: 302063117\n\n9a3a7f33be9eeacf7b3e98435816b7022d206bd7\nChange the service name from \"chromeos-moblab.googleapis.com\" to \"chromeosmoblab.googleapis.com\"\n\nPiperOrigin-RevId: 302060989\n\n98a339237577e3de26cb4921f75fb5c57cc7a19f\nfeat: devtools/build/v1 publish client library config annotations\n\n* add details field to some of the BuildEvents\n* add final_invocation_id and build_tool_exit_code fields to BuildStatus\n\nPiperOrigin-RevId: 302044087\n\ncfabc98c6bbbb22d1aeaf7612179c0be193b3a13\nfeat: home/graph/v1 publish client library config annotations & comment updates\n\nThis change includes adding the client library configuration annotations, updated proto comments, and some client library configuration files.\n\nPiperOrigin-RevId: 302042647\n\nc8c8c0bd15d082db9546253dbaad1087c7a9782c\nchore: use latest gapic-generator in bazel WORKSPACE.\nincluding the following commits from gapic-generator:\n- feat: take source protos in all sub-packages (#3144)\n\nPiperOrigin-RevId: 301843591\n\ne4daf5202ea31cb2cb6916fdbfa9d6bd771aeb4c\nAdd bazel file for v1 client lib generation\n\nPiperOrigin-RevId: 301802926\n\n275fbcce2c900278d487c33293a3c7e1fbcd3a34\nfeat: pubsub/v1 add an experimental filter field to Subscription\n\nPiperOrigin-RevId: 301661567\n\nf2b18cec51d27c999ad30011dba17f3965677e9c\nFix: UpdateBackupRequest.backup is a resource, not a resource reference - remove annotation.\n\nPiperOrigin-RevId: 301636171\n\n800384063ac93a0cac3a510d41726fa4b2cd4a83\nCloud Billing Budget API v1beta1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301634389\n\n0cc6c146b660db21f04056c3d58a4b752ee445e3\nCloud Billing Budget API v1alpha1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301630018\n\nff2ea00f69065585c3ac0993c8b582af3b6fc215\nFix: Add resource definition for a parent of InspectTemplate which was otherwise missing.\n\nPiperOrigin-RevId: 301623052\n\n55fa441c9daf03173910760191646399338f2b7c\nAdd proto definition for AccessLevel, AccessPolicy, and ServicePerimeter.\n\nPiperOrigin-RevId: 301620844\n\ne7b10591c5408a67cf14ffafa267556f3290e262\nCloud Bigtable Managed Backup service and message proto files.\n\nPiperOrigin-RevId: 301585144\n\nd8e226f702f8ddf92915128c9f4693b63fb8685d\nfeat: Add time-to-live in a queue for builds\n\nPiperOrigin-RevId: 301579876\n\n430375af011f8c7a5174884f0d0e539c6ffa7675\ndocs: add missing closing backtick\n\nPiperOrigin-RevId: 301538851\n\n0e9f1f60ded9ad1c2e725e37719112f5b487ab65\nbazel: Use latest release of gax_java\n\nPiperOrigin-RevId: 301480457\n\n5058c1c96d0ece7f5301a154cf5a07b2ad03a571\nUpdate GAPIC v2 with batching parameters for Logging API\n\nPiperOrigin-RevId: 301443847\n\n64ab9744073de81fec1b3a6a931befc8a90edf90\nFix: Introduce location-based organization/folder/billing-account resources\nChore: Update copyright years\n\nPiperOrigin-RevId: 301373760\n\n23d5f09e670ebb0c1b36214acf78704e2ecfc2ac\nUpdate field_behavior annotations in V1 and V2.\n\nPiperOrigin-RevId: 301337970\n\nb2cf37e7fd62383a811aa4d54d013ecae638851d\nData Catalog V1 API\n\nPiperOrigin-RevId: 301282503\n\n1976b9981e2900c8172b7d34b4220bdb18c5db42\nCloud DLP api update. Adds missing fields to Finding and adds support for hybrid jobs.\n\nPiperOrigin-RevId: 301205325\n\nae78682c05e864d71223ce22532219813b0245ac\nfix: several sample code blocks in comments are now properly indented for markdown\n\nPiperOrigin-RevId: 301185150\n\ndcd171d04bda5b67db13049320f97eca3ace3731\nPublish Media Translation API V1Beta1\n\nPiperOrigin-RevId: 301180096\n\nff1713453b0fbc5a7544a1ef6828c26ad21a370e\nAdd protos and BUILD rules for v1 API.\n\nPiperOrigin-RevId: 301179394\n\n8386761d09819b665b6a6e1e6d6ff884bc8ff781\nfeat: chromeos/modlab publish protos and config for Chrome OS Moblab API.\n\nPiperOrigin-RevId: 300843960\n\nb2e2bc62fab90e6829e62d3d189906d9b79899e4\nUpdates to GCS gRPC API spec:\n\n1. Changed GetIamPolicy and TestBucketIamPermissions to use wrapper messages around google.iam.v1 IAM requests messages, and added CommonRequestParams. This lets us support RequesterPays buckets.\n2. Added a metadata field to GetObjectMediaResponse, to support resuming an object media read safely (by extracting the generation of the object being read, and using it in the resumed read request).\n\nPiperOrigin-RevId: 300817706\n\n7fd916ce12335cc9e784bb9452a8602d00b2516c\nAdd deprecated_collections field for backward-compatiblity in PHP and monolith-generated Python and Ruby clients.\n\nGenerate TopicName class in Java which covers the functionality of both ProjectTopicName and DeletedTopicName. Introduce breaking changes to be fixed by synth.py.\n\nDelete default retry parameters.\n\nRetry codes defs can be deleted once # https://github.com/googleapis/gapic-generator/issues/3137 is fixed.\n\nPiperOrigin-RevId: 300813135\n\n047d3a8ac7f75383855df0166144f891d7af08d9\nfix!: google/rpc refactor ErrorInfo.type to ErrorInfo.reason and comment updates.\n\nPiperOrigin-RevId: 300773211\n\nfae4bb6d5aac52aabe5f0bb4396466c2304ea6f6\nAdding RetryPolicy to pubsub.proto\n\nPiperOrigin-RevId: 300769420\n\n7d569be2928dbd72b4e261bf9e468f23afd2b950\nAdding additional protocol buffer annotations to v3.\n\nPiperOrigin-RevId: 300718800\n\n13942d1a85a337515040a03c5108993087dc0e4f\nAdd logging protos for Recommender v1.\n\nPiperOrigin-RevId: 300689896\n\na1a573c3eecfe2c404892bfa61a32dd0c9fb22b6\nfix: change go package to use cloud.google.com/go/maps\n\nPiperOrigin-RevId: 300661825\n\nc6fbac11afa0c7ab2972d9df181493875c566f77\nfeat: publish documentai/v1beta2 protos\n\nPiperOrigin-RevId: 300656808\n\n5202a9e0d9903f49e900f20fe5c7f4e42dd6588f\nProtos for v1beta1 release of Cloud Security Center Settings API\n\nPiperOrigin-RevId: 300580858\n\n83518e18655d9d4ac044acbda063cc6ecdb63ef8\nAdds gapic.yaml file and BUILD.bazel file.\n\nPiperOrigin-RevId: 300554200\n\n836c196dc8ef8354bbfb5f30696bd3477e8db5e2\nRegenerate recommender v1beta1 gRPC ServiceConfig file for Insights methods.\n\nPiperOrigin-RevId: 300549302\n\n34a5450c591b6be3d6566f25ac31caa5211b2f3f\nIncreases the default timeout from 20s to 30s for MetricService\n\nPiperOrigin-RevId: 300474272\n\n5d8bffe87cd01ba390c32f1714230e5a95d5991d\nfeat: use the latest gapic-generator in WORKSPACE for bazel build.\n\nPiperOrigin-RevId: 300461878\n\nd631c651e3bcfac5d371e8560c27648f7b3e2364\nUpdated the GAPIC configs to include parameters for Backups APIs.\n\nPiperOrigin-RevId: 300443402\n\n678afc7055c1adea9b7b54519f3bdb228013f918\nAdding Game Servers v1beta API.\n\nPiperOrigin-RevId: 300433218\n\n80d2bd2c652a5e213302041b0620aff423132589\nEnable proto annotation and gapic v2 for talent API.\n\nPiperOrigin-RevId: 300393997\n\n85e454be7a353f7fe1bf2b0affb753305785b872\ndocs(google/maps/roads): remove mention of nonexported api\n\nPiperOrigin-RevId: 300367734\n\nbf839ae632e0f263a729569e44be4b38b1c85f9c\nAdding protocol buffer annotations and updated config info for v1 and v2.\n\nPiperOrigin-RevId: 300276913\n\n309b899ca18a4c604bce63882a161d44854da549\nPublish `Backup` APIs and protos.\n\nPiperOrigin-RevId: 300246038\n\neced64c3f122421350b4aca68a28e89121d20db8\nadd PHP client libraries\n\nPiperOrigin-RevId: 300193634\n\n7727af0e39df1ae9ad715895c8576d7b65cf6c6d\nfeat: use the latest gapic-generator and protoc-java-resource-name-plugin in googleapis/WORKSPACE.\n\nPiperOrigin-RevId: 300188410\n\n2a25aa351dd5b5fe14895266aff5824d90ce757b\nBreaking change: remove the ProjectOrTenant resource and its references.\n\nPiperOrigin-RevId: 300182152\n\na499dbb28546379415f51803505cfb6123477e71\nUpdate web risk v1 gapic config and BUILD file.\n\nPiperOrigin-RevId: 300152177\n\n52701da10fec2a5f9796e8d12518c0fe574488fe\nFix: apply appropriate namespace/package options for C#, PHP and Ruby.\n\nPiperOrigin-RevId: 300123508\n\n365c029b8cdb63f7751b92ab490f1976e616105c\nAdd CC targets to the kms protos.\n\nThese are needed by go/tink.\n\nPiperOrigin-RevId: 300038469\n\n4ba9aa8a4a1413b88dca5a8fa931824ee9c284e6\nExpose logo recognition API proto for GA.\n\nPiperOrigin-RevId: 299971671\n\n1c9fc2c9e03dadf15f16b1c4f570955bdcebe00e\nAdding ruby_package option to accessapproval.proto for the Ruby client libraries generation.\n\nPiperOrigin-RevId: 299955924\n\n1cc6f0a7bfb147e6f2ede911d9b01e7a9923b719\nbuild(google/maps/routes): generate api clients\n\nPiperOrigin-RevId: 299955905\n\n29a47c965aac79e3fe8e3314482ca0b5967680f0\nIncrease timeout to 1hr for method `dropRange` in bigtable/admin/v2, which is\nsynced with the timeout setting in gapic_yaml.\n\nPiperOrigin-RevId: 299917154\n\n8f631c4c70a60a9c7da3749511ee4ad432b62898\nbuild(google/maps/roads/v1op): move go to monorepo pattern\n\nPiperOrigin-RevId: 299885195\n\nd66816518844ebbf63504c9e8dfc7133921dd2cd\nbuild(google/maps/roads/v1op): Add bazel build files to generate clients.\n\nPiperOrigin-RevId: 299851148\n\naf7dff701fabe029672168649c62356cf1bb43d0\nAdd LogPlayerReports and LogImpressions to Playable Locations service\n\nPiperOrigin-RevId: 299724050\n\nb6927fca808f38df32a642c560082f5bf6538ced\nUpdate BigQuery Connection API v1beta1 proto: added credential to CloudSqlProperties.\n\nPiperOrigin-RevId: 299503150\n\n91e1fb5ef9829c0c7a64bfa5bde330e6ed594378\nchore: update protobuf (protoc) version to 3.11.2\n\nPiperOrigin-RevId: 299404145\n\n30e36b4bee6749c4799f4fc1a51cc8f058ba167d\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 299399890\n\nffbb493674099f265693872ae250711b2238090c\nfeat: cloudbuild/v1 add new fields and annotate OUTPUT_OUT fields.\n\nPiperOrigin-RevId: 299397780\n\nbc973a15818e00c19e121959832676e9b7607456\nbazel: Fix broken common dependency\n\nPiperOrigin-RevId: 299397431\n\n71094a343e3b962e744aa49eb9338219537474e4\nchore: bigtable/admin/v2 publish retry config\n\nPiperOrigin-RevId: 299391875\n\n8f488efd7bda33885cb674ddd023b3678c40bd82\nfeat: Migrate logging to GAPIC v2; release new features.\n\nIMPORTANT: This is a breaking change for client libraries\nin all languages.\n\nCommitter: @lukesneeringer, @jskeet\nPiperOrigin-RevId: 299370279\n\n007605bf9ad3a1fd775014ebefbf7f1e6b31ee71\nUpdate API for bigqueryreservation v1beta1.\n- Adds flex capacity commitment plan to CapacityCommitment.\n- Adds methods for getting and updating BiReservations.\n- Adds methods for updating/splitting/merging CapacityCommitments.\n\nPiperOrigin-RevId: 299368059\n\n" } } ], "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "recaptchaenterprise", + "apiVersion": "v1", + "language": "typescript", + "generator": "gapic-generator-typescript" + } + }, { "client": { "source": "googleapis", diff --git a/synth.py b/synth.py index d6e84fe..06139a4 100644 --- a/synth.py +++ b/synth.py @@ -22,7 +22,7 @@ # run the gapic generator gapic = gcp.GAPICMicrogenerator() -versions = ['v1beta1'] +versions = ['v1', 'v1beta1'] for version in versions: library = gapic.typescript_library( 'recaptchaenterprise', version, diff --git a/system-test/fixtures/sample/src/index.js b/system-test/fixtures/sample/src/index.js index 3d40ab8..d0565cd 100644 --- a/system-test/fixtures/sample/src/index.js +++ b/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/system-test/fixtures/sample/src/index.ts b/system-test/fixtures/sample/src/index.ts index 3f81a94..d010410 100644 --- a/system-test/fixtures/sample/src/index.ts +++ b/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/system-test/install.ts b/system-test/install.ts index c9aa74e..c4d80e9 100644 --- a/system-test/install.ts +++ b/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/test/gapic-recaptcha_enterprise_service-v1.ts b/test/gapic-recaptcha_enterprise_service-v1.ts new file mode 100644 index 0000000..f247b6b --- /dev/null +++ b/test/gapic-recaptcha_enterprise_service-v1.ts @@ -0,0 +1,512 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR 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 protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const recaptchaenterpriseserviceModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +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', () => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + describe('createAssessment', () => { + it('invokes createAssessment without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createAssessment = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createAssessment(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createAssessment with error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createAssessment = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createAssessment(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('annotateAssessment', () => { + it('invokes annotateAssessment without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.annotateAssessment = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.annotateAssessment(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes annotateAssessment with error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.annotateAssessment = mockSimpleGrpcMethod( + request, + null, + error + ); + client.annotateAssessment(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createKey', () => { + it('invokes createKey without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createKey with error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createKey = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getKey', () => { + it('invokes getKey without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getKey with error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IGetKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getKey = mockSimpleGrpcMethod(request, null, error); + client.getKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateKey', () => { + it('invokes updateKey without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest = {}; + request.key = {}; + request.key.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateKey with error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest = {}; + request.key = {}; + request.key.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateKey = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteKey', () => { + it('invokes deleteKey without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteKey with error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteKey = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('listKeys', () => { + it('invokes listKeys without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listKeys = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listKeys(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listKeysStream', () => { + it('invokes listKeysStream without error', done => { + const client = new recaptchaenterpriseserviceModule.v1.RecaptchaEnterpriseServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + // Initialize client before mocking + client.initialize(); + // Mock request + const request: protosTypes.google.cloud.recaptchaenterprise.v1.IListKeysRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listKeys = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listKeysStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); +}); diff --git a/test/gapic-recaptcha_enterprise_service_v1_beta1-v1beta1.ts b/test/gapic-recaptcha_enterprise_service_v1_beta1-v1beta1.ts index 228bafe..d119609 100644 --- a/test/gapic-recaptcha_enterprise_service_v1_beta1-v1beta1.ts +++ b/test/gapic-recaptcha_enterprise_service_v1_beta1-v1beta1.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/webpack.config.js b/webpack.config.js index d49627b..2435e0e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 23f96f1080d589554a9af4b4ef461afb0f4e7d20 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Tue, 24 Mar 2020 16:54:21 -0700 Subject: [PATCH 2/2] chore: bump to ga --- .repo-metadata.json | 2 +- README.md | 15 ++++++++------- src/index.ts | 14 ++++++++++++-- synth.metadata | 8 ++++---- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 30ed2bd..0b9b6d6 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/recaptcha-enterprise/docs/", "client_documentation": "https://googleapis.dev/nodejs/recaptcha-enterprise/latest", "issue_tracker": "", - "release_level": "beta", + "release_level": "ga", "language": "nodejs", "repo": "googleapis/nodejs-recaptcha-enterprise", "distribution_name": "@google-cloud/recaptcha-enterprise", diff --git a/README.md b/README.md index c021f54..bd9cb9b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # [Google Cloud reCAPTCHA Enterprise: Node.js Client](https://github.com/googleapis/nodejs-recaptcha-enterprise) -[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/recaptcha-enterprise.svg)](https://www.npmjs.org/package/@google-cloud/recaptcha-enterprise) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-recaptcha-enterprise/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-recaptcha-enterprise) @@ -62,9 +62,9 @@ npm install @google-cloud/recaptcha-enterprise async function main(projectNumber) { // Create the reCAPTCHA client library. const { - RecaptchaEnterpriseServiceV1Beta1Client, + RecaptchaEnterpriseServiceClient, } = require('@google-cloud/recaptcha-enterprise'); - const client = new RecaptchaEnterpriseServiceV1Beta1Client(); + const client = new RecaptchaEnterpriseServiceClient(); // format the path to the project (it should be prefaced with projects/). const formattedParent = client.projectPath(projectNumber); @@ -124,11 +124,12 @@ _Legacy Node.js versions are supported as a best effort:_ This library follows [Semantic Versioning](http://semver.org/). +This library is considered to be **General Availability (GA)**. This means it +is stable; the code surface will not change in backwards-incompatible ways +unless absolutely necessary (e.g. because of critical security issues) or with +an extensive deprecation period. Issues and requests against **GA** libraries +are addressed with the highest priority. -This library is considered to be in **beta**. This means it is expected to be -mostly stable while we work toward a general availability release; however, -complete stability is not guaranteed. We will address issues and requests -against beta libraries with a high priority. diff --git a/src/index.ts b/src/index.ts index 1b192b8..c250e37 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,9 +21,19 @@ import * as v1 from './v1'; const RecaptchaEnterpriseServiceV1Beta1Client = v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; const RecaptchaEnterpriseServiceClient = v1.RecaptchaEnterpriseServiceClient; -export {v1, v1beta1, RecaptchaEnterpriseServiceV1Beta1Client, RecaptchaEnterpriseServiceClient}; +export { + v1, + v1beta1, + RecaptchaEnterpriseServiceV1Beta1Client, + RecaptchaEnterpriseServiceClient, +}; // For compatibility with JavaScript libraries we need to provide this default export: // tslint:disable-next-line no-default-export -export default {v1, v1beta1, RecaptchaEnterpriseServiceV1Beta1Client, RecaptchaEnterpriseServiceClient}; +export default { + v1, + v1beta1, + RecaptchaEnterpriseServiceV1Beta1Client, + RecaptchaEnterpriseServiceClient, +}; import * as protos from '../protos/protos'; export {protos}; diff --git a/synth.metadata b/synth.metadata index 3fe97aa..71b59f3 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,13 +1,13 @@ { - "updateTime": "2020-03-24T22:49:54.494972Z", + "updateTime": "2020-03-24T23:50:54.138889Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "71d6c56a14bb433beb1237dccb48dabcd9597924", - "internalRef": "302735422", - "log": "71d6c56a14bb433beb1237dccb48dabcd9597924\nRefresh monitoring client libraries.\nRename to Cloud Monitoring API.\nAdded support for TimeSeriesQueryLanguageCondition condition type in alert policies.\n\nPiperOrigin-RevId: 302735422\n\n25a1781c096974df99d556cc5888fefa82bc6425\nbazel: migrate all go_gapic_library targets to microgenerator implementation\n\n* update rules_go and gazelle bazel dependencies\n* update gapic-generator bazel dependency (with build file generator changes)\n\nPiperOrigin-RevId: 302730217\n\n36c0febd0fa7267ab66d14408eec2afd1b6bec4e\nUpdate GAPIC configurations to v2 .yaml.\n\nPiperOrigin-RevId: 302639621\n\n078f222366ed344509a48f2f084944ef61476613\nFix containeranalysis v1beta1 assembly target name\n\nPiperOrigin-RevId: 302529186\n\n0be7105dc52590fa9a24e784052298ae37ce53aa\nAdd BUILD.bazel file to asset/v1p1beta1\n\nPiperOrigin-RevId: 302154871\n\n6c248fd13e8543f8d22cbf118d978301a9fbe2a8\nAdd missing resource annotations and additional_bindings to dialogflow v2 API.\n\nPiperOrigin-RevId: 302063117\n\n9a3a7f33be9eeacf7b3e98435816b7022d206bd7\nChange the service name from \"chromeos-moblab.googleapis.com\" to \"chromeosmoblab.googleapis.com\"\n\nPiperOrigin-RevId: 302060989\n\n98a339237577e3de26cb4921f75fb5c57cc7a19f\nfeat: devtools/build/v1 publish client library config annotations\n\n* add details field to some of the BuildEvents\n* add final_invocation_id and build_tool_exit_code fields to BuildStatus\n\nPiperOrigin-RevId: 302044087\n\ncfabc98c6bbbb22d1aeaf7612179c0be193b3a13\nfeat: home/graph/v1 publish client library config annotations & comment updates\n\nThis change includes adding the client library configuration annotations, updated proto comments, and some client library configuration files.\n\nPiperOrigin-RevId: 302042647\n\nc8c8c0bd15d082db9546253dbaad1087c7a9782c\nchore: use latest gapic-generator in bazel WORKSPACE.\nincluding the following commits from gapic-generator:\n- feat: take source protos in all sub-packages (#3144)\n\nPiperOrigin-RevId: 301843591\n\ne4daf5202ea31cb2cb6916fdbfa9d6bd771aeb4c\nAdd bazel file for v1 client lib generation\n\nPiperOrigin-RevId: 301802926\n\n275fbcce2c900278d487c33293a3c7e1fbcd3a34\nfeat: pubsub/v1 add an experimental filter field to Subscription\n\nPiperOrigin-RevId: 301661567\n\nf2b18cec51d27c999ad30011dba17f3965677e9c\nFix: UpdateBackupRequest.backup is a resource, not a resource reference - remove annotation.\n\nPiperOrigin-RevId: 301636171\n\n800384063ac93a0cac3a510d41726fa4b2cd4a83\nCloud Billing Budget API v1beta1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301634389\n\n0cc6c146b660db21f04056c3d58a4b752ee445e3\nCloud Billing Budget API v1alpha1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301630018\n\nff2ea00f69065585c3ac0993c8b582af3b6fc215\nFix: Add resource definition for a parent of InspectTemplate which was otherwise missing.\n\nPiperOrigin-RevId: 301623052\n\n55fa441c9daf03173910760191646399338f2b7c\nAdd proto definition for AccessLevel, AccessPolicy, and ServicePerimeter.\n\nPiperOrigin-RevId: 301620844\n\ne7b10591c5408a67cf14ffafa267556f3290e262\nCloud Bigtable Managed Backup service and message proto files.\n\nPiperOrigin-RevId: 301585144\n\nd8e226f702f8ddf92915128c9f4693b63fb8685d\nfeat: Add time-to-live in a queue for builds\n\nPiperOrigin-RevId: 301579876\n\n430375af011f8c7a5174884f0d0e539c6ffa7675\ndocs: add missing closing backtick\n\nPiperOrigin-RevId: 301538851\n\n0e9f1f60ded9ad1c2e725e37719112f5b487ab65\nbazel: Use latest release of gax_java\n\nPiperOrigin-RevId: 301480457\n\n5058c1c96d0ece7f5301a154cf5a07b2ad03a571\nUpdate GAPIC v2 with batching parameters for Logging API\n\nPiperOrigin-RevId: 301443847\n\n64ab9744073de81fec1b3a6a931befc8a90edf90\nFix: Introduce location-based organization/folder/billing-account resources\nChore: Update copyright years\n\nPiperOrigin-RevId: 301373760\n\n23d5f09e670ebb0c1b36214acf78704e2ecfc2ac\nUpdate field_behavior annotations in V1 and V2.\n\nPiperOrigin-RevId: 301337970\n\nb2cf37e7fd62383a811aa4d54d013ecae638851d\nData Catalog V1 API\n\nPiperOrigin-RevId: 301282503\n\n1976b9981e2900c8172b7d34b4220bdb18c5db42\nCloud DLP api update. Adds missing fields to Finding and adds support for hybrid jobs.\n\nPiperOrigin-RevId: 301205325\n\nae78682c05e864d71223ce22532219813b0245ac\nfix: several sample code blocks in comments are now properly indented for markdown\n\nPiperOrigin-RevId: 301185150\n\ndcd171d04bda5b67db13049320f97eca3ace3731\nPublish Media Translation API V1Beta1\n\nPiperOrigin-RevId: 301180096\n\nff1713453b0fbc5a7544a1ef6828c26ad21a370e\nAdd protos and BUILD rules for v1 API.\n\nPiperOrigin-RevId: 301179394\n\n8386761d09819b665b6a6e1e6d6ff884bc8ff781\nfeat: chromeos/modlab publish protos and config for Chrome OS Moblab API.\n\nPiperOrigin-RevId: 300843960\n\nb2e2bc62fab90e6829e62d3d189906d9b79899e4\nUpdates to GCS gRPC API spec:\n\n1. Changed GetIamPolicy and TestBucketIamPermissions to use wrapper messages around google.iam.v1 IAM requests messages, and added CommonRequestParams. This lets us support RequesterPays buckets.\n2. Added a metadata field to GetObjectMediaResponse, to support resuming an object media read safely (by extracting the generation of the object being read, and using it in the resumed read request).\n\nPiperOrigin-RevId: 300817706\n\n7fd916ce12335cc9e784bb9452a8602d00b2516c\nAdd deprecated_collections field for backward-compatiblity in PHP and monolith-generated Python and Ruby clients.\n\nGenerate TopicName class in Java which covers the functionality of both ProjectTopicName and DeletedTopicName. Introduce breaking changes to be fixed by synth.py.\n\nDelete default retry parameters.\n\nRetry codes defs can be deleted once # https://github.com/googleapis/gapic-generator/issues/3137 is fixed.\n\nPiperOrigin-RevId: 300813135\n\n047d3a8ac7f75383855df0166144f891d7af08d9\nfix!: google/rpc refactor ErrorInfo.type to ErrorInfo.reason and comment updates.\n\nPiperOrigin-RevId: 300773211\n\nfae4bb6d5aac52aabe5f0bb4396466c2304ea6f6\nAdding RetryPolicy to pubsub.proto\n\nPiperOrigin-RevId: 300769420\n\n7d569be2928dbd72b4e261bf9e468f23afd2b950\nAdding additional protocol buffer annotations to v3.\n\nPiperOrigin-RevId: 300718800\n\n13942d1a85a337515040a03c5108993087dc0e4f\nAdd logging protos for Recommender v1.\n\nPiperOrigin-RevId: 300689896\n\na1a573c3eecfe2c404892bfa61a32dd0c9fb22b6\nfix: change go package to use cloud.google.com/go/maps\n\nPiperOrigin-RevId: 300661825\n\nc6fbac11afa0c7ab2972d9df181493875c566f77\nfeat: publish documentai/v1beta2 protos\n\nPiperOrigin-RevId: 300656808\n\n5202a9e0d9903f49e900f20fe5c7f4e42dd6588f\nProtos for v1beta1 release of Cloud Security Center Settings API\n\nPiperOrigin-RevId: 300580858\n\n83518e18655d9d4ac044acbda063cc6ecdb63ef8\nAdds gapic.yaml file and BUILD.bazel file.\n\nPiperOrigin-RevId: 300554200\n\n836c196dc8ef8354bbfb5f30696bd3477e8db5e2\nRegenerate recommender v1beta1 gRPC ServiceConfig file for Insights methods.\n\nPiperOrigin-RevId: 300549302\n\n34a5450c591b6be3d6566f25ac31caa5211b2f3f\nIncreases the default timeout from 20s to 30s for MetricService\n\nPiperOrigin-RevId: 300474272\n\n5d8bffe87cd01ba390c32f1714230e5a95d5991d\nfeat: use the latest gapic-generator in WORKSPACE for bazel build.\n\nPiperOrigin-RevId: 300461878\n\nd631c651e3bcfac5d371e8560c27648f7b3e2364\nUpdated the GAPIC configs to include parameters for Backups APIs.\n\nPiperOrigin-RevId: 300443402\n\n678afc7055c1adea9b7b54519f3bdb228013f918\nAdding Game Servers v1beta API.\n\nPiperOrigin-RevId: 300433218\n\n80d2bd2c652a5e213302041b0620aff423132589\nEnable proto annotation and gapic v2 for talent API.\n\nPiperOrigin-RevId: 300393997\n\n85e454be7a353f7fe1bf2b0affb753305785b872\ndocs(google/maps/roads): remove mention of nonexported api\n\nPiperOrigin-RevId: 300367734\n\nbf839ae632e0f263a729569e44be4b38b1c85f9c\nAdding protocol buffer annotations and updated config info for v1 and v2.\n\nPiperOrigin-RevId: 300276913\n\n309b899ca18a4c604bce63882a161d44854da549\nPublish `Backup` APIs and protos.\n\nPiperOrigin-RevId: 300246038\n\neced64c3f122421350b4aca68a28e89121d20db8\nadd PHP client libraries\n\nPiperOrigin-RevId: 300193634\n\n7727af0e39df1ae9ad715895c8576d7b65cf6c6d\nfeat: use the latest gapic-generator and protoc-java-resource-name-plugin in googleapis/WORKSPACE.\n\nPiperOrigin-RevId: 300188410\n\n2a25aa351dd5b5fe14895266aff5824d90ce757b\nBreaking change: remove the ProjectOrTenant resource and its references.\n\nPiperOrigin-RevId: 300182152\n\na499dbb28546379415f51803505cfb6123477e71\nUpdate web risk v1 gapic config and BUILD file.\n\nPiperOrigin-RevId: 300152177\n\n52701da10fec2a5f9796e8d12518c0fe574488fe\nFix: apply appropriate namespace/package options for C#, PHP and Ruby.\n\nPiperOrigin-RevId: 300123508\n\n365c029b8cdb63f7751b92ab490f1976e616105c\nAdd CC targets to the kms protos.\n\nThese are needed by go/tink.\n\nPiperOrigin-RevId: 300038469\n\n4ba9aa8a4a1413b88dca5a8fa931824ee9c284e6\nExpose logo recognition API proto for GA.\n\nPiperOrigin-RevId: 299971671\n\n1c9fc2c9e03dadf15f16b1c4f570955bdcebe00e\nAdding ruby_package option to accessapproval.proto for the Ruby client libraries generation.\n\nPiperOrigin-RevId: 299955924\n\n1cc6f0a7bfb147e6f2ede911d9b01e7a9923b719\nbuild(google/maps/routes): generate api clients\n\nPiperOrigin-RevId: 299955905\n\n29a47c965aac79e3fe8e3314482ca0b5967680f0\nIncrease timeout to 1hr for method `dropRange` in bigtable/admin/v2, which is\nsynced with the timeout setting in gapic_yaml.\n\nPiperOrigin-RevId: 299917154\n\n8f631c4c70a60a9c7da3749511ee4ad432b62898\nbuild(google/maps/roads/v1op): move go to monorepo pattern\n\nPiperOrigin-RevId: 299885195\n\nd66816518844ebbf63504c9e8dfc7133921dd2cd\nbuild(google/maps/roads/v1op): Add bazel build files to generate clients.\n\nPiperOrigin-RevId: 299851148\n\naf7dff701fabe029672168649c62356cf1bb43d0\nAdd LogPlayerReports and LogImpressions to Playable Locations service\n\nPiperOrigin-RevId: 299724050\n\nb6927fca808f38df32a642c560082f5bf6538ced\nUpdate BigQuery Connection API v1beta1 proto: added credential to CloudSqlProperties.\n\nPiperOrigin-RevId: 299503150\n\n91e1fb5ef9829c0c7a64bfa5bde330e6ed594378\nchore: update protobuf (protoc) version to 3.11.2\n\nPiperOrigin-RevId: 299404145\n\n30e36b4bee6749c4799f4fc1a51cc8f058ba167d\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 299399890\n\nffbb493674099f265693872ae250711b2238090c\nfeat: cloudbuild/v1 add new fields and annotate OUTPUT_OUT fields.\n\nPiperOrigin-RevId: 299397780\n\nbc973a15818e00c19e121959832676e9b7607456\nbazel: Fix broken common dependency\n\nPiperOrigin-RevId: 299397431\n\n71094a343e3b962e744aa49eb9338219537474e4\nchore: bigtable/admin/v2 publish retry config\n\nPiperOrigin-RevId: 299391875\n\n8f488efd7bda33885cb674ddd023b3678c40bd82\nfeat: Migrate logging to GAPIC v2; release new features.\n\nIMPORTANT: This is a breaking change for client libraries\nin all languages.\n\nCommitter: @lukesneeringer, @jskeet\nPiperOrigin-RevId: 299370279\n\n007605bf9ad3a1fd775014ebefbf7f1e6b31ee71\nUpdate API for bigqueryreservation v1beta1.\n- Adds flex capacity commitment plan to CapacityCommitment.\n- Adds methods for getting and updating BiReservations.\n- Adds methods for updating/splitting/merging CapacityCommitments.\n\nPiperOrigin-RevId: 299368059\n\n" + "sha": "1df117114c73299b614dfd3ba3632bf246669336", + "internalRef": "302753982", + "log": "1df117114c73299b614dfd3ba3632bf246669336\nSynchronize new proto/yaml changes.\n\nPiperOrigin-RevId: 302753982\n\n" } } ],