diff --git a/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto b/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto index 099d304..28a07a8 100644 --- a/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto +++ b/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // 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"; @@ -21,8 +20,6 @@ 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.V1Beta1"; @@ -57,43 +54,6 @@ service RecaptchaEnterpriseServiceV1Beta1 { }; option (google.api.method_signature) = "name,annotation"; } - - // Creates a new reCAPTCHA Enterprise key. - rpc CreateKey(CreateKeyRequest) returns (Key) { - option (google.api.http) = { - post: "/v1beta1/{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: "/v1beta1/{parent=projects/*}/keys" - }; - } - - // Returns the specified key. - rpc GetKey(GetKeyRequest) returns (Key) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/keys/*}" - }; - } - - // Updates the specified key. - rpc UpdateKey(UpdateKeyRequest) returns (Key) { - option (google.api.http) = { - patch: "/v1beta1/{key.name=projects/*/keys/*}" - body: "key" - }; - } - - // Deletes the specified key. - rpc DeleteKey(DeleteKeyRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/keys/*}" - }; - } } // The create assessment request message. @@ -113,7 +73,7 @@ message CreateAssessmentRequest { // The request message to annotate an Assessment. message AnnotateAssessmentRequest { - // Enum that reprensents the types of annotations. + // Enum that represents the types of annotations. enum Annotation { // Default unspecified type. ANNOTATION_UNSPECIFIED = 0; @@ -123,6 +83,60 @@ message AnnotateAssessmentRequest { // Provides information that the event turned out to be fraudulent. FRAUDULENT = 2; + + // Provides information that the event was related to a login event in which + // the user typed the correct password. Deprecated, prefer indicating + // CORRECT_PASSWORD through the reasons field instead. + PASSWORD_CORRECT = 3 [deprecated = true]; + + // Provides information that the event was related to a login event in which + // the user typed the incorrect password. Deprecated, prefer indicating + // INCORRECT_PASSWORD through the reasons field instead. + PASSWORD_INCORRECT = 4 [deprecated = true]; + } + + // Enum that represents potential reasons for annotating an assessment. + enum Reason { + // Default unspecified reason. + REASON_UNSPECIFIED = 0; + + // Indicates a chargeback issued for the transaction with no other details. + // When possible, specify the type by using CHARGEBACK_FRAUD or + // CHARGEBACK_DISPUTE instead. + CHARGEBACK = 1; + + // Indicates a chargeback related to an alleged unauthorized transaction + // from the cardholder's perspective (for example, the card number was + // stolen). + CHARGEBACK_FRAUD = 8; + + // Indicates a chargeback related to the cardholder having provided their + // card details but allegedly not being satisfied with the purchase + // (for example, misrepresentation, attempted cancellation). + CHARGEBACK_DISPUTE = 9; + + // Indicates the transaction associated with the assessment is suspected of + // being fraudulent based on the payment method, billing details, shipping + // address or other transaction information. + PAYMENT_HEURISTICS = 2; + + // Indicates that the user was served a 2FA challenge. An old assessment + // with `ENUM_VALUES.INITIATED_TWO_FACTOR` reason that has not been + // overwritten with `PASSED_TWO_FACTOR` is treated as an abandoned 2FA flow. + // This is equivalent to `FAILED_TWO_FACTOR`. + INITIATED_TWO_FACTOR = 7; + + // Indicates that the user passed a 2FA challenge. + PASSED_TWO_FACTOR = 3; + + // Indicates that the user failed a 2FA challenge. + FAILED_TWO_FACTOR = 4; + + // Indicates the user provided the correct password. + CORRECT_PASSWORD = 5; + + // Indicates the user provided an incorrect password. + INCORRECT_PASSWORD = 6; } // Required. The resource name of the Assessment, in the format @@ -134,8 +148,20 @@ message AnnotateAssessmentRequest { } ]; - // Required. The annotation that will be assigned to the Event. - Annotation annotation = 2 [(google.api.field_behavior) = REQUIRED]; + // Optional. The annotation that will be assigned to the Event. This field can be left + // empty to provide reasons that apply to an event without concluding whether + // the event is legitimate or fraudulent. + Annotation annotation = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional reasons for the annotation that will be assigned to the Event. + repeated Reason reasons = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional unique stable hashed user identifier to apply to the assessment. + // This is an alternative to setting the hashed_account_id in + // CreateAssessment, for example when the account identifier is not yet known + // in the initial request. It is recommended that the identifier is hashed + // using hmac-sha256 with stable secret. + bytes hashed_account_id = 4 [(google.api.field_behavior) = OPTIONAL]; } // Empty response for AnnotateAssessment. @@ -143,6 +169,21 @@ message AnnotateAssessmentResponse { } +// Password leak verification info. +message PasswordLeakVerification { + // Optional. Scrypt hash of the username+password that the customer wants to verify + // against a known password leak. + bytes hashed_user_credentials = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Whether or not the user's credentials are present in a known leak. + bool credentials_leaked = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The username part of the user credentials for which we want to trigger a + // leak check in canonicalized form. This is the same data used to create the + // hashed_user_credentials on the customer side. + string canonicalized_username = 3 [(google.api.field_behavior) = OPTIONAL]; +} + // A recaptcha assessment resource. message Assessment { option (google.api.resource) = { @@ -150,7 +191,6 @@ message Assessment { pattern: "projects/{project}/assessments/{assessment}" }; - // LINT.IfChange(classification_reason) // Reasons contributing to the risk analysis verdict. enum ClassificationReason { // Default unspecified type. @@ -191,6 +231,16 @@ message Assessment { // Output only. Reasons contributing to the risk analysis verdict. repeated ClassificationReason reasons = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Information about the user's credentials used to check for leaks. + // This feature is part of the Early Access Program (EAP). Exercise caution, + // and do not deploy integrations based on this feature in a production + // environment. + PasswordLeakVerification password_leak_verification = 7; + + // Assessment returned by Account Defender when a hashed_account_id is + // provided. + AccountDefenderAssessment account_defender_assessment = 8; } message Event { @@ -213,10 +263,13 @@ message Event { // provided at token generation time on client-side platforms already // integrated with recaptcha enterprise. string expected_action = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional unique stable hashed user identifier for the request. The + // identifier should ideally be hashed using sha256 with stable secret. + bytes hashed_account_id = 6 [(google.api.field_behavior) = OPTIONAL]; } message TokenProperties { - // LINT.IfChange // Enum that represents the types of invalid token reasons. enum InvalidReason { // Default unspecified type. @@ -238,13 +291,21 @@ message TokenProperties { // This may be a configuration error (e.g. development keys used in // production) or end users trying to use verification tokens from other // sites. - SITE_MISMATCH = 5; + SITE_MISMATCH = 5 [deprecated = true]; // The user verification token was not present. It is a required input. MISSING = 6; + + // A retriable error (such as network failure) occurred on the browser. + // Could easily be simulated by an attacker. + BROWSER_ERROR = 7; } - // Whether the provided user response token is valid. + // 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. @@ -260,183 +321,30 @@ message TokenProperties { 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_number}". - 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_number}". - 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_number}/keys/{key_id}". - 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_number}/keys/{key_id}". - 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_number}/keys/{key_id}". - 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; - } -} - -// 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_ONLY = 1; - - // Displays the "I'm not a robot" checkbox and may show captcha challenges - // after it is checked. - CHECKBOX_CHALLENGE = 2; - - // Doesn't display the "I'm not a robot" checkbox, but may show captcha - // challenges after risk analysis. - INVISIBLE_CHALLENGE = 3; - } +// Account Defender risk assessment. +message AccountDefenderAssessment { + // Labels returned by Account Defender for this request. + enum AccountDefenderLabel { + // Default unspecified type. + ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0; - // 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; + // The request matches a known good profile for the user. + PROFILE_MATCH = 1; - // Key tends to show fewer and easier challenges. - USABILITY = 1; + // The request is potentially a suspicious login event and should be further + // verified either via multi-factor authentication or another system. + SUSPICIOUS_LOGIN_ACTIVITY = 2; - // Key tends to show balanced (in amount and difficulty) challenges. - BALANCED = 2; + // The request matched a profile that previously had suspicious account + // creation behavior. This could mean this is a fake account. + SUSPICIOUS_ACCOUNT_CREATION = 3; - // Key tends to show more and harder challenges. - SECURITY = 3; + // The account in the request has a high number of related accounts. It does + // not necessarily imply that the account is bad but could require + // investigating. + RELATED_ACCOUNTS_NUMBER_HIGH = 4; } - // Whether allowed_domains is enforced or not. - bool enforce_allowed_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; - - // Whether this key can be used on AMP (Accelerated Mobile Pages) websites. - bool allow_amp_traffic = 2; - - // Required. Describes how this key is integrated with the website. - IntegrationType integration_type = 4 [(google.api.field_behavior) = REQUIRED]; - - // Settings for the frequency and difficulty at which this key triggers - // captcha challenges. This should only be specified for IntegrationTypes - // CHECKBOX_CHALLENGE and INVISIBLE_CHALLENGE. - 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; + // Labels for this request. + repeated AccountDefenderLabel labels = 1; } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 7cef650..ab69c80 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -3744,76 +3744,6 @@ export namespace google { * @returns Promise */ public annotateAssessment(request: google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.ICreateKeyRequest, callback: google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateKeyCallback): void; - - /** - * Calls CreateKey. - * @param request CreateKeyRequest message or plain object - * @returns Promise - */ - public createKey(request: google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IListKeysRequest, callback: google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.ListKeysCallback): void; - - /** - * Calls ListKeys. - * @param request ListKeysRequest message or plain object - * @returns Promise - */ - public listKeys(request: google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IGetKeyRequest, callback: google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.GetKeyCallback): void; - - /** - * Calls GetKey. - * @param request GetKeyRequest message or plain object - * @returns Promise - */ - public getKey(request: google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IUpdateKeyRequest, callback: google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.UpdateKeyCallback): void; - - /** - * Calls UpdateKey. - * @param request UpdateKeyRequest message or plain object - * @returns Promise - */ - public updateKey(request: google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IDeleteKeyRequest, callback: google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.DeleteKeyCallback): void; - - /** - * Calls DeleteKey. - * @param request DeleteKeyRequest message or plain object - * @returns Promise - */ - public deleteKey(request: google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest): Promise; } namespace RecaptchaEnterpriseServiceV1Beta1 { @@ -3831,41 +3761,6 @@ export namespace google { * @param [response] AnnotateAssessmentResponse */ type AnnotateAssessmentCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse) => void; - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#createKey}. - * @param error Error, if any - * @param [response] Key - */ - type CreateKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1beta1.Key) => void; - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#listKeys}. - * @param error Error, if any - * @param [response] ListKeysResponse - */ - type ListKeysCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse) => void; - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#getKey}. - * @param error Error, if any - * @param [response] Key - */ - type GetKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1beta1.Key) => void; - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#updateKey}. - * @param error Error, if any - * @param [response] Key - */ - type UpdateKeyCallback = (error: (Error|null), response?: google.cloud.recaptchaenterprise.v1beta1.Key) => void; - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#deleteKey}. - * @param error Error, if any - * @param [response] Empty - */ - type DeleteKeyCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; } /** Properties of a CreateAssessmentRequest. */ @@ -3972,6 +3867,12 @@ export namespace google { /** AnnotateAssessmentRequest annotation */ annotation?: (google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|null); + + /** AnnotateAssessmentRequest reasons */ + reasons?: (google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason[]|null); + + /** AnnotateAssessmentRequest hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); } /** Represents an AnnotateAssessmentRequest. */ @@ -3989,6 +3890,12 @@ export namespace google { /** AnnotateAssessmentRequest annotation. */ public annotation: (google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|keyof typeof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation); + /** AnnotateAssessmentRequest reasons. */ + public reasons: google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason[]; + + /** AnnotateAssessmentRequest hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + /** * Creates a new AnnotateAssessmentRequest instance using the specified properties. * @param [properties] Properties to set @@ -4066,7 +3973,23 @@ export namespace google { enum Annotation { ANNOTATION_UNSPECIFIED = 0, LEGITIMATE = 1, - FRAUDULENT = 2 + FRAUDULENT = 2, + PASSWORD_CORRECT = 3, + PASSWORD_INCORRECT = 4 + } + + /** Reason enum. */ + enum Reason { + REASON_UNSPECIFIED = 0, + CHARGEBACK = 1, + CHARGEBACK_FRAUD = 8, + CHARGEBACK_DISPUTE = 9, + PAYMENT_HEURISTICS = 2, + INITIATED_TWO_FACTOR = 7, + PASSED_TWO_FACTOR = 3, + FAILED_TWO_FACTOR = 4, + CORRECT_PASSWORD = 5, + INCORRECT_PASSWORD = 6 } } @@ -4154,6 +4077,108 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a PasswordLeakVerification. */ + interface IPasswordLeakVerification { + + /** PasswordLeakVerification hashedUserCredentials */ + hashedUserCredentials?: (Uint8Array|string|null); + + /** PasswordLeakVerification credentialsLeaked */ + credentialsLeaked?: (boolean|null); + + /** PasswordLeakVerification canonicalizedUsername */ + canonicalizedUsername?: (string|null); + } + + /** Represents a PasswordLeakVerification. */ + class PasswordLeakVerification implements IPasswordLeakVerification { + + /** + * Constructs a new PasswordLeakVerification. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification); + + /** PasswordLeakVerification hashedUserCredentials. */ + public hashedUserCredentials: (Uint8Array|string); + + /** PasswordLeakVerification credentialsLeaked. */ + public credentialsLeaked: boolean; + + /** PasswordLeakVerification canonicalizedUsername. */ + public canonicalizedUsername: string; + + /** + * Creates a new PasswordLeakVerification instance using the specified properties. + * @param [properties] Properties to set + * @returns PasswordLeakVerification instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Encodes the specified PasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @param message PasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @param message PasswordLeakVerification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Verifies a PasswordLeakVerification message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PasswordLeakVerification + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification; + + /** + * Creates a plain object from a PasswordLeakVerification message. Also converts values to other types if specified. + * @param message PasswordLeakVerification + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PasswordLeakVerification to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of an Assessment. */ interface IAssessment { @@ -4171,6 +4196,12 @@ export namespace google { /** Assessment reasons */ reasons?: (google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[]|null); + + /** Assessment passwordLeakVerification */ + passwordLeakVerification?: (google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null); + + /** Assessment accountDefenderAssessment */ + accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null); } /** Represents an Assessment. */ @@ -4197,6 +4228,12 @@ export namespace google { /** Assessment reasons. */ public reasons: google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[]; + /** Assessment passwordLeakVerification. */ + public passwordLeakVerification?: (google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null); + + /** Assessment accountDefenderAssessment. */ + public accountDefenderAssessment?: (google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null); + /** * Creates a new Assessment instance using the specified properties. * @param [properties] Properties to set @@ -4298,6 +4335,9 @@ export namespace google { /** Event expectedAction */ expectedAction?: (string|null); + + /** Event hashedAccountId */ + hashedAccountId?: (Uint8Array|string|null); } /** Represents an Event. */ @@ -4324,6 +4364,9 @@ export namespace google { /** Event expectedAction. */ public expectedAction: string; + /** Event hashedAccountId. */ + public hashedAccountId: (Uint8Array|string); + /** * Creates a new Event instance using the specified properties. * @param [properties] Properties to set @@ -4519,1009 +4562,112 @@ export namespace google { EXPIRED = 3, DUPE = 4, SITE_MISMATCH = 5, - MISSING = 6 + MISSING = 6, + BROWSER_ERROR = 7 } } - /** Properties of a CreateKeyRequest. */ - interface ICreateKeyRequest { - - /** CreateKeyRequest parent */ - parent?: (string|null); + /** Properties of an AccountDefenderAssessment. */ + interface IAccountDefenderAssessment { - /** CreateKeyRequest key */ - key?: (google.cloud.recaptchaenterprise.v1beta1.IKey|null); + /** AccountDefenderAssessment labels */ + labels?: (google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel[]|null); } - /** Represents a CreateKeyRequest. */ - class CreateKeyRequest implements ICreateKeyRequest { + /** Represents an AccountDefenderAssessment. */ + class AccountDefenderAssessment implements IAccountDefenderAssessment { /** - * Constructs a new CreateKeyRequest. + * Constructs a new AccountDefenderAssessment. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest); - - /** CreateKeyRequest parent. */ - public parent: string; + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment); - /** CreateKeyRequest key. */ - public key?: (google.cloud.recaptchaenterprise.v1beta1.IKey|null); + /** AccountDefenderAssessment labels. */ + public labels: google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel[]; /** - * Creates a new CreateKeyRequest instance using the specified properties. + * Creates a new AccountDefenderAssessment instance using the specified properties. * @param [properties] Properties to set - * @returns CreateKeyRequest instance + * @returns AccountDefenderAssessment instance */ - public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; /** - * Encodes the specified CreateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest.verify|verify} messages. - * @param message CreateKeyRequest message or plain object to encode + * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. + * @param message AccountDefenderAssessment message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest.verify|verify} messages. - * @param message CreateKeyRequest message or plain object to encode + * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. + * @param message AccountDefenderAssessment message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateKeyRequest message from the specified reader or buffer. + * Decodes an AccountDefenderAssessment message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateKeyRequest + * @returns AccountDefenderAssessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; /** - * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateKeyRequest + * @returns AccountDefenderAssessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; /** - * Verifies a CreateKeyRequest message. + * Verifies an AccountDefenderAssessment message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateKeyRequest + * @returns AccountDefenderAssessment */ - public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment; /** - * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. - * @param message CreateKeyRequest + * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. + * @param message AccountDefenderAssessment * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateKeyRequest to JSON. + * Converts this AccountDefenderAssessment 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.v1beta1.IListKeysRequest); + namespace AccountDefenderAssessment { - /** 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.v1beta1.IListKeysRequest): google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest; - - /** - * Encodes the specified ListKeysRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IListKeysRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListKeysRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IListKeysResponse); - - /** ListKeysResponse keys. */ - public keys: google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IListKeysResponse): google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse; - - /** - * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IListKeysResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IGetKeyRequest): google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest; - - /** - * Encodes the specified GetKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IGetKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IUpdateKeyRequest); - - /** UpdateKeyRequest key. */ - public key?: (google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IUpdateKeyRequest): google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest; - - /** - * Encodes the specified UpdateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IUpdateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IDeleteKeyRequest): google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest; - - /** - * Encodes the specified DeleteKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IDeleteKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IWebKeySettings|null); - - /** Key androidSettings */ - androidSettings?: (google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings|null); - - /** Key iosSettings */ - iosSettings?: (google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings|null); - } - - /** Represents a Key. */ - class Key implements IKey { - - /** - * Constructs a new Key. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IKey); - - /** Key name. */ - public name: string; - - /** Key displayName. */ - public displayName: string; - - /** Key webSettings. */ - public webSettings?: (google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings|null); - - /** Key androidSettings. */ - public androidSettings?: (google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings|null); - - /** Key iosSettings. */ - public iosSettings?: (google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings|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.v1beta1.IKey): google.cloud.recaptchaenterprise.v1beta1.Key; - - /** - * Encodes the specified Key message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IKey, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Key message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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 enforceAllowedDomains */ - enforceAllowedDomains?: (boolean|null); - - /** WebKeySettings allowedDomains */ - allowedDomains?: (string[]|null); - - /** WebKeySettings allowAmpTraffic */ - allowAmpTraffic?: (boolean|null); - - /** WebKeySettings integrationType */ - integrationType?: (google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType|keyof typeof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType|null); - - /** WebKeySettings challengeSecurityPreference */ - challengeSecurityPreference?: (google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference|keyof typeof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference|null); - } - - /** Represents a WebKeySettings. */ - class WebKeySettings implements IWebKeySettings { - - /** - * Constructs a new WebKeySettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings); - - /** WebKeySettings enforceAllowedDomains. */ - public enforceAllowedDomains: boolean; - - /** WebKeySettings allowedDomains. */ - public allowedDomains: string[]; - - /** WebKeySettings allowAmpTraffic. */ - public allowAmpTraffic: boolean; - - /** WebKeySettings integrationType. */ - public integrationType: (google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType|keyof typeof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType); - - /** WebKeySettings challengeSecurityPreference. */ - public challengeSecurityPreference: (google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference|keyof typeof google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IWebKeySettings): google.cloud.recaptchaenterprise.v1beta1.WebKeySettings; - - /** - * Encodes the specified WebKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IWebKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified WebKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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_ONLY = 1, - CHECKBOX_CHALLENGE = 2, - INVISIBLE_CHALLENGE = 3 - } - - /** ChallengeSecurityPreference enum. */ - enum ChallengeSecurityPreference { - CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0, - USABILITY = 1, - BALANCED = 2, - SECURITY = 3 + /** AccountDefenderLabel enum. */ + enum AccountDefenderLabel { + ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0, + PROFILE_MATCH = 1, + SUSPICIOUS_LOGIN_ACTIVITY = 2, + SUSPICIOUS_ACCOUNT_CREATION = 3, + RELATED_ACCOUNTS_NUMBER_HIGH = 4 } } - - /** Properties of 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.v1beta1.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.v1beta1.IAndroidKeySettings): google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings; - - /** - * Encodes the specified AndroidKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IAndroidKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AndroidKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IIOSKeySettings): google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings; - - /** - * Encodes the specified IOSKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IIOSKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified IOSKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IOSKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this IOSKeySettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } } } } diff --git a/protos/protos.js b/protos/protos.js index 7ad309e..b798ec9 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -8986,171 +8986,6 @@ * @variation 2 */ - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#createKey}. - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @typedef CreateKeyCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.recaptchaenterprise.v1beta1.Key} [response] Key - */ - - /** - * Calls CreateKey. - * @function createKey - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest} request CreateKeyRequest message or plain object - * @param {google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateKeyCallback} callback Node-style callback called with the error, if any, and Key - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(RecaptchaEnterpriseServiceV1Beta1.prototype.createKey = function createKey(request, callback) { - return this.rpcCall(createKey, $root.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest, $root.google.cloud.recaptchaenterprise.v1beta1.Key, request, callback); - }, "name", { value: "CreateKey" }); - - /** - * Calls CreateKey. - * @function createKey - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest} request CreateKeyRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#listKeys}. - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @typedef ListKeysCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse} [response] ListKeysResponse - */ - - /** - * Calls ListKeys. - * @function listKeys - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest} request ListKeysRequest message or plain object - * @param {google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.ListKeysCallback} callback Node-style callback called with the error, if any, and ListKeysResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(RecaptchaEnterpriseServiceV1Beta1.prototype.listKeys = function listKeys(request, callback) { - return this.rpcCall(listKeys, $root.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest, $root.google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse, request, callback); - }, "name", { value: "ListKeys" }); - - /** - * Calls ListKeys. - * @function listKeys - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest} request ListKeysRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#getKey}. - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @typedef GetKeyCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.recaptchaenterprise.v1beta1.Key} [response] Key - */ - - /** - * Calls GetKey. - * @function getKey - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest} request GetKeyRequest message or plain object - * @param {google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.GetKeyCallback} callback Node-style callback called with the error, if any, and Key - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(RecaptchaEnterpriseServiceV1Beta1.prototype.getKey = function getKey(request, callback) { - return this.rpcCall(getKey, $root.google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest, $root.google.cloud.recaptchaenterprise.v1beta1.Key, request, callback); - }, "name", { value: "GetKey" }); - - /** - * Calls GetKey. - * @function getKey - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest} request GetKeyRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#updateKey}. - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @typedef UpdateKeyCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.recaptchaenterprise.v1beta1.Key} [response] Key - */ - - /** - * Calls UpdateKey. - * @function updateKey - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest} request UpdateKeyRequest message or plain object - * @param {google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.UpdateKeyCallback} callback Node-style callback called with the error, if any, and Key - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(RecaptchaEnterpriseServiceV1Beta1.prototype.updateKey = function updateKey(request, callback) { - return this.rpcCall(updateKey, $root.google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest, $root.google.cloud.recaptchaenterprise.v1beta1.Key, request, callback); - }, "name", { value: "UpdateKey" }); - - /** - * Calls UpdateKey. - * @function updateKey - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest} request UpdateKeyRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1#deleteKey}. - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @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.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest} request DeleteKeyRequest message or plain object - * @param {google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.DeleteKeyCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(RecaptchaEnterpriseServiceV1Beta1.prototype.deleteKey = function deleteKey(request, callback) { - return this.rpcCall(deleteKey, $root.google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "DeleteKey" }); - - /** - * Calls DeleteKey. - * @function deleteKey - * @memberof google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1 - * @instance - * @param {google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest} request DeleteKeyRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - return RecaptchaEnterpriseServiceV1Beta1; })(); @@ -9377,6 +9212,8 @@ * @interface IAnnotateAssessmentRequest * @property {string|null} [name] AnnotateAssessmentRequest name * @property {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation|null} [annotation] AnnotateAssessmentRequest annotation + * @property {Array.|null} [reasons] AnnotateAssessmentRequest reasons + * @property {Uint8Array|null} [hashedAccountId] AnnotateAssessmentRequest hashedAccountId */ /** @@ -9388,6 +9225,7 @@ * @param {google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest=} [properties] Properties to set */ function AnnotateAssessmentRequest(properties) { + this.reasons = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9410,6 +9248,22 @@ */ AnnotateAssessmentRequest.prototype.annotation = 0; + /** + * AnnotateAssessmentRequest reasons. + * @member {Array.} reasons + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.reasons = $util.emptyArray; + + /** + * AnnotateAssessmentRequest hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest + * @instance + */ + AnnotateAssessmentRequest.prototype.hashedAccountId = $util.newBuffer([]); + /** * Creates a new AnnotateAssessmentRequest instance using the specified properties. * @function create @@ -9438,6 +9292,14 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.annotation != null && Object.hasOwnProperty.call(message, "annotation")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.annotation); + if (message.reasons != null && message.reasons.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.reasons.length; ++i) + writer.int32(message.reasons[i]); + writer.ldelim(); + } + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hashedAccountId); return writer; }; @@ -9478,6 +9340,19 @@ case 2: message.annotation = reader.int32(); break; + case 3: + if (!(message.reasons && message.reasons.length)) + message.reasons = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.reasons.push(reader.int32()); + } else + message.reasons.push(reader.int32()); + break; + case 4: + message.hashedAccountId = reader.bytes(); + break; default: reader.skipType(tag & 7); break; @@ -9523,8 +9398,33 @@ case 0: case 1: case 2: + case 3: + case 4: break; } + if (message.reasons != null && message.hasOwnProperty("reasons")) { + if (!Array.isArray(message.reasons)) + return "reasons: array expected"; + for (var i = 0; i < message.reasons.length; ++i) + switch (message.reasons[i]) { + default: + return "reasons: enum value[] expected"; + case 0: + case 1: + case 8: + case 9: + case 2: + case 7: + case 3: + case 4: + case 5: + case 6: + break; + } + } + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; return null; }; @@ -9555,7 +9455,69 @@ case 2: message.annotation = 2; break; + case "PASSWORD_CORRECT": + case 3: + message.annotation = 3; + break; + case "PASSWORD_INCORRECT": + case 4: + message.annotation = 4; + break; + } + if (object.reasons) { + if (!Array.isArray(object.reasons)) + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.reasons: array expected"); + message.reasons = []; + for (var i = 0; i < object.reasons.length; ++i) + switch (object.reasons[i]) { + default: + case "REASON_UNSPECIFIED": + case 0: + message.reasons[i] = 0; + break; + case "CHARGEBACK": + case 1: + message.reasons[i] = 1; + break; + case "CHARGEBACK_FRAUD": + case 8: + message.reasons[i] = 8; + break; + case "CHARGEBACK_DISPUTE": + case 9: + message.reasons[i] = 9; + break; + case "PAYMENT_HEURISTICS": + case 2: + message.reasons[i] = 2; + break; + case "INITIATED_TWO_FACTOR": + case 7: + message.reasons[i] = 7; + break; + case "PASSED_TWO_FACTOR": + case 3: + message.reasons[i] = 3; + break; + case "FAILED_TWO_FACTOR": + case 4: + message.reasons[i] = 4; + break; + case "CORRECT_PASSWORD": + case 5: + message.reasons[i] = 5; + break; + case "INCORRECT_PASSWORD": + case 6: + message.reasons[i] = 6; + break; + } } + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length) + message.hashedAccountId = object.hashedAccountId; return message; }; @@ -9572,14 +9534,30 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.reasons = []; if (options.defaults) { object.name = ""; object.annotation = options.enums === String ? "ANNOTATION_UNSPECIFIED" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; if (message.annotation != null && message.hasOwnProperty("annotation")) object.annotation = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation[message.annotation] : message.annotation; + if (message.reasons && message.reasons.length) { + object.reasons = []; + for (var j = 0; j < message.reasons.length; ++j) + object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason[message.reasons[j]] : message.reasons[j]; + } + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; return object; }; @@ -9601,12 +9579,46 @@ * @property {number} ANNOTATION_UNSPECIFIED=0 ANNOTATION_UNSPECIFIED value * @property {number} LEGITIMATE=1 LEGITIMATE value * @property {number} FRAUDULENT=2 FRAUDULENT value + * @property {number} PASSWORD_CORRECT=3 PASSWORD_CORRECT value + * @property {number} PASSWORD_INCORRECT=4 PASSWORD_INCORRECT value */ AnnotateAssessmentRequest.Annotation = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "ANNOTATION_UNSPECIFIED"] = 0; values[valuesById[1] = "LEGITIMATE"] = 1; values[valuesById[2] = "FRAUDULENT"] = 2; + values[valuesById[3] = "PASSWORD_CORRECT"] = 3; + values[valuesById[4] = "PASSWORD_INCORRECT"] = 4; + return values; + })(); + + /** + * Reason enum. + * @name google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Reason + * @enum {number} + * @property {number} REASON_UNSPECIFIED=0 REASON_UNSPECIFIED value + * @property {number} CHARGEBACK=1 CHARGEBACK value + * @property {number} CHARGEBACK_FRAUD=8 CHARGEBACK_FRAUD value + * @property {number} CHARGEBACK_DISPUTE=9 CHARGEBACK_DISPUTE value + * @property {number} PAYMENT_HEURISTICS=2 PAYMENT_HEURISTICS value + * @property {number} INITIATED_TWO_FACTOR=7 INITIATED_TWO_FACTOR value + * @property {number} PASSED_TWO_FACTOR=3 PASSED_TWO_FACTOR value + * @property {number} FAILED_TWO_FACTOR=4 FAILED_TWO_FACTOR value + * @property {number} CORRECT_PASSWORD=5 CORRECT_PASSWORD value + * @property {number} INCORRECT_PASSWORD=6 INCORRECT_PASSWORD value + */ + AnnotateAssessmentRequest.Reason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "CHARGEBACK"] = 1; + values[valuesById[8] = "CHARGEBACK_FRAUD"] = 8; + values[valuesById[9] = "CHARGEBACK_DISPUTE"] = 9; + values[valuesById[2] = "PAYMENT_HEURISTICS"] = 2; + values[valuesById[7] = "INITIATED_TWO_FACTOR"] = 7; + values[valuesById[3] = "PASSED_TWO_FACTOR"] = 3; + values[valuesById[4] = "FAILED_TWO_FACTOR"] = 4; + values[valuesById[5] = "CORRECT_PASSWORD"] = 5; + values[valuesById[6] = "INCORRECT_PASSWORD"] = 6; return values; })(); @@ -9773,6 +9785,247 @@ return AnnotateAssessmentResponse; })(); + v1beta1.PasswordLeakVerification = (function() { + + /** + * Properties of a PasswordLeakVerification. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface IPasswordLeakVerification + * @property {Uint8Array|null} [hashedUserCredentials] PasswordLeakVerification hashedUserCredentials + * @property {boolean|null} [credentialsLeaked] PasswordLeakVerification credentialsLeaked + * @property {string|null} [canonicalizedUsername] PasswordLeakVerification canonicalizedUsername + */ + + /** + * Constructs a new PasswordLeakVerification. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents a PasswordLeakVerification. + * @implements IPasswordLeakVerification + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification=} [properties] Properties to set + */ + function PasswordLeakVerification(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PasswordLeakVerification hashedUserCredentials. + * @member {Uint8Array} hashedUserCredentials + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + */ + PasswordLeakVerification.prototype.hashedUserCredentials = $util.newBuffer([]); + + /** + * PasswordLeakVerification credentialsLeaked. + * @member {boolean} credentialsLeaked + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + */ + PasswordLeakVerification.prototype.credentialsLeaked = false; + + /** + * PasswordLeakVerification canonicalizedUsername. + * @member {string} canonicalizedUsername + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + */ + PasswordLeakVerification.prototype.canonicalizedUsername = ""; + + /** + * Creates a new PasswordLeakVerification instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification instance + */ + PasswordLeakVerification.create = function create(properties) { + return new PasswordLeakVerification(properties); + }; + + /** + * Encodes the specified PasswordLeakVerification message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification} message PasswordLeakVerification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordLeakVerification.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hashedUserCredentials != null && Object.hasOwnProperty.call(message, "hashedUserCredentials")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hashedUserCredentials); + if (message.credentialsLeaked != null && Object.hasOwnProperty.call(message, "credentialsLeaked")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.credentialsLeaked); + if (message.canonicalizedUsername != null && Object.hasOwnProperty.call(message, "canonicalizedUsername")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.canonicalizedUsername); + return writer; + }; + + /** + * Encodes the specified PasswordLeakVerification message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification} message PasswordLeakVerification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordLeakVerification.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordLeakVerification.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hashedUserCredentials = reader.bytes(); + break; + case 2: + message.credentialsLeaked = reader.bool(); + break; + case 3: + message.canonicalizedUsername = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PasswordLeakVerification message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordLeakVerification.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PasswordLeakVerification message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PasswordLeakVerification.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hashedUserCredentials != null && message.hasOwnProperty("hashedUserCredentials")) + if (!(message.hashedUserCredentials && typeof message.hashedUserCredentials.length === "number" || $util.isString(message.hashedUserCredentials))) + return "hashedUserCredentials: buffer expected"; + if (message.credentialsLeaked != null && message.hasOwnProperty("credentialsLeaked")) + if (typeof message.credentialsLeaked !== "boolean") + return "credentialsLeaked: boolean expected"; + if (message.canonicalizedUsername != null && message.hasOwnProperty("canonicalizedUsername")) + if (!$util.isString(message.canonicalizedUsername)) + return "canonicalizedUsername: string expected"; + return null; + }; + + /** + * Creates a PasswordLeakVerification message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} PasswordLeakVerification + */ + PasswordLeakVerification.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification) + return object; + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification(); + if (object.hashedUserCredentials != null) + if (typeof object.hashedUserCredentials === "string") + $util.base64.decode(object.hashedUserCredentials, message.hashedUserCredentials = $util.newBuffer($util.base64.length(object.hashedUserCredentials)), 0); + else if (object.hashedUserCredentials.length) + message.hashedUserCredentials = object.hashedUserCredentials; + if (object.credentialsLeaked != null) + message.credentialsLeaked = Boolean(object.credentialsLeaked); + if (object.canonicalizedUsername != null) + message.canonicalizedUsername = String(object.canonicalizedUsername); + return message; + }; + + /** + * Creates a plain object from a PasswordLeakVerification message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification} message PasswordLeakVerification + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PasswordLeakVerification.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.hashedUserCredentials = ""; + else { + object.hashedUserCredentials = []; + if (options.bytes !== Array) + object.hashedUserCredentials = $util.newBuffer(object.hashedUserCredentials); + } + object.credentialsLeaked = false; + object.canonicalizedUsername = ""; + } + if (message.hashedUserCredentials != null && message.hasOwnProperty("hashedUserCredentials")) + object.hashedUserCredentials = options.bytes === String ? $util.base64.encode(message.hashedUserCredentials, 0, message.hashedUserCredentials.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedUserCredentials) : message.hashedUserCredentials; + if (message.credentialsLeaked != null && message.hasOwnProperty("credentialsLeaked")) + object.credentialsLeaked = message.credentialsLeaked; + if (message.canonicalizedUsername != null && message.hasOwnProperty("canonicalizedUsername")) + object.canonicalizedUsername = message.canonicalizedUsername; + return object; + }; + + /** + * Converts this PasswordLeakVerification to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification + * @instance + * @returns {Object.} JSON object + */ + PasswordLeakVerification.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PasswordLeakVerification; + })(); + v1beta1.Assessment = (function() { /** @@ -9784,6 +10037,8 @@ * @property {number|null} [score] Assessment score * @property {google.cloud.recaptchaenterprise.v1beta1.ITokenProperties|null} [tokenProperties] Assessment tokenProperties * @property {Array.|null} [reasons] Assessment reasons + * @property {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null} [passwordLeakVerification] Assessment passwordLeakVerification + * @property {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null} [accountDefenderAssessment] Assessment accountDefenderAssessment */ /** @@ -9842,6 +10097,22 @@ */ Assessment.prototype.reasons = $util.emptyArray; + /** + * Assessment passwordLeakVerification. + * @member {google.cloud.recaptchaenterprise.v1beta1.IPasswordLeakVerification|null|undefined} passwordLeakVerification + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.passwordLeakVerification = null; + + /** + * Assessment accountDefenderAssessment. + * @member {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment|null|undefined} accountDefenderAssessment + * @memberof google.cloud.recaptchaenterprise.v1beta1.Assessment + * @instance + */ + Assessment.prototype.accountDefenderAssessment = null; + /** * Creates a new Assessment instance using the specified properties. * @function create @@ -9880,6 +10151,10 @@ writer.int32(message.reasons[i]); writer.ldelim(); } + if (message.passwordLeakVerification != null && Object.hasOwnProperty.call(message, "passwordLeakVerification")) + $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.encode(message.passwordLeakVerification, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.accountDefenderAssessment != null && Object.hasOwnProperty.call(message, "accountDefenderAssessment")) + $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.encode(message.accountDefenderAssessment, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -9936,6 +10211,12 @@ } else message.reasons.push(reader.int32()); break; + case 7: + message.passwordLeakVerification = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.decode(reader, reader.uint32()); + break; + case 8: + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -10003,6 +10284,16 @@ break; } } + if (message.passwordLeakVerification != null && message.hasOwnProperty("passwordLeakVerification")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.verify(message.passwordLeakVerification); + if (error) + return "passwordLeakVerification." + error; + } + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify(message.accountDefenderAssessment); + if (error) + return "accountDefenderAssessment." + error; + } return null; }; @@ -10065,6 +10356,16 @@ break; } } + if (object.passwordLeakVerification != null) { + if (typeof object.passwordLeakVerification !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Assessment.passwordLeakVerification: object expected"); + message.passwordLeakVerification = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.fromObject(object.passwordLeakVerification); + } + if (object.accountDefenderAssessment != null) { + if (typeof object.accountDefenderAssessment !== "object") + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Assessment.accountDefenderAssessment: object expected"); + message.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.fromObject(object.accountDefenderAssessment); + } return message; }; @@ -10088,6 +10389,8 @@ object.event = null; object.score = 0; object.tokenProperties = null; + object.passwordLeakVerification = null; + object.accountDefenderAssessment = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -10102,6 +10405,10 @@ for (var j = 0; j < message.reasons.length; ++j) object.reasons[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[message.reasons[j]] : message.reasons[j]; } + if (message.passwordLeakVerification != null && message.hasOwnProperty("passwordLeakVerification")) + object.passwordLeakVerification = $root.google.cloud.recaptchaenterprise.v1beta1.PasswordLeakVerification.toObject(message.passwordLeakVerification, options); + if (message.accountDefenderAssessment != null && message.hasOwnProperty("accountDefenderAssessment")) + object.accountDefenderAssessment = $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.toObject(message.accountDefenderAssessment, options); return object; }; @@ -10152,6 +10459,7 @@ * @property {string|null} [userAgent] Event userAgent * @property {string|null} [userIpAddress] Event userIpAddress * @property {string|null} [expectedAction] Event expectedAction + * @property {Uint8Array|null} [hashedAccountId] Event hashedAccountId */ /** @@ -10209,6 +10517,14 @@ */ Event.prototype.expectedAction = ""; + /** + * Event hashedAccountId. + * @member {Uint8Array} hashedAccountId + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.hashedAccountId = $util.newBuffer([]); + /** * Creates a new Event instance using the specified properties. * @function create @@ -10243,6 +10559,8 @@ writer.uint32(/* id 4, wireType 2 =*/34).string(message.userIpAddress); if (message.expectedAction != null && Object.hasOwnProperty.call(message, "expectedAction")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.expectedAction); + if (message.hashedAccountId != null && Object.hasOwnProperty.call(message, "hashedAccountId")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.hashedAccountId); return writer; }; @@ -10292,6 +10610,9 @@ case 5: message.expectedAction = reader.string(); break; + case 6: + message.hashedAccountId = reader.bytes(); + break; default: reader.skipType(tag & 7); break; @@ -10342,6 +10663,9 @@ if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) if (!$util.isString(message.expectedAction)) return "expectedAction: string expected"; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + if (!(message.hashedAccountId && typeof message.hashedAccountId.length === "number" || $util.isString(message.hashedAccountId))) + return "hashedAccountId: buffer expected"; return null; }; @@ -10367,6 +10691,11 @@ message.userIpAddress = String(object.userIpAddress); if (object.expectedAction != null) message.expectedAction = String(object.expectedAction); + if (object.hashedAccountId != null) + if (typeof object.hashedAccountId === "string") + $util.base64.decode(object.hashedAccountId, message.hashedAccountId = $util.newBuffer($util.base64.length(object.hashedAccountId)), 0); + else if (object.hashedAccountId.length) + message.hashedAccountId = object.hashedAccountId; return message; }; @@ -10389,6 +10718,13 @@ object.userAgent = ""; object.userIpAddress = ""; object.expectedAction = ""; + if (options.bytes === String) + object.hashedAccountId = ""; + else { + object.hashedAccountId = []; + if (options.bytes !== Array) + object.hashedAccountId = $util.newBuffer(object.hashedAccountId); + } } if (message.token != null && message.hasOwnProperty("token")) object.token = message.token; @@ -10400,6 +10736,8 @@ object.userIpAddress = message.userIpAddress; if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) object.expectedAction = message.expectedAction; + if (message.hashedAccountId != null && message.hasOwnProperty("hashedAccountId")) + object.hashedAccountId = options.bytes === String ? $util.base64.encode(message.hashedAccountId, 0, message.hashedAccountId.length) : options.bytes === Array ? Array.prototype.slice.call(message.hashedAccountId) : message.hashedAccountId; return object; }; @@ -10617,6 +10955,7 @@ case 4: case 5: case 6: + case 7: break; } if (message.createTime != null && message.hasOwnProperty("createTime")) { @@ -10676,6 +11015,10 @@ case 6: message.invalidReason = 6; break; + case "BROWSER_ERROR": + case 7: + message.invalidReason = 7; + break; } if (object.createTime != null) { if (typeof object.createTime !== "object") @@ -10744,6 +11087,7 @@ * @property {number} DUPE=4 DUPE value * @property {number} SITE_MISMATCH=5 SITE_MISMATCH value * @property {number} MISSING=6 MISSING value + * @property {number} BROWSER_ERROR=7 BROWSER_ERROR value */ TokenProperties.InvalidReason = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -10754,31 +11098,32 @@ values[valuesById[4] = "DUPE"] = 4; values[valuesById[5] = "SITE_MISMATCH"] = 5; values[valuesById[6] = "MISSING"] = 6; + values[valuesById[7] = "BROWSER_ERROR"] = 7; return values; })(); return TokenProperties; })(); - v1beta1.CreateKeyRequest = (function() { + v1beta1.AccountDefenderAssessment = (function() { /** - * Properties of a CreateKeyRequest. + * Properties of an AccountDefenderAssessment. * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface ICreateKeyRequest - * @property {string|null} [parent] CreateKeyRequest parent - * @property {google.cloud.recaptchaenterprise.v1beta1.IKey|null} [key] CreateKeyRequest key + * @interface IAccountDefenderAssessment + * @property {Array.|null} [labels] AccountDefenderAssessment labels */ /** - * Constructs a new CreateKeyRequest. + * Constructs a new AccountDefenderAssessment. * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents a CreateKeyRequest. - * @implements ICreateKeyRequest + * @classdesc Represents an AccountDefenderAssessment. + * @implements IAccountDefenderAssessment * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest=} [properties] Properties to set + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment=} [properties] Properties to set */ - function CreateKeyRequest(properties) { + function AccountDefenderAssessment(properties) { + this.labels = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10786,88 +11131,86 @@ } /** - * CreateKeyRequest parent. - * @member {string} parent - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest - * @instance - */ - CreateKeyRequest.prototype.parent = ""; - - /** - * CreateKeyRequest key. - * @member {google.cloud.recaptchaenterprise.v1beta1.IKey|null|undefined} key - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * AccountDefenderAssessment labels. + * @member {Array.} labels + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @instance */ - CreateKeyRequest.prototype.key = null; + AccountDefenderAssessment.prototype.labels = $util.emptyArray; /** - * Creates a new CreateKeyRequest instance using the specified properties. + * Creates a new AccountDefenderAssessment instance using the specified properties. * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest instance + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment instance */ - CreateKeyRequest.create = function create(properties) { - return new CreateKeyRequest(properties); + AccountDefenderAssessment.create = function create(properties) { + return new AccountDefenderAssessment(properties); }; /** - * Encodes the specified CreateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest.verify|verify} messages. + * Encodes the specified AccountDefenderAssessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateKeyRequest.encode = function encode(message, writer) { + AccountDefenderAssessment.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - $root.google.cloud.recaptchaenterprise.v1beta1.Key.encode(message.key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.labels != null && message.labels.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.labels.length; ++i) + writer.int32(message.labels[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified CreateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest.verify|verify} messages. + * Encodes the specified AccountDefenderAssessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {google.cloud.recaptchaenterprise.v1beta1.IAccountDefenderAssessment} message AccountDefenderAssessment message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + AccountDefenderAssessment.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateKeyRequest message from the specified reader or buffer. + * Decodes an AccountDefenderAssessment message from the specified reader or buffer. * @function decode - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateKeyRequest.decode = function decode(reader, length) { + AccountDefenderAssessment.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.key = $root.google.cloud.recaptchaenterprise.v1beta1.Key.decode(reader, reader.uint32()); + if (!(message.labels && message.labels.length)) + message.labels = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.labels.push(reader.int32()); + } else + message.labels.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -10878,2264 +11221,149 @@ }; /** - * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * Decodes an AccountDefenderAssessment message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateKeyRequest.decodeDelimited = function decodeDelimited(reader) { + AccountDefenderAssessment.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateKeyRequest message. + * Verifies an AccountDefenderAssessment message. * @function verify - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateKeyRequest.verify = function verify(message) { + AccountDefenderAssessment.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.v1beta1.Key.verify(message.key); - if (error) - return "key." + error; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) + switch (message.labels[i]) { + default: + return "labels: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } } return null; }; /** - * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AccountDefenderAssessment message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest + * @returns {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} AccountDefenderAssessment */ - CreateKeyRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest) + AccountDefenderAssessment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment) return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.key != null) { - if (typeof object.key !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest.key: object expected"); - message.key = $root.google.cloud.recaptchaenterprise.v1beta1.Key.fromObject(object.key); + var message = new $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment(); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) + switch (object.labels[i]) { + default: + case "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": + case 0: + message.labels[i] = 0; + break; + case "PROFILE_MATCH": + case 1: + message.labels[i] = 1; + break; + case "SUSPICIOUS_LOGIN_ACTIVITY": + case 2: + message.labels[i] = 2; + break; + case "SUSPICIOUS_ACCOUNT_CREATION": + case 3: + message.labels[i] = 3; + break; + case "RELATED_ACCOUNTS_NUMBER_HIGH": + case 4: + message.labels[i] = 4; + break; + } } return message; }; /** - * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. + * Creates a plain object from an AccountDefenderAssessment message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} message CreateKeyRequest + * @param {google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment} message AccountDefenderAssessment * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateKeyRequest.toObject = function toObject(message, options) { + AccountDefenderAssessment.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.key = null; + if (options.arrays || options.defaults) + object.labels = []; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel[message.labels[j]] : message.labels[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.key != null && message.hasOwnProperty("key")) - object.key = $root.google.cloud.recaptchaenterprise.v1beta1.Key.toObject(message.key, options); return object; }; /** - * Converts this CreateKeyRequest to JSON. + * Converts this AccountDefenderAssessment to JSON. * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment * @instance * @returns {Object.} JSON object */ - CreateKeyRequest.prototype.toJSON = function toJSON() { + AccountDefenderAssessment.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateKeyRequest; - })(); - - v1beta1.ListKeysRequest = (function() { - - /** - * Properties of a ListKeysRequest. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @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.v1beta1 - * @classdesc Represents a ListKeysRequest. - * @implements IListKeysRequest - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.ListKeysRequest - * @instance - */ - ListKeysRequest.prototype.parent = ""; - - /** - * ListKeysRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest - * @instance - */ - ListKeysRequest.prototype.pageSize = 0; - - /** - * ListKeysRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest - * @instance - */ - ListKeysRequest.prototype.pageToken = ""; - - /** - * Creates a new ListKeysRequest instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest} ListKeysRequest instance - */ - ListKeysRequest.create = function create(properties) { - return new ListKeysRequest(properties); - }; - - /** - * Encodes the specified ListKeysRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest} message ListKeysRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListKeysRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - return writer; - }; - /** - * Encodes the specified ListKeysRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest} message ListKeysRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * AccountDefenderLabel enum. + * @name google.cloud.recaptchaenterprise.v1beta1.AccountDefenderAssessment.AccountDefenderLabel + * @enum {number} + * @property {number} ACCOUNT_DEFENDER_LABEL_UNSPECIFIED=0 ACCOUNT_DEFENDER_LABEL_UNSPECIFIED value + * @property {number} PROFILE_MATCH=1 PROFILE_MATCH value + * @property {number} SUSPICIOUS_LOGIN_ACTIVITY=2 SUSPICIOUS_LOGIN_ACTIVITY value + * @property {number} SUSPICIOUS_ACCOUNT_CREATION=3 SUSPICIOUS_ACCOUNT_CREATION value + * @property {number} RELATED_ACCOUNTS_NUMBER_HIGH=4 RELATED_ACCOUNTS_NUMBER_HIGH value */ - ListKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + AccountDefenderAssessment.AccountDefenderLabel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROFILE_MATCH"] = 1; + values[valuesById[2] = "SUSPICIOUS_LOGIN_ACTIVITY"] = 2; + values[valuesById[3] = "SUSPICIOUS_ACCOUNT_CREATION"] = 3; + values[valuesById[4] = "RELATED_ACCOUNTS_NUMBER_HIGH"] = 4; + return values; + })(); - /** - * Decodes a ListKeysRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.ListKeysRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.ListKeysRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest} ListKeysRequest - */ - ListKeysRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.ListKeysRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.ListKeysRequest - * @instance - * @returns {Object.} JSON object - */ - ListKeysRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListKeysRequest; - })(); - - v1beta1.ListKeysResponse = (function() { - - /** - * Properties of a ListKeysResponse. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IListKeysResponse - * @property {Array.|null} [keys] ListKeysResponse keys - * @property {string|null} [nextPageToken] ListKeysResponse nextPageToken - */ - - /** - * Constructs a new ListKeysResponse. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents a ListKeysResponse. - * @implements IListKeysResponse - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.ListKeysResponse - * @instance - */ - ListKeysResponse.prototype.keys = $util.emptyArray; - - /** - * ListKeysResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse - * @instance - */ - ListKeysResponse.prototype.nextPageToken = ""; - - /** - * Creates a new ListKeysResponse instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse} ListKeysResponse instance - */ - ListKeysResponse.create = function create(properties) { - return new ListKeysResponse(properties); - }; - - /** - * Encodes the specified ListKeysResponse message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.Key.encode(message.keys[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.ListKeysResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.ListKeysResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse} ListKeysResponse - */ - ListKeysResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse(); - if (object.keys) { - if (!Array.isArray(object.keys)) - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.ListKeysResponse.keys: object expected"); - message.keys[i] = $root.google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.ListKeysResponse - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.ListKeysResponse - * @instance - * @returns {Object.} JSON object - */ - ListKeysResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListKeysResponse; - })(); - - v1beta1.GetKeyRequest = (function() { - - /** - * Properties of a GetKeyRequest. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IGetKeyRequest - * @property {string|null} [name] GetKeyRequest name - */ - - /** - * Constructs a new GetKeyRequest. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents a GetKeyRequest. - * @implements IGetKeyRequest - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.GetKeyRequest - * @instance - */ - GetKeyRequest.prototype.name = ""; - - /** - * Creates a new GetKeyRequest instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest} GetKeyRequest instance - */ - GetKeyRequest.create = function create(properties) { - return new GetKeyRequest(properties); - }; - - /** - * Encodes the specified GetKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest} message GetKeyRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetKeyRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.GetKeyRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.GetKeyRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest} GetKeyRequest - */ - GetKeyRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.GetKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.GetKeyRequest - * @instance - * @returns {Object.} JSON object - */ - GetKeyRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetKeyRequest; - })(); - - v1beta1.UpdateKeyRequest = (function() { - - /** - * Properties of an UpdateKeyRequest. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IUpdateKeyRequest - * @property {google.cloud.recaptchaenterprise.v1beta1.IKey|null} [key] UpdateKeyRequest key - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateKeyRequest updateMask - */ - - /** - * Constructs a new UpdateKeyRequest. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents an UpdateKeyRequest. - * @implements IUpdateKeyRequest - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IKey|null|undefined} key - * @memberof google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest - * @instance - */ - UpdateKeyRequest.prototype.key = null; - - /** - * UpdateKeyRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest - * @instance - */ - UpdateKeyRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateKeyRequest instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest} UpdateKeyRequest instance - */ - UpdateKeyRequest.create = function create(properties) { - return new UpdateKeyRequest(properties); - }; - - /** - * Encodes the specified UpdateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest} message UpdateKeyRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateKeyRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - $root.google.cloud.recaptchaenterprise.v1beta1.Key.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.UpdateKeyRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = $root.google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.UpdateKeyRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.UpdateKeyRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest} UpdateKeyRequest - */ - UpdateKeyRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest(); - if (object.key != null) { - if (typeof object.key !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest.key: object expected"); - message.key = $root.google.cloud.recaptchaenterprise.v1beta1.Key.fromObject(object.key); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.UpdateKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.UpdateKeyRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateKeyRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UpdateKeyRequest; - })(); - - v1beta1.DeleteKeyRequest = (function() { - - /** - * Properties of a DeleteKeyRequest. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IDeleteKeyRequest - * @property {string|null} [name] DeleteKeyRequest name - */ - - /** - * Constructs a new DeleteKeyRequest. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents a DeleteKeyRequest. - * @implements IDeleteKeyRequest - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.DeleteKeyRequest - * @instance - */ - DeleteKeyRequest.prototype.name = ""; - - /** - * Creates a new DeleteKeyRequest instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest} DeleteKeyRequest instance - */ - DeleteKeyRequest.create = function create(properties) { - return new DeleteKeyRequest(properties); - }; - - /** - * Encodes the specified DeleteKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest} message DeleteKeyRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteKeyRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.DeleteKeyRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.DeleteKeyRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest} DeleteKeyRequest - */ - DeleteKeyRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.DeleteKeyRequest - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.DeleteKeyRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteKeyRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DeleteKeyRequest; - })(); - - v1beta1.Key = (function() { - - /** - * Properties of a Key. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IKey - * @property {string|null} [name] Key name - * @property {string|null} [displayName] Key displayName - * @property {google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings|null} [webSettings] Key webSettings - * @property {google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings|null} [androidSettings] Key androidSettings - * @property {google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings|null} [iosSettings] Key iosSettings - */ - - /** - * Constructs a new Key. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents a Key. - * @implements IKey - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.IKey=} [properties] Properties to set - */ - function Key(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]]; - } - - /** - * Key name. - * @member {string} name - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @instance - */ - Key.prototype.name = ""; - - /** - * Key displayName. - * @member {string} displayName - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @instance - */ - Key.prototype.displayName = ""; - - /** - * Key webSettings. - * @member {google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings|null|undefined} webSettings - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @instance - */ - Key.prototype.webSettings = null; - - /** - * Key androidSettings. - * @member {google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings|null|undefined} androidSettings - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @instance - */ - Key.prototype.androidSettings = null; - - /** - * Key iosSettings. - * @member {google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings|null|undefined} iosSettings - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @instance - */ - Key.prototype.iosSettings = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Key platformSettings. - * @member {"webSettings"|"androidSettings"|"iosSettings"|undefined} platformSettings - * @memberof google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.Key - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IKey=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.Key} Key instance - */ - Key.create = function create(properties) { - return new Key(properties); - }; - - /** - * Encodes the specified Key message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Key.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IKey} message Key message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Key.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.webSettings != null && Object.hasOwnProperty.call(message, "webSettings")) - $root.google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.encode(message.webSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.androidSettings != null && Object.hasOwnProperty.call(message, "androidSettings")) - $root.google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings.encode(message.androidSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.iosSettings != null && Object.hasOwnProperty.call(message, "iosSettings")) - $root.google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings.encode(message.iosSettings, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Key message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Key.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.WebKeySettings.decode(reader, reader.uint32()); - break; - case 4: - message.androidSettings = $root.google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings.decode(reader, reader.uint32()); - break; - case 5: - message.iosSettings = $root.google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings.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.v1beta1.Key - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IOSKeySettings.verify(message.iosSettings); - if (error) - return "iosSettings." + 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.v1beta1.Key - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.Key} Key - */ - Key.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.Key) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.Key.webSettings: object expected"); - message.webSettings = $root.google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.fromObject(object.webSettings); - } - if (object.androidSettings != null) { - if (typeof object.androidSettings !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Key.androidSettings: object expected"); - message.androidSettings = $root.google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings.fromObject(object.androidSettings); - } - if (object.iosSettings != null) { - if (typeof object.iosSettings !== "object") - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.Key.iosSettings: object expected"); - message.iosSettings = $root.google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings.fromObject(object.iosSettings); - } - return message; - }; - - /** - * Creates a plain object from a Key message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.defaults) { - object.name = ""; - object.displayName = ""; - } - 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.v1beta1.WebKeySettings.toObject(message.webSettings, options); - if (options.oneofs) - object.platformSettings = "webSettings"; - } - if (message.androidSettings != null && message.hasOwnProperty("androidSettings")) { - object.androidSettings = $root.google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings.toObject(message.androidSettings, options); - if (options.oneofs) - object.platformSettings = "androidSettings"; - } - if (message.iosSettings != null && message.hasOwnProperty("iosSettings")) { - object.iosSettings = $root.google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings.toObject(message.iosSettings, options); - if (options.oneofs) - object.platformSettings = "iosSettings"; - } - return object; - }; - - /** - * Converts this Key to JSON. - * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1beta1.Key - * @instance - * @returns {Object.} JSON object - */ - Key.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Key; - })(); - - v1beta1.WebKeySettings = (function() { - - /** - * Properties of a WebKeySettings. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IWebKeySettings - * @property {boolean|null} [enforceAllowedDomains] WebKeySettings enforceAllowedDomains - * @property {Array.|null} [allowedDomains] WebKeySettings allowedDomains - * @property {boolean|null} [allowAmpTraffic] WebKeySettings allowAmpTraffic - * @property {google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType|null} [integrationType] WebKeySettings integrationType - * @property {google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference|null} [challengeSecurityPreference] WebKeySettings challengeSecurityPreference - */ - - /** - * Constructs a new WebKeySettings. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents a WebKeySettings. - * @implements IWebKeySettings - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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 enforceAllowedDomains. - * @member {boolean} enforceAllowedDomains - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @instance - */ - WebKeySettings.prototype.enforceAllowedDomains = false; - - /** - * WebKeySettings allowedDomains. - * @member {Array.} allowedDomains - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @instance - */ - WebKeySettings.prototype.allowedDomains = $util.emptyArray; - - /** - * WebKeySettings allowAmpTraffic. - * @member {boolean} allowAmpTraffic - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @instance - */ - WebKeySettings.prototype.allowAmpTraffic = false; - - /** - * WebKeySettings integrationType. - * @member {google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType} integrationType - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @instance - */ - WebKeySettings.prototype.integrationType = 0; - - /** - * WebKeySettings challengeSecurityPreference. - * @member {google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference} challengeSecurityPreference - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @instance - */ - WebKeySettings.prototype.challengeSecurityPreference = 0; - - /** - * Creates a new WebKeySettings instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.WebKeySettings} WebKeySettings instance - */ - WebKeySettings.create = function create(properties) { - return new WebKeySettings(properties); - }; - - /** - * Encodes the specified WebKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings} message WebKeySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebKeySettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allowedDomains != null && message.allowedDomains.length) - for (var i = 0; i < message.allowedDomains.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowedDomains[i]); - if (message.allowAmpTraffic != null && Object.hasOwnProperty.call(message, "allowAmpTraffic")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAmpTraffic); - if (message.enforceAllowedDomains != null && Object.hasOwnProperty.call(message, "enforceAllowedDomains")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enforceAllowedDomains); - if (message.integrationType != null && Object.hasOwnProperty.call(message, "integrationType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.integrationType); - if (message.challengeSecurityPreference != null && Object.hasOwnProperty.call(message, "challengeSecurityPreference")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.challengeSecurityPreference); - return writer; - }; - - /** - * Encodes the specified WebKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.WebKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.WebKeySettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - message.enforceAllowedDomains = 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.v1beta1.WebKeySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.enforceAllowedDomains != null && message.hasOwnProperty("enforceAllowedDomains")) - if (typeof message.enforceAllowedDomains !== "boolean") - return "enforceAllowedDomains: 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.v1beta1.WebKeySettings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.WebKeySettings} WebKeySettings - */ - WebKeySettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.WebKeySettings) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.WebKeySettings(); - if (object.enforceAllowedDomains != null) - message.enforceAllowedDomains = Boolean(object.enforceAllowedDomains); - if (object.allowedDomains) { - if (!Array.isArray(object.allowedDomains)) - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.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_ONLY": - case 1: - message.integrationType = 1; - break; - case "CHECKBOX_CHALLENGE": - case 2: - message.integrationType = 2; - break; - case "INVISIBLE_CHALLENGE": - 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 "BALANCED": - 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.v1beta1.WebKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.enforceAllowedDomains = 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.enforceAllowedDomains != null && message.hasOwnProperty("enforceAllowedDomains")) - object.enforceAllowedDomains = message.enforceAllowedDomains; - if (message.integrationType != null && message.hasOwnProperty("integrationType")) - object.integrationType = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType[message.integrationType] : message.integrationType; - if (message.challengeSecurityPreference != null && message.hasOwnProperty("challengeSecurityPreference")) - object.challengeSecurityPreference = options.enums === String ? $root.google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference[message.challengeSecurityPreference] : message.challengeSecurityPreference; - return object; - }; - - /** - * Converts this WebKeySettings to JSON. - * @function toJSON - * @memberof google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.WebKeySettings.IntegrationType - * @enum {number} - * @property {number} INTEGRATION_TYPE_UNSPECIFIED=0 INTEGRATION_TYPE_UNSPECIFIED value - * @property {number} SCORE_ONLY=1 SCORE_ONLY value - * @property {number} CHECKBOX_CHALLENGE=2 CHECKBOX_CHALLENGE value - * @property {number} INVISIBLE_CHALLENGE=3 INVISIBLE_CHALLENGE value - */ - WebKeySettings.IntegrationType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "INTEGRATION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SCORE_ONLY"] = 1; - values[valuesById[2] = "CHECKBOX_CHALLENGE"] = 2; - values[valuesById[3] = "INVISIBLE_CHALLENGE"] = 3; - return values; - })(); - - /** - * ChallengeSecurityPreference enum. - * @name google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference - * @enum {number} - * @property {number} CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED=0 CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED value - * @property {number} USABILITY=1 USABILITY value - * @property {number} BALANCED=2 BALANCED 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] = "BALANCED"] = 2; - values[valuesById[3] = "SECURITY"] = 3; - return values; - })(); - - return WebKeySettings; - })(); - - v1beta1.AndroidKeySettings = (function() { - - /** - * Properties of an AndroidKeySettings. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IAndroidKeySettings - * @property {Array.|null} [allowedPackageNames] AndroidKeySettings allowedPackageNames - */ - - /** - * Constructs a new AndroidKeySettings. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents an AndroidKeySettings. - * @implements IAndroidKeySettings - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.AndroidKeySettings - * @instance - */ - AndroidKeySettings.prototype.allowedPackageNames = $util.emptyArray; - - /** - * Creates a new AndroidKeySettings instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings} AndroidKeySettings instance - */ - AndroidKeySettings.create = function create(properties) { - return new AndroidKeySettings(properties); - }; - - /** - * Encodes the specified AndroidKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.AndroidKeySettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.AndroidKeySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.AndroidKeySettings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings} AndroidKeySettings - */ - AndroidKeySettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings(); - if (object.allowedPackageNames) { - if (!Array.isArray(object.allowedPackageNames)) - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.AndroidKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.AndroidKeySettings - * @instance - * @returns {Object.} JSON object - */ - AndroidKeySettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return AndroidKeySettings; - })(); - - v1beta1.IOSKeySettings = (function() { - - /** - * Properties of a IOSKeySettings. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @interface IIOSKeySettings - * @property {Array.|null} [allowedBundleIds] IOSKeySettings allowedBundleIds - */ - - /** - * Constructs a new IOSKeySettings. - * @memberof google.cloud.recaptchaenterprise.v1beta1 - * @classdesc Represents a IOSKeySettings. - * @implements IIOSKeySettings - * @constructor - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IOSKeySettings - * @instance - */ - IOSKeySettings.prototype.allowedBundleIds = $util.emptyArray; - - /** - * Creates a new IOSKeySettings instance using the specified properties. - * @function create - * @memberof google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings=} [properties] Properties to set - * @returns {google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings} IOSKeySettings instance - */ - IOSKeySettings.create = function create(properties) { - return new IOSKeySettings(properties); - }; - - /** - * Encodes the specified IOSKeySettings message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings.verify|verify} messages. - * @function encode - * @memberof google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IOSKeySettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.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.v1beta1.IOSKeySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.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.v1beta1.IOSKeySettings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings} IOSKeySettings - */ - IOSKeySettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings) - return object; - var message = new $root.google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings(); - if (object.allowedBundleIds) { - if (!Array.isArray(object.allowedBundleIds)) - throw TypeError(".google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IOSKeySettings - * @static - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.IOSKeySettings - * @instance - * @returns {Object.} JSON object - */ - IOSKeySettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IOSKeySettings; + return AccountDefenderAssessment; })(); return v1beta1; diff --git a/protos/protos.json b/protos/protos.json index d181a3b..6b0daf1 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -1033,80 +1033,6 @@ "(google.api.method_signature)": "name,annotation" } ] - }, - "CreateKey": { - "requestType": "CreateKeyRequest", - "responseType": "Key", - "options": { - "(google.api.http).post": "/v1beta1/{parent=projects/*}/keys", - "(google.api.http).body": "key" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1beta1/{parent=projects/*}/keys", - "body": "key" - } - } - ] - }, - "ListKeys": { - "requestType": "ListKeysRequest", - "responseType": "ListKeysResponse", - "options": { - "(google.api.http).get": "/v1beta1/{parent=projects/*}/keys" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1beta1/{parent=projects/*}/keys" - } - } - ] - }, - "GetKey": { - "requestType": "GetKeyRequest", - "responseType": "Key", - "options": { - "(google.api.http).get": "/v1beta1/{name=projects/*/keys/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1beta1/{name=projects/*/keys/*}" - } - } - ] - }, - "UpdateKey": { - "requestType": "UpdateKeyRequest", - "responseType": "Key", - "options": { - "(google.api.http).patch": "/v1beta1/{key.name=projects/*/keys/*}", - "(google.api.http).body": "key" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1beta1/{key.name=projects/*/keys/*}", - "body": "key" - } - } - ] - }, - "DeleteKey": { - "requestType": "DeleteKeyRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).delete": "/v1beta1/{name=projects/*/keys/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1beta1/{name=projects/*/keys/*}" - } - } - ] } } }, @@ -1143,7 +1069,22 @@ "type": "Annotation", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "reasons": { + "rule": "repeated", + "type": "Reason", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hashedAccountId": { + "type": "bytes", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" } } }, @@ -1152,7 +1093,23 @@ "values": { "ANNOTATION_UNSPECIFIED": 0, "LEGITIMATE": 1, - "FRAUDULENT": 2 + "FRAUDULENT": 2, + "PASSWORD_CORRECT": 3, + "PASSWORD_INCORRECT": 4 + } + }, + "Reason": { + "values": { + "REASON_UNSPECIFIED": 0, + "CHARGEBACK": 1, + "CHARGEBACK_FRAUD": 8, + "CHARGEBACK_DISPUTE": 9, + "PAYMENT_HEURISTICS": 2, + "INITIATED_TWO_FACTOR": 7, + "PASSED_TWO_FACTOR": 3, + "FAILED_TWO_FACTOR": 4, + "CORRECT_PASSWORD": 5, + "INCORRECT_PASSWORD": 6 } } } @@ -1160,6 +1117,31 @@ "AnnotateAssessmentResponse": { "fields": {} }, + "PasswordLeakVerification": { + "fields": { + "hashedUserCredentials": { + "type": "bytes", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "credentialsLeaked": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "canonicalizedUsername": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, "Assessment": { "options": { "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Assessment", @@ -1198,6 +1180,14 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "passwordLeakVerification": { + "type": "PasswordLeakVerification", + "id": 7 + }, + "accountDefenderAssessment": { + "type": "AccountDefenderAssessment", + "id": 8 } }, "nested": { @@ -1249,6 +1239,13 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "hashedAccountId": { + "type": "bytes", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -1284,211 +1281,31 @@ "EXPIRED": 3, "DUPE": 4, "SITE_MISMATCH": 5, - "MISSING": 6 - } - } - } - }, - "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" + "MISSING": 6, + "BROWSER_ERROR": 7 } } } }, - "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 - } - } - }, - "WebKeySettings": { + "AccountDefenderAssessment": { "fields": { - "enforceAllowedDomains": { - "type": "bool", - "id": 3 - }, - "allowedDomains": { + "labels": { "rule": "repeated", - "type": "string", + "type": "AccountDefenderLabel", "id": 1 - }, - "allowAmpTraffic": { - "type": "bool", - "id": 2 - }, - "integrationType": { - "type": "IntegrationType", - "id": 4, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "challengeSecurityPreference": { - "type": "ChallengeSecurityPreference", - "id": 5 } }, "nested": { - "IntegrationType": { - "values": { - "INTEGRATION_TYPE_UNSPECIFIED": 0, - "SCORE_ONLY": 1, - "CHECKBOX_CHALLENGE": 2, - "INVISIBLE_CHALLENGE": 3 - } - }, - "ChallengeSecurityPreference": { + "AccountDefenderLabel": { "values": { - "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED": 0, - "USABILITY": 1, - "BALANCED": 2, - "SECURITY": 3 + "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED": 0, + "PROFILE_MATCH": 1, + "SUSPICIOUS_LOGIN_ACTIVITY": 2, + "SUSPICIOUS_ACCOUNT_CREATION": 3, + "RELATED_ACCOUNTS_NUMBER_HIGH": 4 } } } - }, - "AndroidKeySettings": { - "fields": { - "allowedPackageNames": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, - "IOSKeySettings": { - "fields": { - "allowedBundleIds": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } } } } diff --git a/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js b/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js index f407558..969aa7f 100644 --- a/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js +++ b/samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.annotate_assessment.js @@ -20,7 +20,7 @@ 'use strict'; -function main(name, annotation) { +function main(name) { // [START recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_AnnotateAssessment_async] /** * TODO(developer): Uncomment these variables before running the sample. @@ -31,9 +31,23 @@ function main(name, annotation) { */ // const name = 'abc123' /** - * Required. The annotation that will be assigned to the Event. + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. */ // const annotation = {} + /** + * Optional. Optional reasons for the annotation that will be assigned to the Event. + */ + // const reasons = 1234 + /** + * Optional. Optional unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in + * CreateAssessment, for example when the account identifier is not yet known + * in the initial request. It is recommended that the identifier is hashed + * using hmac-sha256 with stable secret. + */ + // const hashedAccountId = 'Buffer.from('string')' // Imports the Recaptchaenterprise library const {RecaptchaEnterpriseServiceV1Beta1Client} = require('@google-cloud/recaptcha-enterprise').v1beta1; @@ -45,7 +59,6 @@ function main(name, annotation) { // Construct request const request = { name, - annotation, }; // Run request diff --git a/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json b/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json index 87d0c24..0cb6619 100644 --- a/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json +++ b/samples/generated/v1beta1/snippet_metadata.google.cloud.recaptchaenterprise.v1beta1.json @@ -66,7 +66,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 69, "type": "FULL" } ], @@ -82,232 +82,24 @@ { "name": "annotation", "type": ".google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation" - } - ], - "resultType": ".google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse", - "client": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" - }, - "method": { - "shortName": "AnnotateAssessment", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.AnnotateAssessment", - "service": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" - } - } - } - }, - { - "regionTag": "recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateKey_async", - "title": "RecaptchaEnterpriseServiceV1Beta1 createKey Sample", - "origin": "API_DEFINITION", - "description": " Creates a new reCAPTCHA Enterprise key.", - "canonical": true, - "file": "recaptcha_enterprise_service_v1_beta1.create_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" }, { - "name": "key", - "type": ".google.cloud.recaptchaenterprise.v1beta1.Key" - } - ], - "resultType": ".google.cloud.recaptchaenterprise.v1beta1.Key", - "client": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" - }, - "method": { - "shortName": "CreateKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.CreateKey", - "service": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" - } - } - } - }, - { - "regionTag": "recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_ListKeys_async", - "title": "RecaptchaEnterpriseServiceV1Beta1 listKeys Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all keys that belong to a project.", - "canonical": true, - "file": "recaptcha_enterprise_service_v1_beta1.list_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListKeys", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.ListKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" + "name": "reasons", + "type": "TYPE_ENUM[]" }, { - "name": "page_token", - "type": "TYPE_STRING" + "name": "hashed_account_id", + "type": "TYPE_BYTES" } ], - "resultType": ".google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse", - "client": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" - }, - "method": { - "shortName": "ListKeys", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.ListKeys", - "service": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" - } - } - } - }, - { - "regionTag": "recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_GetKey_async", - "title": "RecaptchaEnterpriseServiceV1Beta1 getKey Sample", - "origin": "API_DEFINITION", - "description": " Returns the specified key.", - "canonical": true, - "file": "recaptcha_enterprise_service_v1_beta1.get_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.GetKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.recaptchaenterprise.v1beta1.Key", - "client": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" - }, - "method": { - "shortName": "GetKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.GetKey", - "service": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" - } - } - } - }, - { - "regionTag": "recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_UpdateKey_async", - "title": "RecaptchaEnterpriseServiceV1Beta1 updateKey Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified key.", - "canonical": true, - "file": "recaptcha_enterprise_service_v1_beta1.update_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.UpdateKey", - "async": true, - "parameters": [ - { - "name": "key", - "type": ".google.cloud.recaptchaenterprise.v1beta1.Key" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.recaptchaenterprise.v1beta1.Key", - "client": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" - }, - "method": { - "shortName": "UpdateKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.UpdateKey", - "service": { - "shortName": "RecaptchaEnterpriseServiceV1Beta1", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" - } - } - } - }, - { - "regionTag": "recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_DeleteKey_async", - "title": "RecaptchaEnterpriseServiceV1Beta1 deleteKey Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified key.", - "canonical": true, - "file": "recaptcha_enterprise_service_v1_beta1.delete_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.DeleteKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", + "resultType": ".google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse", "client": { "shortName": "RecaptchaEnterpriseServiceV1Beta1Client", "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client" }, "method": { - "shortName": "DeleteKey", - "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.DeleteKey", + "shortName": "AnnotateAssessment", + "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1.AnnotateAssessment", "service": { "shortName": "RecaptchaEnterpriseServiceV1Beta1", "fullName": "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1" diff --git a/src/v1beta1/gapic_metadata.json b/src/v1beta1/gapic_metadata.json index 7a2089e..2a7ea77 100644 --- a/src/v1beta1/gapic_metadata.json +++ b/src/v1beta1/gapic_metadata.json @@ -19,33 +19,6 @@ "methods": [ "annotateAssessment" ] - }, - "CreateKey": { - "methods": [ - "createKey" - ] - }, - "GetKey": { - "methods": [ - "getKey" - ] - }, - "UpdateKey": { - "methods": [ - "updateKey" - ] - }, - "DeleteKey": { - "methods": [ - "deleteKey" - ] - }, - "ListKeys": { - "methods": [ - "listKeys", - "listKeysStream", - "listKeysAsync" - ] } } }, @@ -61,33 +34,6 @@ "methods": [ "annotateAssessment" ] - }, - "CreateKey": { - "methods": [ - "createKey" - ] - }, - "GetKey": { - "methods": [ - "getKey" - ] - }, - "UpdateKey": { - "methods": [ - "updateKey" - ] - }, - "DeleteKey": { - "methods": [ - "deleteKey" - ] - }, - "ListKeys": { - "methods": [ - "listKeys", - "listKeysStream", - "listKeysAsync" - ] } } } diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index 972066d..1a2a4a3 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -18,17 +18,8 @@ /* global window */ import * as gax from 'google-gax'; -import { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, -} from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -168,25 +159,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { 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.v1beta1.RecaptchaEnterpriseServiceV1Beta1', @@ -240,11 +217,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { const recaptchaEnterpriseServiceV1Beta1StubMethods = [ 'createAssessment', 'annotateAssessment', - 'createKey', - 'listKeys', - 'getKey', - 'updateKey', - 'deleteKey', ]; for (const methodName of recaptchaEnterpriseServiceV1Beta1StubMethods) { const callPromise = this.recaptchaEnterpriseServiceV1Beta1Stub.then( @@ -261,7 +233,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } ); - const descriptor = this.descriptors.page[methodName] || undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -436,8 +408,18 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * @param {string} request.name * Required. The resource name of the Assessment, in the format * "projects/{project_number}/assessments/{assessment_id}". - * @param {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation} request.annotation - * Required. The annotation that will be assigned to the Event. + * @param {google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest.Annotation} [request.annotation] + * Optional. The annotation that will be assigned to the Event. This field can be left + * empty to provide reasons that apply to an event without concluding whether + * the event is legitimate or fraudulent. + * @param {number[]} [request.reasons] + * Optional. Optional reasons for the annotation that will be assigned to the Event. + * @param {Buffer} [request.hashedAccountId] + * Optional. Optional unique stable hashed user identifier to apply to the assessment. + * This is an alternative to setting the hashed_account_id in + * CreateAssessment, for example when the account identifier is not yet known + * in the initial request. It is recommended that the identifier is hashed + * using hmac-sha256 with stable secret. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -528,601 +510,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { this.initialize(); return this.innerApiCalls.annotateAssessment(request, options, callback); } - /** - * Creates a new reCAPTCHA Enterprise key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project in which the key will be created, in the - * format "projects/{project_number}". - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.create_key.js - * region_tag:recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_CreateKey_async - */ - createKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest - | undefined - ), - {} | undefined - ] - >; - createKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - createKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createKey(request, options, callback); - } - /** - * Returns the specified key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the requested key, in the format - * "projects/{project_number}/keys/{key_id}". - * @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.v1beta1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.get_key.js - * region_tag:recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_GetKey_async - */ - getKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest - | undefined - ), - {} | undefined - ] - >; - getKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - getKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getKey(request, options, callback); - } - /** - * Updates the specified key. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.recaptchaenterprise.v1beta1.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.v1beta1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.update_key.js - * region_tag:recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_UpdateKey_async - */ - updateKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest - | undefined - ), - {} | undefined - ] - >; - updateKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, - callback: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - 'key.name': request.key!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateKey(request, options, callback); - } - /** - * Deletes the specified key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the key to be deleted, in the format - * "projects/{project_number}/keys/{key_id}". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.delete_key.js - * region_tag:recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_DeleteKey_async - */ - deleteKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, - options?: CallOptions - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest - | undefined - ), - {} | undefined - ] - >; - deleteKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteKey( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest - | null - | undefined, - {} | null | undefined - > - ): void; - deleteKey( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest - | undefined - ), - {} | undefined - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - name: request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteKey(request, options, callback); - } - - /** - * 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_number}". - * @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.v1beta1.Key}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listKeys( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey[], - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest | null, - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse - ] - >; - listKeys( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - | protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse - | null - | undefined, - protos.google.cloud.recaptchaenterprise.v1beta1.IKey - > - ): void; - listKeys( - request: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - callback: PaginationCallback< - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - | protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse - | null - | undefined, - protos.google.cloud.recaptchaenterprise.v1beta1.IKey - > - ): void; - listKeys( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - | protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse - | null - | undefined, - protos.google.cloud.recaptchaenterprise.v1beta1.IKey - >, - callback?: PaginationCallback< - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - | protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse - | null - | undefined, - protos.google.cloud.recaptchaenterprise.v1beta1.IKey - > - ): Promise< - [ - protos.google.cloud.recaptchaenterprise.v1beta1.IKey[], - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest | null, - protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listKeys(request, options, callback); - } - /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project that contains the keys that will be - * listed, in the format "projects/{project_number}". - * @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.v1beta1.Key} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listKeysStream( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options?: CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - const defaultCallSettings = this._defaults['listKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKeys.createStream( - this.innerApiCalls.listKeys as gax.GaxCall, - request, - callSettings - ); - } - - /** - * Equivalent to `listKeys`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project that contains the keys that will be - * listed, in the format "projects/{project_number}". - * @param {number} [request.pageSize] - * Optional. The maximum number of keys to return. Default is 10. Max limit is - * 1000. - * @param {string} [request.pageToken] - * Optional. The next_page_token value returned from a previous. - * ListKeysRequest, if any. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1beta1/recaptcha_enterprise_service_v1_beta1.list_keys.js - * region_tag:recaptchaenterprise_v1beta1_generated_RecaptchaEnterpriseServiceV1Beta1_ListKeys_async - */ - listKeysAsync( - request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options?: CallOptions - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - const defaultCallSettings = this._defaults['listKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKeys.asyncIterate( - this.innerApiCalls['listKeys'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } // -------------------- // -- Path templates -- // -------------------- @@ -1165,42 +553,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { .assessment; } - /** - * Return a fully-qualified key resource name string. - * - * @param {string} project - * @param {string} key - * @returns {string} Resource name string. - */ - keyPath(project: string, key: string) { - return this.pathTemplates.keyPathTemplate.render({ - project: project, - key: key, - }); - } - - /** - * Parse the project from Key resource. - * - * @param {string} keyName - * A fully-qualified path representing Key resource. - * @returns {string} A string representing the project. - */ - matchProjectFromKeyName(keyName: string) { - return this.pathTemplates.keyPathTemplate.match(keyName).project; - } - - /** - * Parse the key from Key resource. - * - * @param {string} keyName - * A fully-qualified path representing Key resource. - * @returns {string} A string representing the key. - */ - matchKeyFromKeyName(keyName: string) { - return this.pathTemplates.keyPathTemplate.match(keyName).key; - } - /** * Return a fully-qualified project resource name string. * diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json index 726aae1..7907ebe 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json @@ -29,31 +29,6 @@ "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/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts b/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts index 841d577..0e49aad 100644 --- a/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts +++ b/test/gapic_recaptcha_enterprise_service_v1_beta1_v1beta1.ts @@ -23,8 +23,6 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as recaptchaenterpriseservicev1beta1Module from '../src'; -import {PassThrough} from 'stream'; - import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { @@ -51,67 +49,6 @@ function stubSimpleCallWithCallback( : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); - } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - describe('v1beta1.RecaptchaEnterpriseServiceV1Beta1Client', () => { it('has servicePath', () => { const servicePath = @@ -510,143 +447,13 @@ describe('v1beta1.RecaptchaEnterpriseServiceV1Beta1Client', () => { }); }); - describe('createKey', () => { - it('invokes createKey without error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ); - client.innerApiCalls.createKey = stubSimpleCall(expectedResponse); - const [response] = await client.createKey(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes createKey without error using callback', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ); - client.innerApiCalls.createKey = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createKey( - request, - ( - err?: Error | null, - result?: protos.google.cloud.recaptchaenterprise.v1beta1.IKey | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes createKey with error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, + describe('Path templates', () => { + describe('assessment', () => { + const fakePath = '/rendered/path/assessment'; + const expectedParameters = { + project: 'projectValue', + assessment: 'assessmentValue', }; - const expectedError = new Error('expected'); - client.innerApiCalls.createKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKey(request), expectedError); - assert( - (client.innerApiCalls.createKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes createKey with closed client', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest() - ); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createKey(request), expectedError); - }); - }); - - describe('getKey', () => { - it('invokes getKey without error', async () => { const client = new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( { @@ -655,773 +462,32 @@ describe('v1beta1.RecaptchaEnterpriseServiceV1Beta1Client', () => { } ); client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ); - client.innerApiCalls.getKey = stubSimpleCall(expectedResponse); - const [response] = await client.getKey(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + client.pathTemplates.assessmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assessmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('invokes getKey without error using callback', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ); - client.innerApiCalls.getKey = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getKey( - request, - ( - err?: Error | null, - result?: protos.google.cloud.recaptchaenterprise.v1beta1.IKey | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } + it('assessmentPath', () => { + const result = client.assessmentPath('projectValue', 'assessmentValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assessmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) ); }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - it('invokes getKey with error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } + it('matchProjectFromAssessmentName', () => { + const result = client.matchProjectFromAssessmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.assessmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKey(request), expectedError); - assert( - (client.innerApiCalls.getKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes getKey with closed client', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getKey(request), expectedError); - }); - }); - - describe('updateKey', () => { - it('invokes updateKey without error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest() - ); - request.key = {}; - request.key.name = ''; - const expectedHeaderRequestParams = 'key.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ); - client.innerApiCalls.updateKey = stubSimpleCall(expectedResponse); - const [response] = await client.updateKey(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateKey without error using callback', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest() - ); - request.key = {}; - request.key.name = ''; - const expectedHeaderRequestParams = 'key.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ); - client.innerApiCalls.updateKey = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateKey( - request, - ( - err?: Error | null, - result?: protos.google.cloud.recaptchaenterprise.v1beta1.IKey | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes updateKey with error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest() - ); - request.key = {}; - request.key.name = ''; - const expectedHeaderRequestParams = 'key.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateKey(request), expectedError); - assert( - (client.innerApiCalls.updateKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes updateKey with closed client', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest() - ); - request.key = {}; - request.key.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateKey(request), expectedError); - }); - }); - - describe('deleteKey', () => { - it('invokes deleteKey without error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteKey = stubSimpleCall(expectedResponse); - const [response] = await client.deleteKey(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes deleteKey without error using callback', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteKey = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteKey( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes deleteKey with error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteKey(request), expectedError); - assert( - (client.innerApiCalls.deleteKey as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes deleteKey with closed client', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest() - ); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteKey(request), expectedError); - }); - }); - - describe('listKeys', () => { - it('invokes listKeys without error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - ]; - client.innerApiCalls.listKeys = stubSimpleCall(expectedResponse); - const [response] = await client.listKeys(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listKeys as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listKeys without error using callback', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - ]; - client.innerApiCalls.listKeys = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listKeys( - request, - ( - err?: Error | null, - result?: - | protos.google.cloud.recaptchaenterprise.v1beta1.IKey[] - | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listKeys as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); - - it('invokes listKeys with error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKeys(request), expectedError); - assert( - (client.innerApiCalls.listKeys as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - - it('invokes listKeysStream without error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - ]; - client.descriptors.page.listKeys.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.recaptchaenterprise.v1beta1.Key[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.recaptchaenterprise.v1beta1.Key) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listKeys.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listKeys, request) - ); - assert.strictEqual( - (client.descriptors.page.listKeys.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listKeysStream with error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listKeys.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.recaptchaenterprise.v1beta1.Key[] = - []; - stream.on( - 'data', - (response: protos.google.cloud.recaptchaenterprise.v1beta1.Key) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listKeys.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listKeys, request) - ); - assert.strictEqual( - (client.descriptors.page.listKeys.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listKeys without error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.Key() - ), - ]; - client.descriptors.page.listKeys.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.recaptchaenterprise.v1beta1.IKey[] = - []; - const iterable = client.listKeysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listKeys.asyncIterate as SinonStub).getCall(0) - .args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listKeys.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listKeys with error', async () => { - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listKeys.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listKeysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.recaptchaenterprise.v1beta1.IKey[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listKeys.asyncIterate as SinonStub).getCall(0) - .args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listKeys.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - describe('assessment', () => { - const fakePath = '/rendered/path/assessment'; - const expectedParameters = { - project: 'projectValue', - assessment: 'assessmentValue', - }; - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - client.pathTemplates.assessmentPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.assessmentPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('assessmentPath', () => { - const result = client.assessmentPath('projectValue', 'assessmentValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.assessmentPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromAssessmentName', () => { - const result = client.matchProjectFromAssessmentName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.assessmentPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + }); it('matchAssessmentFromAssessmentName', () => { const result = client.matchAssessmentFromAssessmentName(fakePath); @@ -1434,58 +500,6 @@ describe('v1beta1.RecaptchaEnterpriseServiceV1Beta1Client', () => { }); }); - describe('key', () => { - const fakePath = '/rendered/path/key'; - const expectedParameters = { - project: 'projectValue', - key: 'keyValue', - }; - const client = - new recaptchaenterpriseservicev1beta1Module.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - client.pathTemplates.keyPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.keyPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('keyPath', () => { - const result = client.keyPath('projectValue', 'keyValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.keyPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchProjectFromKeyName', () => { - const result = client.matchProjectFromKeyName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.keyPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchKeyFromKeyName', () => { - const result = client.matchKeyFromKeyName(fakePath); - assert.strictEqual(result, 'keyValue'); - assert( - (client.pathTemplates.keyPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); - describe('project', () => { const fakePath = '/rendered/path/project'; const expectedParameters = {