From c3938ca05e61d233884f42864c7c33807d9573b0 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 3 Dec 2019 04:19:56 -0800 Subject: [PATCH] [CHANGE ME] Re-generated to pick up changes in the API or client library generator. --- .../v1beta1/recaptchaenterprise.proto | 240 +- protos/protos.d.ts | 1581 ++++++++- protos/protos.js | 2996 ++++++++++++++++- protos/protos.json | 275 +- .../v1beta1/doc_recaptchaenterprise.js | 294 +- src/v1beta1/doc/google/protobuf/doc_empty.js | 34 + .../doc/google/protobuf/doc_field_mask.js | 228 ++ ...tcha_enterprise_service_v1_beta1_client.js | 443 ++- ...rprise_service_v1_beta1_client_config.json | 25 + synth.metadata | 6 +- test/gapic-v1beta1.js | 318 ++ 11 files changed, 6274 insertions(+), 166 deletions(-) create mode 100644 src/v1beta1/doc/google/protobuf/doc_empty.js create mode 100644 src/v1beta1/doc/google/protobuf/doc_field_mask.js diff --git a/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto b/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto index c2025d4..12e99b4 100644 --- a/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto +++ b/protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto @@ -21,6 +21,8 @@ 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"; @@ -54,6 +56,43 @@ 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. @@ -154,13 +193,25 @@ message Assessment { } message Event { - // Required. The user response token provided by the reCAPTCHA client-side integration + // Optional. The user response token provided by the reCAPTCHA client-side integration // on your site. - string token = 1 [(google.api.field_behavior) = REQUIRED]; + string token = 1 [(google.api.field_behavior) = OPTIONAL]; - // Required. The site key that was used to invoke reCAPTCHA on your site and generate + // Optional. The site key that was used to invoke reCAPTCHA on your site and generate // the token. - string site_key = 2 [(google.api.field_behavior) = REQUIRED]; + string site_key = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The user agent present in the request from the user's device related to + // this event. + string user_agent = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The IP address in the request from the user's device related to this event. + string user_ip_address = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The expected action for this type of event. This should be the same action + // provided at token generation time on client-side platforms already + // integrated with recaptcha enterprise. + string expected_action = 5 [(google.api.field_behavior) = OPTIONAL]; } message TokenProperties { @@ -207,3 +258,184 @@ message TokenProperties { // Action name provided at token generation. string action = 5; } + +// The create key request message. +message CreateKeyRequest { + // Required. The name of the project in which the key will be created, in the + // format "projects/{project_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; + } + + // Enum that represents the possible challenge frequency and difficulty + // configurations for a web key. + enum ChallengeSecurityPreference { + // Default type that indicates this enum hasn't been specified. + CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0; + + // Key tends to show fewer and easier challenges. + USABILITY = 1; + + // Key tends to show balanced (in amount and difficulty) challenges. + BALANCED = 2; + + // Key tends to show more and harder challenges. + SECURITY = 3; + } + + // 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; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 8f730e1..e8983bc 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -73,6 +73,76 @@ 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 { @@ -90,6 +160,41 @@ 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. */ @@ -422,312 +527,1330 @@ export namespace google { public reasons: google.cloud.recaptchaenterprise.v1beta1.Assessment.ClassificationReason[]; /** - * Creates a new Assessment instance using the specified properties. + * Creates a new Assessment instance using the specified properties. + * @param [properties] Properties to set + * @returns Assessment instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAssessment): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. + * @param message Assessment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Assessment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Decodes an Assessment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Assessment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Verifies an Assessment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Assessment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Assessment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.Assessment; + + /** + * Creates a plain object from an Assessment message. Also converts values to other types if specified. + * @param message Assessment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.Assessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Assessment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Assessment { + + /** ClassificationReason enum. */ + enum ClassificationReason { + CLASSIFICATION_REASON_UNSPECIFIED = 0, + AUTOMATION = 1, + UNEXPECTED_ENVIRONMENT = 2, + TOO_MUCH_TRAFFIC = 3, + UNEXPECTED_USAGE_PATTERNS = 4, + LOW_CONFIDENCE_SCORE = 5 + } + } + + /** Properties of an Event. */ + interface IEvent { + + /** Event token */ + token?: (string|null); + + /** Event siteKey */ + siteKey?: (string|null); + + /** Event userAgent */ + userAgent?: (string|null); + + /** Event userIpAddress */ + userIpAddress?: (string|null); + + /** Event expectedAction */ + expectedAction?: (string|null); + } + + /** Represents an Event. */ + class Event implements IEvent { + + /** + * Constructs a new Event. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IEvent); + + /** Event token. */ + public token: string; + + /** Event siteKey. */ + public siteKey: string; + + /** Event userAgent. */ + public userAgent: string; + + /** Event userIpAddress. */ + public userIpAddress: string; + + /** Event expectedAction. */ + public expectedAction: string; + + /** + * Creates a new Event instance using the specified properties. + * @param [properties] Properties to set + * @returns Event instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IEvent): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. + * @param message Event message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Event message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Verifies an Event message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Event + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.Event; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @param message Event + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.Event, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Event to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TokenProperties. */ + interface ITokenProperties { + + /** TokenProperties valid */ + valid?: (boolean|null); + + /** TokenProperties invalidReason */ + invalidReason?: (google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason|null); + + /** TokenProperties createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname */ + hostname?: (string|null); + + /** TokenProperties action */ + action?: (string|null); + } + + /** Represents a TokenProperties. */ + class TokenProperties implements ITokenProperties { + + /** + * Constructs a new TokenProperties. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties); + + /** TokenProperties valid. */ + public valid: boolean; + + /** TokenProperties invalidReason. */ + public invalidReason: google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason; + + /** TokenProperties createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** TokenProperties hostname. */ + public hostname: string; + + /** TokenProperties action. */ + public action: string; + + /** + * Creates a new TokenProperties instance using the specified properties. + * @param [properties] Properties to set + * @returns TokenProperties instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. + * @param message TokenProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TokenProperties message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TokenProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Verifies a TokenProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TokenProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TokenProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + + /** + * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. + * @param message TokenProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.TokenProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TokenProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TokenProperties { + + /** InvalidReason enum. */ + enum InvalidReason { + INVALID_REASON_UNSPECIFIED = 0, + UNKNOWN_INVALID_REASON = 1, + MALFORMED = 2, + EXPIRED = 3, + DUPE = 4, + SITE_MISMATCH = 5, + MISSING = 6 + } + } + + /** Properties of a CreateKeyRequest. */ + interface ICreateKeyRequest { + + /** CreateKeyRequest parent */ + parent?: (string|null); + + /** CreateKeyRequest key */ + key?: (google.cloud.recaptchaenterprise.v1beta1.IKey|null); + } + + /** Represents a CreateKeyRequest. */ + class CreateKeyRequest implements ICreateKeyRequest { + + /** + * Constructs a new CreateKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest); + + /** CreateKeyRequest parent. */ + public parent: string; + + /** CreateKeyRequest key. */ + public key?: (google.cloud.recaptchaenterprise.v1beta1.IKey|null); + + /** + * Creates a new CreateKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateKeyRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + + /** + * 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 + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, 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 + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + + /** + * Verifies a CreateKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest; + + /** + * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. + * @param message CreateKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListKeysRequest. */ + interface IListKeysRequest { + + /** ListKeysRequest parent */ + parent?: (string|null); + + /** ListKeysRequest pageSize */ + pageSize?: (number|null); + + /** ListKeysRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListKeysRequest. */ + class ListKeysRequest implements IListKeysRequest { + + /** + * Constructs a new ListKeysRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest); + + /** ListKeysRequest parent. */ + public parent: string; + + /** ListKeysRequest pageSize. */ + public pageSize: number; + + /** ListKeysRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListKeysRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKeysRequest instance + */ + public static create(properties?: google.cloud.recaptchaenterprise.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|null); + + /** WebKeySettings challengeSecurityPreference */ + challengeSecurityPreference?: (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; + + /** WebKeySettings challengeSecurityPreference. */ + public challengeSecurityPreference: google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference; + + /** + * Creates a new WebKeySettings instance using the specified properties. * @param [properties] Properties to set - * @returns Assessment instance + * @returns WebKeySettings instance */ - public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAssessment): google.cloud.recaptchaenterprise.v1beta1.Assessment; + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings): google.cloud.recaptchaenterprise.v1beta1.WebKeySettings; /** - * Encodes the specified Assessment message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. - * @param message Assessment message or plain object to encode + * 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.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Assessment message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Assessment.verify|verify} messages. - * @param message Assessment message or plain object to encode + * 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.IAssessment, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IWebKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Assessment message from the specified reader or buffer. + * 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 Assessment + * @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.Assessment; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.WebKeySettings; /** - * Decodes an Assessment message from the specified reader or buffer, length delimited. + * Decodes a WebKeySettings message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Assessment + * @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.Assessment; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.WebKeySettings; /** - * Verifies an Assessment message. + * 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 an Assessment message from a plain object. Also converts values to their respective internal types. + * Creates a WebKeySettings message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Assessment + * @returns WebKeySettings */ - public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.Assessment; + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.WebKeySettings; /** - * Creates a plain object from an Assessment message. Also converts values to other types if specified. - * @param message Assessment + * 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.Assessment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.WebKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Assessment to JSON. + * Converts this WebKeySettings to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Assessment { + namespace WebKeySettings { - /** ClassificationReason enum. */ - enum ClassificationReason { - CLASSIFICATION_REASON_UNSPECIFIED = 0, - AUTOMATION = 1, - UNEXPECTED_ENVIRONMENT = 2, - TOO_MUCH_TRAFFIC = 3, - UNEXPECTED_USAGE_PATTERNS = 4, - LOW_CONFIDENCE_SCORE = 5 + /** IntegrationType enum. */ + enum IntegrationType { + INTEGRATION_TYPE_UNSPECIFIED = 0, + SCORE_ONLY = 1, + CHECKBOX_CHALLENGE = 2, + INVISIBLE_CHALLENGE = 3 } - } - /** Properties of an Event. */ - interface IEvent { + /** ChallengeSecurityPreference enum. */ + enum ChallengeSecurityPreference { + CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0, + USABILITY = 1, + BALANCED = 2, + SECURITY = 3 + } + } - /** Event token */ - token?: (string|null); + /** Properties of an AndroidKeySettings. */ + interface IAndroidKeySettings { - /** Event siteKey */ - siteKey?: (string|null); + /** AndroidKeySettings allowedPackageNames */ + allowedPackageNames?: (string[]|null); } - /** Represents an Event. */ - class Event implements IEvent { + /** Represents an AndroidKeySettings. */ + class AndroidKeySettings implements IAndroidKeySettings { /** - * Constructs a new Event. + * Constructs a new AndroidKeySettings. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IEvent); - - /** Event token. */ - public token: string; + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings); - /** Event siteKey. */ - public siteKey: string; + /** AndroidKeySettings allowedPackageNames. */ + public allowedPackageNames: string[]; /** - * Creates a new Event instance using the specified properties. + * Creates a new AndroidKeySettings instance using the specified properties. * @param [properties] Properties to set - * @returns Event instance + * @returns AndroidKeySettings instance */ - public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IEvent): google.cloud.recaptchaenterprise.v1beta1.Event; + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings): google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings; /** - * Encodes the specified Event message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. - * @param message Event message or plain object to encode + * 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.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Event message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.Event.verify|verify} messages. - * @param message Event message or plain object to encode + * 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.IEvent, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IAndroidKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Event message from the specified reader or buffer. + * 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 Event + * @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.Event; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings; /** - * Decodes an Event message from the specified reader or buffer, length delimited. + * Decodes an AndroidKeySettings message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Event + * @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.Event; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings; /** - * Verifies an Event message. + * 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 Event message from a plain object. Also converts values to their respective internal types. + * Creates an AndroidKeySettings message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Event + * @returns AndroidKeySettings */ - public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.Event; + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings; /** - * Creates a plain object from an Event message. Also converts values to other types if specified. - * @param message Event + * 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.Event, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Event to JSON. + * Converts this AndroidKeySettings to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a TokenProperties. */ - interface ITokenProperties { - - /** TokenProperties valid */ - valid?: (boolean|null); - - /** TokenProperties invalidReason */ - invalidReason?: (google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason|null); - - /** TokenProperties createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** TokenProperties hostname */ - hostname?: (string|null); + /** Properties of a IOSKeySettings. */ + interface IIOSKeySettings { - /** TokenProperties action */ - action?: (string|null); + /** IOSKeySettings allowedBundleIds */ + allowedBundleIds?: (string[]|null); } - /** Represents a TokenProperties. */ - class TokenProperties implements ITokenProperties { + /** Represents a IOSKeySettings. */ + class IOSKeySettings implements IIOSKeySettings { /** - * Constructs a new TokenProperties. + * Constructs a new IOSKeySettings. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties); - - /** TokenProperties valid. */ - public valid: boolean; + constructor(properties?: google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings); - /** TokenProperties invalidReason. */ - public invalidReason: google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason; - - /** TokenProperties createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** TokenProperties hostname. */ - public hostname: string; - - /** TokenProperties action. */ - public action: string; + /** IOSKeySettings allowedBundleIds. */ + public allowedBundleIds: string[]; /** - * Creates a new TokenProperties instance using the specified properties. + * Creates a new IOSKeySettings instance using the specified properties. * @param [properties] Properties to set - * @returns TokenProperties instance + * @returns IOSKeySettings instance */ - public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.ITokenProperties): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + public static create(properties?: google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings): google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings; /** - * Encodes the specified TokenProperties message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. - * @param message TokenProperties message or plain object to encode + * 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.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified TokenProperties message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.TokenProperties.verify|verify} messages. - * @param message TokenProperties message or plain object to encode + * 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.ITokenProperties, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.recaptchaenterprise.v1beta1.IIOSKeySettings, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a TokenProperties message from the specified reader or buffer. + * 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 TokenProperties + * @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.TokenProperties; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings; /** - * Decodes a TokenProperties message from the specified reader or buffer, length delimited. + * Decodes a IOSKeySettings message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns TokenProperties + * @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.TokenProperties; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings; /** - * Verifies a TokenProperties message. + * 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 TokenProperties message from a plain object. Also converts values to their respective internal types. + * Creates a IOSKeySettings message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns TokenProperties + * @returns IOSKeySettings */ - public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.TokenProperties; + public static fromObject(object: { [k: string]: any }): google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings; /** - * Creates a plain object from a TokenProperties message. Also converts values to other types if specified. - * @param message TokenProperties + * 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.TokenProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this TokenProperties to JSON. + * Converts this IOSKeySettings to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - - namespace TokenProperties { - - /** InvalidReason enum. */ - enum InvalidReason { - INVALID_REASON_UNSPECIFIED = 0, - UNKNOWN_INVALID_REASON = 1, - MALFORMED = 2, - EXPIRED = 3, - DUPE = 4, - SITE_MISMATCH = 5, - MISSING = 6 - } - } } } } @@ -4434,6 +5557,180 @@ export namespace google { } } + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Timestamp. */ interface ITimestamp { diff --git a/protos/protos.js b/protos/protos.js index 94e9f43..460d897 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -164,6 +164,171 @@ * @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; })(); @@ -1162,6 +1327,9 @@ * @interface IEvent * @property {string|null} [token] Event token * @property {string|null} [siteKey] Event siteKey + * @property {string|null} [userAgent] Event userAgent + * @property {string|null} [userIpAddress] Event userIpAddress + * @property {string|null} [expectedAction] Event expectedAction */ /** @@ -1195,6 +1363,30 @@ */ Event.prototype.siteKey = ""; + /** + * Event userAgent. + * @member {string} userAgent + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.userAgent = ""; + + /** + * Event userIpAddress. + * @member {string} userIpAddress + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.userIpAddress = ""; + + /** + * Event expectedAction. + * @member {string} expectedAction + * @memberof google.cloud.recaptchaenterprise.v1beta1.Event + * @instance + */ + Event.prototype.expectedAction = ""; + /** * Creates a new Event instance using the specified properties. * @function create @@ -1223,6 +1415,12 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.token); if (message.siteKey != null && message.hasOwnProperty("siteKey")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.siteKey); + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.userAgent); + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.userIpAddress); + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.expectedAction); return writer; }; @@ -1263,6 +1461,15 @@ case 2: message.siteKey = reader.string(); break; + case 3: + message.userAgent = reader.string(); + break; + case 4: + message.userIpAddress = reader.string(); + break; + case 5: + message.expectedAction = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -1304,6 +1511,15 @@ if (message.siteKey != null && message.hasOwnProperty("siteKey")) if (!$util.isString(message.siteKey)) return "siteKey: string expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + if (!$util.isString(message.userIpAddress)) + return "userIpAddress: string expected"; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + if (!$util.isString(message.expectedAction)) + return "expectedAction: string expected"; return null; }; @@ -1323,6 +1539,12 @@ message.token = String(object.token); if (object.siteKey != null) message.siteKey = String(object.siteKey); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.userIpAddress != null) + message.userIpAddress = String(object.userIpAddress); + if (object.expectedAction != null) + message.expectedAction = String(object.expectedAction); return message; }; @@ -1342,11 +1564,20 @@ if (options.defaults) { object.token = ""; object.siteKey = ""; + object.userAgent = ""; + object.userIpAddress = ""; + object.expectedAction = ""; } if (message.token != null && message.hasOwnProperty("token")) object.token = message.token; if (message.siteKey != null && message.hasOwnProperty("siteKey")) object.siteKey = message.siteKey; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.userIpAddress != null && message.hasOwnProperty("userIpAddress")) + object.userIpAddress = message.userIpAddress; + if (message.expectedAction != null && message.hasOwnProperty("expectedAction")) + object.expectedAction = message.expectedAction; return object; }; @@ -1692,19 +1923,2397 @@ * @property {number} SITE_MISMATCH=5 SITE_MISMATCH value * @property {number} MISSING=6 MISSING value */ - TokenProperties.InvalidReason = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "INVALID_REASON_UNSPECIFIED"] = 0; - values[valuesById[1] = "UNKNOWN_INVALID_REASON"] = 1; - values[valuesById[2] = "MALFORMED"] = 2; - values[valuesById[3] = "EXPIRED"] = 3; - values[valuesById[4] = "DUPE"] = 4; - values[valuesById[5] = "SITE_MISMATCH"] = 5; - values[valuesById[6] = "MISSING"] = 6; - return values; - })(); + TokenProperties.InvalidReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INVALID_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "UNKNOWN_INVALID_REASON"] = 1; + values[valuesById[2] = "MALFORMED"] = 2; + values[valuesById[3] = "EXPIRED"] = 3; + values[valuesById[4] = "DUPE"] = 4; + values[valuesById[5] = "SITE_MISMATCH"] = 5; + values[valuesById[6] = "MISSING"] = 6; + return values; + })(); + + return TokenProperties; + })(); + + v1beta1.CreateKeyRequest = (function() { + + /** + * Properties of a CreateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @interface ICreateKeyRequest + * @property {string|null} [parent] CreateKeyRequest parent + * @property {google.cloud.recaptchaenterprise.v1beta1.IKey|null} [key] CreateKeyRequest key + */ + + /** + * Constructs a new CreateKeyRequest. + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @classdesc Represents a CreateKeyRequest. + * @implements ICreateKeyRequest + * @constructor + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest=} [properties] Properties to set + */ + function CreateKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateKeyRequest parent. + * @member {string} parent + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @instance + */ + CreateKeyRequest.prototype.parent = ""; + + /** + * CreateKeyRequest key. + * @member {google.cloud.recaptchaenterprise.v1beta1.IKey|null|undefined} key + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @instance + */ + CreateKeyRequest.prototype.key = null; + + /** + * Creates a new CreateKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest=} [properties] Properties to set + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest instance + */ + CreateKeyRequest.create = function create(properties) { + return new CreateKeyRequest(properties); + }; + + /** + * Encodes the specified CreateKeyRequest message. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.key != null && message.hasOwnProperty("key")) + $root.google.cloud.recaptchaenterprise.v1beta1.Key.encode(message.key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest} message CreateKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.key = $root.google.cloud.recaptchaenterprise.v1beta1.Key.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateKeyRequest message. + * @function verify + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.google.cloud.recaptchaenterprise.v1beta1.Key.verify(message.key); + if (error) + return "key." + error; + } + return null; + }; + + /** + * Creates a CreateKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} CreateKeyRequest + */ + CreateKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest) + 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); + } + return message; + }; + + /** + * Creates a plain object from a CreateKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @static + * @param {google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest} message CreateKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.key = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.google.cloud.recaptchaenterprise.v1beta1.Key.toObject(message.key, options); + return object; + }; + + /** + * Converts this CreateKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest + * @instance + * @returns {Object.} JSON object + */ + CreateKeyRequest.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 && message.hasOwnProperty("parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListKeysRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.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 + */ + ListKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeysRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.recaptchaenterprise.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 && message.hasOwnProperty("nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListKeysResponse message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.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 && message.hasOwnProperty("key")) + $root.google.cloud.recaptchaenterprise.v1beta1.Key.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteKeyRequest message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && message.hasOwnProperty("displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.webSettings != null && message.hasOwnProperty("webSettings")) + $root.google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.encode(message.webSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.androidSettings != null && message.hasOwnProperty("androidSettings")) + $root.google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings.encode(message.androidSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.iosSettings != null && message.hasOwnProperty("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 && message.hasOwnProperty("allowAmpTraffic")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAmpTraffic); + if (message.enforceAllowedDomains != null && message.hasOwnProperty("enforceAllowedDomains")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enforceAllowedDomains); + if (message.integrationType != null && message.hasOwnProperty("integrationType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.integrationType); + if (message.challengeSecurityPreference != null && message.hasOwnProperty("challengeSecurityPreference")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.challengeSecurityPreference); + return writer; + }; + + /** + * Encodes the specified WebKeySettings message, length delimited. Does not implicitly {@link google.cloud.recaptchaenterprise.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 {string} + * @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 {string} + * @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 TokenProperties; + return IOSKeySettings; })(); return v1beta1; @@ -11875,6 +14484,369 @@ return GeneratedCodeInfo; })(); + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FieldMask; + })(); + protobuf.Timestamp = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index 6bc37b9..f71a34b 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -40,6 +40,43 @@ "(google.api.http).body": "*", "(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" + } + }, + "ListKeys": { + "requestType": "ListKeysRequest", + "responseType": "ListKeysResponse", + "options": { + "(google.api.http).get": "/v1beta1/{parent=projects/*}/keys" + } + }, + "GetKey": { + "requestType": "GetKeyRequest", + "responseType": "Key", + "options": { + "(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" + } + }, + "DeleteKey": { + "requestType": "DeleteKeyRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1beta1/{name=projects/*/keys/*}" + } } } }, @@ -152,14 +189,35 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } }, "siteKey": { "type": "string", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userAgent": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userIpAddress": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "expectedAction": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" } } } @@ -200,6 +258,207 @@ } } } + }, + "CreateKeyRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "key": { + "type": "Key", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListKeysRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListKeysResponse": { + "fields": { + "keys": { + "rule": "repeated", + "type": "Key", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "UpdateKeyRequest": { + "fields": { + "key": { + "type": "Key", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "recaptchaenterprise.googleapis.com/Key" + } + } + } + }, + "Key": { + "options": { + "(google.api.resource).type": "recaptchaenterprise.googleapis.com/Key", + "(google.api.resource).pattern": "projects/{project}/keys/{key}" + }, + "oneofs": { + "platformSettings": { + "oneof": [ + "webSettings", + "androidSettings", + "iosSettings" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "webSettings": { + "type": "WebKeySettings", + "id": 3 + }, + "androidSettings": { + "type": "AndroidKeySettings", + "id": 4 + }, + "iosSettings": { + "type": "IOSKeySettings", + "id": 5 + } + } + }, + "WebKeySettings": { + "fields": { + "enforceAllowedDomains": { + "type": "bool", + "id": 3 + }, + "allowedDomains": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "allowAmpTraffic": { + "type": "bool", + "id": 2 + }, + "integrationType": { + "type": "IntegrationType", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "challengeSecurityPreference": { + "type": "ChallengeSecurityPreference", + "id": 5 + } + }, + "nested": { + "IntegrationType": { + "values": { + "INTEGRATION_TYPE_UNSPECIFIED": 0, + "SCORE_ONLY": 1, + "CHECKBOX_CHALLENGE": 2, + "INVISIBLE_CHALLENGE": 3 + } + }, + "ChallengeSecurityPreference": { + "values": { + "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED": 0, + "USABILITY": 1, + "BALANCED": 2, + "SECURITY": 3 + } + } + } + }, + "AndroidKeySettings": { + "fields": { + "allowedPackageNames": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "IOSKeySettings": { + "fields": { + "allowedBundleIds": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } } } } @@ -1295,6 +1554,18 @@ } } }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, "Timestamp": { "fields": { "seconds": { diff --git a/src/v1beta1/doc/google/cloud/recaptchaenterprise/v1beta1/doc_recaptchaenterprise.js b/src/v1beta1/doc/google/cloud/recaptchaenterprise/v1beta1/doc_recaptchaenterprise.js index 3da58d9..d91ccbb 100644 --- a/src/v1beta1/doc/google/cloud/recaptchaenterprise/v1beta1/doc_recaptchaenterprise.js +++ b/src/v1beta1/doc/google/cloud/recaptchaenterprise/v1beta1/doc_recaptchaenterprise.js @@ -168,13 +168,25 @@ const Assessment = { /** * @property {string} token - * Required. The user response token provided by the reCAPTCHA client-side integration + * Optional. The user response token provided by the reCAPTCHA client-side integration * on your site. * * @property {string} siteKey - * Required. The site key that was used to invoke reCAPTCHA on your site and generate + * Optional. The site key that was used to invoke reCAPTCHA on your site and generate * the token. * + * @property {string} userAgent + * Optional. The user agent present in the request from the user's device related to + * this event. + * + * @property {string} userIpAddress + * Optional. The IP address in the request from the user's device related to this event. + * + * @property {string} expectedAction + * Optional. The expected action for this type of event. This should be the same action + * provided at token generation time on client-side platforms already + * integrated with recaptcha enterprise. + * * @typedef Event * @memberof google.cloud.recaptchaenterprise.v1beta1 * @see [google.cloud.recaptchaenterprise.v1beta1.Event definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} @@ -257,4 +269,282 @@ const TokenProperties = { */ MISSING: 6 } +}; + +/** + * The create key request message. + * + * @property {string} parent + * Required. The name of the project in which the key will be created, in the + * format "projects/{project_number}". + * + * @property {Object} key + * Required. Information to create a reCAPTCHA Enterprise key. + * + * This object should have the same structure as [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} + * + * @typedef CreateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const CreateKeyRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The list keys request message. + * + * @property {string} parent + * Required. The name of the project that contains the keys that will be + * listed, in the format "projects/{project_number}". + * + * @property {number} pageSize + * Optional. The maximum number of keys to return. Default is 10. Max limit is + * 1000. + * + * @property {string} pageToken + * Optional. The next_page_token value returned from a previous. + * ListKeysRequest, if any. + * + * @typedef ListKeysRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const ListKeysRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response to request to list keys in a project. + * + * @property {Object[]} keys + * Key details. + * + * This object should have the same structure as [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} + * + * @property {string} nextPageToken + * Token to retrieve the next page of results. It is set to empty if no keys + * remain in results. + * + * @typedef ListKeysResponse + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const ListKeysResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The get key request message. + * + * @property {string} name + * Required. The name of the requested key, in the format + * "projects/{project_number}/keys/{key_id}". + * + * @typedef GetKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const GetKeyRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The update key request message. + * + * @property {Object} key + * Required. The key to update. + * + * This object should have the same structure as [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} + * + * @property {Object} updateMask + * Optional. The mask to control which field of the key get updated. If the mask is not + * present, all fields will be updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * + * @typedef UpdateKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const UpdateKeyRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The delete key request message. + * + * @property {string} name + * Required. The name of the key to be deleted, in the format + * "projects/{project_number}/keys/{key_id}". + * + * @typedef DeleteKeyRequest + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const DeleteKeyRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A key used to identify and configure applications (web and/or mobile) that + * use reCAPTCHA Enterprise. + * + * @property {string} name + * The resource name for the Key in the format + * "projects/{project_number}/keys/{key_id}". + * + * @property {string} displayName + * Human-readable display name of this key. Modifiable by user. + * + * @property {Object} webSettings + * Settings for keys that can be used by websites. + * + * This object should have the same structure as [WebKeySettings]{@link google.cloud.recaptchaenterprise.v1beta1.WebKeySettings} + * + * @property {Object} androidSettings + * Settings for keys that can be used by Android apps. + * + * This object should have the same structure as [AndroidKeySettings]{@link google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings} + * + * @property {Object} iosSettings + * Settings for keys that can be used by iOS apps. + * + * This object should have the same structure as [IOSKeySettings]{@link google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings} + * + * @typedef Key + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.Key definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const Key = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Settings specific to keys that can be used by websites. + * + * @property {boolean} enforceAllowedDomains + * Whether allowed_domains is enforced or not. + * + * @property {string[]} allowedDomains + * 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' + * + * @property {boolean} allowAmpTraffic + * Whether this key can be used on AMP (Accelerated Mobile Pages) websites. + * + * @property {number} integrationType + * Required. Describes how this key is integrated with the website. + * + * The number should be among the values of [IntegrationType]{@link google.cloud.recaptchaenterprise.v1beta1.IntegrationType} + * + * @property {number} challengeSecurityPreference + * 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. + * + * The number should be among the values of [ChallengeSecurityPreference]{@link google.cloud.recaptchaenterprise.v1beta1.ChallengeSecurityPreference} + * + * @typedef WebKeySettings + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.WebKeySettings definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const WebKeySettings = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Enum that represents the possible challenge frequency and difficulty + * configurations for a web key. + * + * @enum {number} + * @memberof google.cloud.recaptchaenterprise.v1beta1 + */ + ChallengeSecurityPreference: { + + /** + * Default type that indicates this enum hasn't been specified. + */ + CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED: 0, + + /** + * Key tends to show fewer and easier challenges. + */ + USABILITY: 1, + + /** + * Key tends to show balanced (in amount and difficulty) challenges. + */ + BALANCED: 2, + + /** + * Key tends to show more and harder challenges. + */ + SECURITY: 3 + }, + + /** + * Enum that represents the integration types for web keys. + * + * @enum {number} + * @memberof google.cloud.recaptchaenterprise.v1beta1 + */ + 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 + } +}; + +/** + * Settings specific to keys that can be used by Android apps. + * + * @property {string[]} allowedPackageNames + * Android package names of apps allowed to use the key. + * Example: 'com.companyname.appname' + * + * @typedef AndroidKeySettings + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const AndroidKeySettings = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Settings specific to keys that can be used by iOS apps. + * + * @property {string[]} allowedBundleIds + * iOS bundle ids of apps allowed to use the key. + * Example: 'com.companyname.productname.appname' + * + * @typedef IOSKeySettings + * @memberof google.cloud.recaptchaenterprise.v1beta1 + * @see [google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto} + */ +const IOSKeySettings = { + // This is for documentation. Actual contents will be loaded by gRPC. }; \ No newline at end of file diff --git a/src/v1beta1/doc/google/protobuf/doc_empty.js b/src/v1beta1/doc/google/protobuf/doc_empty.js new file mode 100644 index 0000000..0b446dd --- /dev/null +++ b/src/v1beta1/doc/google/protobuf/doc_empty.js @@ -0,0 +1,34 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + * @typedef Empty + * @memberof google.protobuf + * @see [google.protobuf.Empty definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/empty.proto} + */ +const Empty = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/src/v1beta1/doc/google/protobuf/doc_field_mask.js b/src/v1beta1/doc/google/protobuf/doc_field_mask.js new file mode 100644 index 0000000..011207b --- /dev/null +++ b/src/v1beta1/doc/google/protobuf/doc_field_mask.js @@ -0,0 +1,228 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * `FieldMask` represents a set of symbolic field paths, for example: + * + * paths: "f.a" + * paths: "f.b.d" + * + * Here `f` represents a field in some root message, `a` and `b` + * fields in the message found in `f`, and `d` a field found in the + * message in `f.b`. + * + * Field masks are used to specify a subset of fields that should be + * returned by a get operation or modified by an update operation. + * Field masks also have a custom JSON encoding (see below). + * + * # Field Masks in Projections + * + * When used in the context of a projection, a response message or + * sub-message is filtered by the API to only contain those fields as + * specified in the mask. For example, if the mask in the previous + * example is applied to a response message as follows: + * + * f { + * a : 22 + * b { + * d : 1 + * x : 2 + * } + * y : 13 + * } + * z: 8 + * + * The result will not contain specific values for fields x,y and z + * (their value will be set to the default, and omitted in proto text + * output): + * + * + * f { + * a : 22 + * b { + * d : 1 + * } + * } + * + * A repeated field is not allowed except at the last position of a + * paths string. + * + * If a FieldMask object is not present in a get operation, the + * operation applies to all fields (as if a FieldMask of all fields + * had been specified). + * + * Note that a field mask does not necessarily apply to the + * top-level response message. In case of a REST get operation, the + * field mask applies directly to the response, but in case of a REST + * list operation, the mask instead applies to each individual message + * in the returned resource list. In case of a REST custom method, + * other definitions may be used. Where the mask applies will be + * clearly documented together with its declaration in the API. In + * any case, the effect on the returned resource/resources is required + * behavior for APIs. + * + * # Field Masks in Update Operations + * + * A field mask in update operations specifies which fields of the + * targeted resource are going to be updated. The API is required + * to only change the values of the fields as specified in the mask + * and leave the others untouched. If a resource is passed in to + * describe the updated values, the API ignores the values of all + * fields not covered by the mask. + * + * If a repeated field is specified for an update operation, new values will + * be appended to the existing repeated field in the target resource. Note that + * a repeated field is only allowed in the last position of a `paths` string. + * + * If a sub-message is specified in the last position of the field mask for an + * update operation, then new value will be merged into the existing sub-message + * in the target resource. + * + * For example, given the target message: + * + * f { + * b { + * d: 1 + * x: 2 + * } + * c: [1] + * } + * + * And an update message: + * + * f { + * b { + * d: 10 + * } + * c: [2] + * } + * + * then if the field mask is: + * + * paths: ["f.b", "f.c"] + * + * then the result will be: + * + * f { + * b { + * d: 10 + * x: 2 + * } + * c: [1, 2] + * } + * + * An implementation may provide options to override this default behavior for + * repeated and message fields. + * + * In order to reset a field's value to the default, the field must + * be in the mask and set to the default value in the provided resource. + * Hence, in order to reset all fields of a resource, provide a default + * instance of the resource and set all fields in the mask, or do + * not provide a mask as described below. + * + * If a field mask is not present on update, the operation applies to + * all fields (as if a field mask of all fields has been specified). + * Note that in the presence of schema evolution, this may mean that + * fields the client does not know and has therefore not filled into + * the request will be reset to their default. If this is unwanted + * behavior, a specific service may require a client to always specify + * a field mask, producing an error if not. + * + * As with get operations, the location of the resource which + * describes the updated values in the request message depends on the + * operation kind. In any case, the effect of the field mask is + * required to be honored by the API. + * + * ## Considerations for HTTP REST + * + * The HTTP kind of an update operation which uses a field mask must + * be set to PATCH instead of PUT in order to satisfy HTTP semantics + * (PUT must only be used for full updates). + * + * # JSON Encoding of Field Masks + * + * In JSON, a field mask is encoded as a single string where paths are + * separated by a comma. Fields name in each path are converted + * to/from lower-camel naming conventions. + * + * As an example, consider the following message declarations: + * + * message Profile { + * User user = 1; + * Photo photo = 2; + * } + * message User { + * string display_name = 1; + * string address = 2; + * } + * + * In proto a field mask for `Profile` may look as such: + * + * mask { + * paths: "user.display_name" + * paths: "photo" + * } + * + * In JSON, the same mask is represented as below: + * + * { + * mask: "user.displayName,photo" + * } + * + * # Field Masks and Oneof Fields + * + * Field masks treat fields in oneofs just as regular fields. Consider the + * following message: + * + * message SampleMessage { + * oneof test_oneof { + * string name = 4; + * SubMessage sub_message = 9; + * } + * } + * + * The field mask can be: + * + * mask { + * paths: "name" + * } + * + * Or: + * + * mask { + * paths: "sub_message" + * } + * + * Note that oneof type names ("test_oneof" in this case) cannot be used in + * paths. + * + * ## Field Mask Verification + * + * The implementation of any API method which has a FieldMask type field in the + * request should verify the included field paths, and return an + * `INVALID_ARGUMENT` error if any path is duplicated or unmappable. + * + * @property {string[]} paths + * The set of field mask paths. + * + * @typedef FieldMask + * @memberof google.protobuf + * @see [google.protobuf.FieldMask definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto} + */ +const FieldMask = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.js b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.js index 09118ba..6b2bb5b 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.js +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.js @@ -128,9 +128,23 @@ class RecaptchaEnterpriseServiceV1Beta1Client { assessmentPathTemplate: new gaxModule.PathTemplate( 'projects/{project}/assessments/{assessment}' ), + keyPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/keys/{key}' + ), projectPathTemplate: new 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 gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'keys' + ), + }; + // Put together the default options sent with requests. const defaults = gaxGrpc.constructSettings( 'google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1', @@ -161,6 +175,11 @@ class RecaptchaEnterpriseServiceV1Beta1Client { const recaptchaEnterpriseServiceV1Beta1StubMethods = [ 'createAssessment', 'annotateAssessment', + 'createKey', + 'listKeys', + 'getKey', + 'updateKey', + 'deleteKey', ]; for (const methodName of recaptchaEnterpriseServiceV1Beta1StubMethods) { const innerCallPromise = recaptchaEnterpriseServiceV1Beta1Stub.then( @@ -174,7 +193,7 @@ class RecaptchaEnterpriseServiceV1Beta1Client { this._innerApiCalls[methodName] = gaxModule.createApiCall( innerCallPromise, defaults[methodName], - null + this._descriptors.page[methodName] ); } } @@ -351,6 +370,392 @@ class RecaptchaEnterpriseServiceV1Beta1Client { 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 {Object} request.key + * Required. Information to create a reCAPTCHA Enterprise key. + * + * This object should have the same structure as [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const recaptchaenterprise = require('@google-cloud/recaptchaenterprise'); + * + * const client = new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.projectPath('[PROJECT]'); + * const key = {}; + * const request = { + * parent: formattedParent, + * key: key, + * }; + * client.createKey(request) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createKey(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + 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, + }); + + return this._innerApiCalls.createKey(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] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListKeysResponse]{@link google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse}. + * @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}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListKeysResponse]{@link google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const recaptchaenterprise = require('@google-cloud/recaptchaenterprise'); + * + * const client = new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * const formattedParent = client.projectPath('[PROJECT]'); + * + * client.listKeys({parent: formattedParent}) + * .then(responses => { + * const resources = responses[0]; + * for (const resource of resources) { + * // doThingsWith(resource) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * const formattedParent = client.projectPath('[PROJECT]'); + * + * + * const options = {autoPaginate: false}; + * const callback = responses => { + * // The actual resources in a response. + * const resources = responses[0]; + * // The next request if the response shows that there are more responses. + * const nextRequest = responses[1]; + * // The actual response object, if necessary. + * // const rawResponse = responses[2]; + * for (const resource of resources) { + * // doThingsWith(resource); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listKeys(nextRequest, options).then(callback); + * } + * } + * client.listKeys({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listKeys(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + 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, + }); + + return this._innerApiCalls.listKeys(request, options, callback); + } + + /** + * Equivalent to {@link listKeys}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listKeys} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project that contains the keys that will be + * listed, in the format "projects/{project_number}". + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @returns {Stream} + * An object stream which emits an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} on 'data' event. + * + * @example + * + * const recaptchaenterprise = require('@google-cloud/recaptchaenterprise'); + * + * const client = new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client({ + * // optional auth parameters. + * }); + * + * const formattedParent = client.projectPath('[PROJECT]'); + * client.listKeysStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listKeysStream(request, options) { + options = options || {}; + + return this._descriptors.page.listKeys.createStream( + this._innerApiCalls.listKeys, + request, + options + ); + } + + /** + * 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] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const recaptchaenterprise = require('@google-cloud/recaptchaenterprise'); + * + * const client = new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client({ + * // optional auth parameters. + * }); + * + * const formattedName = client.keyPath('[PROJECT]', '[KEY]'); + * client.getKey({name: formattedName}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getKey(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + request = request || {}; + 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, + }); + + return this._innerApiCalls.getKey(request, options, callback); + } + + /** + * Updates the specified key. + * + * @param {Object} request + * The request object that will be sent. + * @param {Object} request.key + * Required. The key to update. + * + * This object should have the same structure as [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} + * @param {Object} [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. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. + * @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}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const recaptchaenterprise = require('@google-cloud/recaptchaenterprise'); + * + * const client = new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client({ + * // optional auth parameters. + * }); + * + * const key = {}; + * client.updateKey({key: key}) + * .then(responses => { + * const response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + updateKey(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + request = request || {}; + 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, + }); + + 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] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error)} [callback] + * The function which will be called with the result of the API call. + * @returns {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const recaptchaenterprise = require('@google-cloud/recaptchaenterprise'); + * + * const client = new recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client({ + * // optional auth parameters. + * }); + * + * const formattedName = client.keyPath('[PROJECT]', '[KEY]'); + * client.deleteKey({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteKey(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + request = request || {}; + 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, + }); + + return this._innerApiCalls.deleteKey(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -369,6 +774,20 @@ class RecaptchaEnterpriseServiceV1Beta1Client { }); } + /** + * Return a fully-qualified key resource name string. + * + * @param {String} project + * @param {String} key + * @returns {String} + */ + keyPath(project, key) { + return this._pathTemplates.keyPathTemplate.render({ + project: project, + key: key, + }); + } + /** * Return a fully-qualified project resource name string. * @@ -405,6 +824,28 @@ class RecaptchaEnterpriseServiceV1Beta1Client { .assessment; } + /** + * Parse the keyName from a key resource. + * + * @param {String} keyName + * A fully-qualified path representing a key resources. + * @returns {String} - A string representing the project. + */ + matchProjectFromKeyName(keyName) { + return this._pathTemplates.keyPathTemplate.match(keyName).project; + } + + /** + * Parse the keyName from a key resource. + * + * @param {String} keyName + * A fully-qualified path representing a key resources. + * @returns {String} - A string representing the key. + */ + matchKeyFromKeyName(keyName) { + return this._pathTemplates.keyPathTemplate.match(keyName).key; + } + /** * Parse the projectName from a project resource. * 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 0c189d6..3aa1afa 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json @@ -29,6 +29,31 @@ "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "CreateKey": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListKeys": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateKey": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteKey": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/synth.metadata b/synth.metadata index fcf2e00..2f9c267 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2019-11-19T12:24:42.593913Z", + "updateTime": "2019-12-03T12:19:56.567157Z", "sources": [ { "generator": { @@ -12,8 +12,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a", - "internalRef": "281088257" + "sha": "38dc36a2a43cbab4a2a9183a43dd0441670098a9", + "internalRef": "283384331" } }, { diff --git a/test/gapic-v1beta1.js b/test/gapic-v1beta1.js index 9ff1a38..7d5edb6 100644 --- a/test/gapic-v1beta1.js +++ b/test/gapic-v1beta1.js @@ -191,6 +191,324 @@ describe('RecaptchaEnterpriseServiceV1Beta1Client', () => { }); }); }); + + describe('createKey', () => { + it('invokes createKey without error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedParent = client.projectPath('[PROJECT]'); + const key = {}; + const request = { + parent: formattedParent, + key: key, + }; + + // Mock response + const name = 'name3373707'; + const displayName = 'displayName1615086568'; + const expectedResponse = { + name: name, + displayName: displayName, + }; + + // Mock Grpc layer + client._innerApiCalls.createKey = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.createKey(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createKey with error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedParent = client.projectPath('[PROJECT]'); + const key = {}; + const request = { + parent: formattedParent, + key: key, + }; + + // Mock Grpc layer + client._innerApiCalls.createKey = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.createKey(request, (err, response) => { + assert(err instanceof Error); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('listKeys', () => { + it('invokes listKeys without error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedParent = client.projectPath('[PROJECT]'); + const request = { + parent: formattedParent, + }; + + // Mock response + const nextPageToken = ''; + const keysElement = {}; + const keys = [keysElement]; + const expectedResponse = { + nextPageToken: nextPageToken, + keys: keys, + }; + + // Mock Grpc layer + client._innerApiCalls.listKeys = (actualRequest, options, callback) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse.keys); + }; + + client.listKeys(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse.keys); + done(); + }); + }); + + it('invokes listKeys with error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedParent = client.projectPath('[PROJECT]'); + const request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.listKeys = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.listKeys(request, (err, response) => { + assert(err instanceof Error); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('getKey', () => { + it('invokes getKey without error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedName = client.keyPath('[PROJECT]', '[KEY]'); + const request = { + name: formattedName, + }; + + // Mock response + const name2 = 'name2-1052831874'; + const displayName = 'displayName1615086568'; + const expectedResponse = { + name: name2, + displayName: displayName, + }; + + // Mock Grpc layer + client._innerApiCalls.getKey = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.getKey(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getKey with error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedName = client.keyPath('[PROJECT]', '[KEY]'); + const request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.getKey = mockSimpleGrpcMethod(request, null, error); + + client.getKey(request, (err, response) => { + assert(err instanceof Error); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('updateKey', () => { + it('invokes updateKey without error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const key = {}; + const request = { + key: key, + }; + + // Mock response + const name = 'name3373707'; + const displayName = 'displayName1615086568'; + const expectedResponse = { + name: name, + displayName: displayName, + }; + + // Mock Grpc layer + client._innerApiCalls.updateKey = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.updateKey(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateKey with error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const key = {}; + const request = { + key: key, + }; + + // Mock Grpc layer + client._innerApiCalls.updateKey = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.updateKey(request, (err, response) => { + assert(err instanceof Error); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('deleteKey', () => { + it('invokes deleteKey without error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedName = client.keyPath('[PROJECT]', '[KEY]'); + const request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteKey = mockSimpleGrpcMethod(request); + + client.deleteKey(request, err => { + assert.ifError(err); + done(); + }); + }); + + it('invokes deleteKey with error', done => { + const client = new recaptchaenterpriseModule.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + + // Mock request + const formattedName = client.keyPath('[PROJECT]', '[KEY]'); + const request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteKey = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.deleteKey(request, err => { + assert(err instanceof Error); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); }); function mockSimpleGrpcMethod(expectedRequest, response, error) {