├── VERSION ├── .gitattributes ├── metadata └── V1 │ └── Recaptchaenterprise.php ├── .OwlBot.yaml ├── SECURITY.md ├── CONTRIBUTING.md ├── src └── V1 │ ├── AddIpOverrideResponse.php │ ├── RemoveIpOverrideResponse.php │ ├── AnnotateAssessmentResponse.php │ ├── ExpressKeySettings.php │ ├── ReorderFirewallPoliciesResponse.php │ ├── FirewallAction │ ├── AllowAction.php │ ├── BlockAction.php │ ├── RedirectAction.php │ ├── IncludeRecaptchaScriptAction.php │ ├── SubstituteAction.php │ └── SetHeaderAction.php │ ├── IpOverrideData │ └── OverrideType.php │ ├── SmsTollFraudVerdict │ └── SmsTollFraudReason.php │ ├── RiskAnalysis │ ├── Challenge.php │ └── ClassificationReason.php │ ├── WafSettings │ ├── WafService.php │ └── WafFeature.php │ ├── Event │ └── FraudPrevention.php │ ├── TestingOptions │ └── TestingChallenge.php │ ├── FraudSignals │ ├── CardSignals │ │ └── CardLabel.php │ ├── CardSignals.php │ └── UserSignals.php │ ├── WebKeySettings │ ├── ChallengeSecurityPreference.php │ └── IntegrationType.php │ ├── AccountDefenderAssessment.php │ ├── FraudPreventionAssessment │ ├── CardTestingVerdict.php │ ├── StolenInstrumentVerdict.php │ └── BehavioralTrustVerdict.php │ ├── RelatedAccountGroup.php │ ├── ScoreDistribution.php │ ├── GetKeyRequest.php │ ├── AnnotateAssessmentRequest │ └── Annotation.php │ ├── PhoneFraudAssessment.php │ ├── DeleteKeyRequest.php │ ├── GetMetricsRequest.php │ ├── TokenProperties │ └── InvalidReason.php │ ├── RetrieveLegacySecretKeyResponse.php │ ├── AccountDefenderAssessment │ └── AccountDefenderLabel.php │ ├── RetrieveLegacySecretKeyRequest.php │ ├── GetFirewallPolicyRequest.php │ ├── DeleteFirewallPolicyRequest.php │ ├── ListKeysResponse.php │ ├── ListIpOverridesResponse.php │ ├── WafSettings.php │ ├── ListFirewallPoliciesResponse.php │ ├── SmsTollFraudVerdict.php │ ├── ListRelatedAccountGroupsResponse.php │ ├── SearchRelatedAccountGroupMembershipsResponse.php │ ├── ListRelatedAccountGroupMembershipsResponse.php │ ├── ScoreMetrics.php │ ├── TestingOptions.php │ └── UserId.php ├── composer.json ├── owlbot.py ├── CODE_OF_CONDUCT.md ├── samples └── V1 │ └── RecaptchaEnterpriseServiceClient │ ├── update_firewall_policy.php │ ├── update_key.php │ ├── delete_key.php │ ├── get_key.php │ ├── delete_firewall_policy.php │ ├── get_metrics.php │ ├── get_firewall_policy.php │ ├── list_keys.php │ ├── create_assessment.php │ ├── list_ip_overrides.php │ ├── create_key.php │ ├── retrieve_legacy_secret_key.php │ ├── list_firewall_policies.php │ ├── list_related_account_groups.php │ ├── create_firewall_policy.php │ ├── migrate_key.php │ ├── list_related_account_group_memberships.php │ ├── search_related_account_group_memberships.php │ ├── annotate_assessment.php │ ├── reorder_firewall_policies.php │ └── add_ip_override.php └── README.md /VERSION: -------------------------------------------------------------------------------- 1 | 2.2.1 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /*.xml.dist export-ignore 2 | /tests export-ignore 3 | /.github export-ignore 4 | -------------------------------------------------------------------------------- /metadata/V1/Recaptchaenterprise.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-recaptcha-enterprise/HEAD/metadata/V1/Recaptchaenterprise.php -------------------------------------------------------------------------------- /.OwlBot.yaml: -------------------------------------------------------------------------------- 1 | deep-copy-regex: 2 | - source: /google/cloud/recaptchaenterprise/(v1)/.*-php/(.*) 3 | dest: /owl-bot-staging/RecaptchaEnterprise/$1/$2 4 | api-name: RecaptchaEnterprise 5 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). 4 | 5 | The Google Security Team will respond within 5 working days of your report on g.co/vulnz. 6 | 7 | We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. We accept 4 | and review pull requests against the main 5 | [Google Cloud PHP](https://github.com/googleapis/google-cloud-php) 6 | repository, which contains all of our client libraries. You will also need to 7 | sign a Contributor License Agreement. For more details about how to contribute, 8 | see the 9 | [CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) 10 | file in the main Google Cloud PHP repository. 11 | -------------------------------------------------------------------------------- /src/V1/AddIpOverrideResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.AddIpOverrideResponse 15 | */ 16 | class AddIpOverrideResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/V1/RemoveIpOverrideResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.RemoveIpOverrideResponse 15 | */ 16 | class RemoveIpOverrideResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/V1/AnnotateAssessmentResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse 15 | */ 16 | class AnnotateAssessmentResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/V1/ExpressKeySettings.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ExpressKeySettings 15 | */ 16 | class ExpressKeySettings extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/V1/ReorderFirewallPoliciesResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ReorderFirewallPoliciesResponse 15 | */ 16 | class ReorderFirewallPoliciesResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/V1/FirewallAction/AllowAction.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FirewallAction.AllowAction 15 | */ 16 | class AllowAction extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/V1/FirewallAction/BlockAction.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FirewallAction.BlockAction 16 | */ 17 | class BlockAction extends \Google\Protobuf\Internal\Message 18 | { 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * } 27 | */ 28 | public function __construct($data = NULL) { 29 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 30 | parent::__construct($data); 31 | } 32 | 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/V1/FirewallAction/RedirectAction.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FirewallAction.RedirectAction 16 | */ 17 | class RedirectAction extends \Google\Protobuf\Internal\Message 18 | { 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * } 27 | */ 28 | public function __construct($data = NULL) { 29 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 30 | parent::__construct($data); 31 | } 32 | 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google/cloud-recaptcha-enterprise", 3 | "description": "Google Cloud Recaptcha Enterprise Client for PHP", 4 | "license": "Apache-2.0", 5 | "minimum-stability": "stable", 6 | "autoload": { 7 | "psr-4": { 8 | "Google\\Cloud\\RecaptchaEnterprise\\": "src", 9 | "GPBMetadata\\Google\\Cloud\\Recaptchaenterprise\\": "metadata" 10 | } 11 | }, 12 | "autoload-dev": { 13 | "psr-4": { 14 | "Google\\Cloud\\RecaptchaEnterprise\\Tests\\": "tests" 15 | } 16 | }, 17 | "extra": { 18 | "component": { 19 | "id": "cloud-recaptcha-enterprise", 20 | "path": "RecaptchaEnterprise", 21 | "entry": null, 22 | "target": "googleapis/google-cloud-php-recaptcha-enterprise.git" 23 | } 24 | }, 25 | "require": { 26 | "php": "^8.1", 27 | "google/gax": "^1.38.0" 28 | }, 29 | "require-dev": { 30 | "phpunit/phpunit": "^9.0" 31 | }, 32 | "suggest": { 33 | "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", 34 | "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/V1/FirewallAction/IncludeRecaptchaScriptAction.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FirewallAction.IncludeRecaptchaScriptAction 19 | */ 20 | class IncludeRecaptchaScriptAction extends \Google\Protobuf\Internal\Message 21 | { 22 | 23 | /** 24 | * Constructor. 25 | * 26 | * @param array $data { 27 | * Optional. Data for populating the Message object. 28 | * 29 | * } 30 | */ 31 | public function __construct($data = NULL) { 32 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 33 | parent::__construct($data); 34 | } 35 | 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /owlbot.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """This script is used to synthesize generated parts of this library.""" 16 | 17 | import logging 18 | from pathlib import Path 19 | import subprocess 20 | 21 | import synthtool as s 22 | from synthtool.languages import php 23 | from synthtool import _tracked_paths 24 | 25 | logging.basicConfig(level=logging.DEBUG) 26 | 27 | src = Path(f"../{php.STAGING_DIR}/RecaptchaEnterprise").resolve() 28 | dest = Path().resolve() 29 | 30 | # Added so that we can pass copy_excludes in the owlbot_main() call 31 | _tracked_paths.add(src) 32 | 33 | php.owlbot_main(src=src, dest=dest) 34 | 35 | # remove class_alias code 36 | s.replace( 37 | "src/V*/**/*.php", 38 | r"^// Adding a class alias for backwards compatibility with the previous class name.$" 39 | + "\n" 40 | + r"^class_alias\(.*\);$" 41 | + "\n", 42 | '') 43 | 44 | # format generated clients 45 | subprocess.run([ 46 | 'npm', 47 | 'exec', 48 | '--yes', 49 | '--package=@prettier/plugin-php@^0.19', 50 | '--', 51 | 'prettier', 52 | '**/Client/*', 53 | '--write', 54 | '--parser=php', 55 | '--single-quote', 56 | '--print-width=120']) 57 | -------------------------------------------------------------------------------- /src/V1/IpOverrideData/OverrideType.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.IpOverrideData.OverrideType 13 | */ 14 | class OverrideType 15 | { 16 | /** 17 | * Default override type that indicates this enum hasn't been specified. 18 | * 19 | * Generated from protobuf enum OVERRIDE_TYPE_UNSPECIFIED = 0; 20 | */ 21 | const OVERRIDE_TYPE_UNSPECIFIED = 0; 22 | /** 23 | * Allowlist the IP address; i.e. give a `risk_analysis.score` of 0.9 for 24 | * all valid assessments. 25 | * 26 | * Generated from protobuf enum ALLOW = 1; 27 | */ 28 | const ALLOW = 1; 29 | 30 | private static $valueToName = [ 31 | self::OVERRIDE_TYPE_UNSPECIFIED => 'OVERRIDE_TYPE_UNSPECIFIED', 32 | self::ALLOW => 'ALLOW', 33 | ]; 34 | 35 | public static function name($value) 36 | { 37 | if (!isset(self::$valueToName[$value])) { 38 | throw new UnexpectedValueException(sprintf( 39 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 40 | } 41 | return self::$valueToName[$value]; 42 | } 43 | 44 | 45 | public static function value($name) 46 | { 47 | $const = __CLASS__ . '::' . strtoupper($name); 48 | if (!defined($const)) { 49 | throw new UnexpectedValueException(sprintf( 50 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 51 | } 52 | return constant($const); 53 | } 54 | } 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/V1/SmsTollFraudVerdict/SmsTollFraudReason.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict.SmsTollFraudReason 13 | */ 14 | class SmsTollFraudReason 15 | { 16 | /** 17 | * Default unspecified reason 18 | * 19 | * Generated from protobuf enum SMS_TOLL_FRAUD_REASON_UNSPECIFIED = 0; 20 | */ 21 | const SMS_TOLL_FRAUD_REASON_UNSPECIFIED = 0; 22 | /** 23 | * The provided phone number was invalid 24 | * 25 | * Generated from protobuf enum INVALID_PHONE_NUMBER = 1; 26 | */ 27 | const INVALID_PHONE_NUMBER = 1; 28 | 29 | private static $valueToName = [ 30 | self::SMS_TOLL_FRAUD_REASON_UNSPECIFIED => 'SMS_TOLL_FRAUD_REASON_UNSPECIFIED', 31 | self::INVALID_PHONE_NUMBER => 'INVALID_PHONE_NUMBER', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, 4 | and in the interest of fostering an open and welcoming community, 5 | we pledge to respect all people who contribute through reporting issues, 6 | posting feature requests, updating documentation, 7 | submitting pull requests or patches, and other activities. 8 | 9 | We are committed to making participation in this project 10 | a harassment-free experience for everyone, 11 | regardless of level of experience, gender, gender identity and expression, 12 | sexual orientation, disability, personal appearance, 13 | body size, race, ethnicity, age, religion, or nationality. 14 | 15 | Examples of unacceptable behavior by participants include: 16 | 17 | * The use of sexualized language or imagery 18 | * Personal attacks 19 | * Trolling or insulting/derogatory comments 20 | * Public or private harassment 21 | * Publishing other's private information, 22 | such as physical or electronic 23 | addresses, without explicit permission 24 | * Other unethical or unprofessional conduct. 25 | 26 | Project maintainers have the right and responsibility to remove, edit, or reject 27 | comments, commits, code, wiki edits, issues, and other contributions 28 | that are not aligned to this Code of Conduct. 29 | By adopting this Code of Conduct, 30 | project maintainers commit themselves to fairly and consistently 31 | applying these principles to every aspect of managing this project. 32 | Project maintainers who do not follow or enforce the Code of Conduct 33 | may be permanently removed from the project team. 34 | 35 | This code of conduct applies both within project spaces and in public spaces 36 | when an individual is representing the project or its community. 37 | 38 | Instances of abusive, harassing, or otherwise unacceptable behavior 39 | may be reported by opening an issue 40 | or contacting one or more of the project maintainers. 41 | 42 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, 43 | available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) -------------------------------------------------------------------------------- /src/V1/RiskAnalysis/Challenge.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.RiskAnalysis.Challenge 13 | */ 14 | class Challenge 15 | { 16 | /** 17 | * Default unspecified type. 18 | * 19 | * Generated from protobuf enum CHALLENGE_UNSPECIFIED = 0; 20 | */ 21 | const CHALLENGE_UNSPECIFIED = 0; 22 | /** 23 | * No challenge was presented for solving. 24 | * 25 | * Generated from protobuf enum NOCAPTCHA = 1; 26 | */ 27 | const NOCAPTCHA = 1; 28 | /** 29 | * A solution was submitted that was correct. 30 | * 31 | * Generated from protobuf enum PASSED = 2; 32 | */ 33 | const PASSED = 2; 34 | /** 35 | * A solution was submitted that was incorrect or otherwise 36 | * deemed suspicious. 37 | * 38 | * Generated from protobuf enum FAILED = 3; 39 | */ 40 | const FAILED = 3; 41 | 42 | private static $valueToName = [ 43 | self::CHALLENGE_UNSPECIFIED => 'CHALLENGE_UNSPECIFIED', 44 | self::NOCAPTCHA => 'NOCAPTCHA', 45 | self::PASSED => 'PASSED', 46 | self::FAILED => 'FAILED', 47 | ]; 48 | 49 | public static function name($value) 50 | { 51 | if (!isset(self::$valueToName[$value])) { 52 | throw new UnexpectedValueException(sprintf( 53 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 54 | } 55 | return self::$valueToName[$value]; 56 | } 57 | 58 | 59 | public static function value($name) 60 | { 61 | $const = __CLASS__ . '::' . strtoupper($name); 62 | if (!defined($const)) { 63 | throw new UnexpectedValueException(sprintf( 64 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 65 | } 66 | return constant($const); 67 | } 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/V1/WafSettings/WafService.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.WafSettings.WafService 13 | */ 14 | class WafService 15 | { 16 | /** 17 | * Undefined WAF 18 | * 19 | * Generated from protobuf enum WAF_SERVICE_UNSPECIFIED = 0; 20 | */ 21 | const WAF_SERVICE_UNSPECIFIED = 0; 22 | /** 23 | * Cloud Armor 24 | * 25 | * Generated from protobuf enum CA = 1; 26 | */ 27 | const CA = 1; 28 | /** 29 | * Fastly 30 | * 31 | * Generated from protobuf enum FASTLY = 3; 32 | */ 33 | const FASTLY = 3; 34 | /** 35 | * Cloudflare 36 | * 37 | * Generated from protobuf enum CLOUDFLARE = 4; 38 | */ 39 | const CLOUDFLARE = 4; 40 | /** 41 | * Akamai 42 | * 43 | * Generated from protobuf enum AKAMAI = 5; 44 | */ 45 | const AKAMAI = 5; 46 | 47 | private static $valueToName = [ 48 | self::WAF_SERVICE_UNSPECIFIED => 'WAF_SERVICE_UNSPECIFIED', 49 | self::CA => 'CA', 50 | self::FASTLY => 'FASTLY', 51 | self::CLOUDFLARE => 'CLOUDFLARE', 52 | self::AKAMAI => 'AKAMAI', 53 | ]; 54 | 55 | public static function name($value) 56 | { 57 | if (!isset(self::$valueToName[$value])) { 58 | throw new UnexpectedValueException(sprintf( 59 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 60 | } 61 | return self::$valueToName[$value]; 62 | } 63 | 64 | 65 | public static function value($name) 66 | { 67 | $const = __CLASS__ . '::' . strtoupper($name); 68 | if (!defined($const)) { 69 | throw new UnexpectedValueException(sprintf( 70 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 71 | } 72 | return constant($const); 73 | } 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/V1/Event/FraudPrevention.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.Event.FraudPrevention 13 | */ 14 | class FraudPrevention 15 | { 16 | /** 17 | * Default, unspecified setting. `fraud_prevention_assessment` is returned 18 | * if `transaction_data` is present in `Event` and Fraud Prevention is 19 | * enabled in the Google Cloud console. 20 | * 21 | * Generated from protobuf enum FRAUD_PREVENTION_UNSPECIFIED = 0; 22 | */ 23 | const FRAUD_PREVENTION_UNSPECIFIED = 0; 24 | /** 25 | * Enable Fraud Prevention for this assessment, if Fraud Prevention is 26 | * enabled in the Google Cloud console. 27 | * 28 | * Generated from protobuf enum ENABLED = 1; 29 | */ 30 | const ENABLED = 1; 31 | /** 32 | * Disable Fraud Prevention for this assessment, regardless of the Google 33 | * Cloud console settings. 34 | * 35 | * Generated from protobuf enum DISABLED = 2; 36 | */ 37 | const DISABLED = 2; 38 | 39 | private static $valueToName = [ 40 | self::FRAUD_PREVENTION_UNSPECIFIED => 'FRAUD_PREVENTION_UNSPECIFIED', 41 | self::ENABLED => 'ENABLED', 42 | self::DISABLED => 'DISABLED', 43 | ]; 44 | 45 | public static function name($value) 46 | { 47 | if (!isset(self::$valueToName[$value])) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 50 | } 51 | return self::$valueToName[$value]; 52 | } 53 | 54 | 55 | public static function value($name) 56 | { 57 | $const = __CLASS__ . '::' . strtoupper($name); 58 | if (!defined($const)) { 59 | throw new UnexpectedValueException(sprintf( 60 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 61 | } 62 | return constant($const); 63 | } 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/V1/TestingOptions/TestingChallenge.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge 14 | */ 15 | class TestingChallenge 16 | { 17 | /** 18 | * Perform the normal risk analysis and return either nocaptcha or a 19 | * challenge depending on risk and trust factors. 20 | * 21 | * Generated from protobuf enum TESTING_CHALLENGE_UNSPECIFIED = 0; 22 | */ 23 | const TESTING_CHALLENGE_UNSPECIFIED = 0; 24 | /** 25 | * Challenge requests for this key always return a nocaptcha, which 26 | * does not require a solution. 27 | * 28 | * Generated from protobuf enum NOCAPTCHA = 1; 29 | */ 30 | const NOCAPTCHA = 1; 31 | /** 32 | * Challenge requests for this key always return an unsolvable 33 | * challenge. 34 | * 35 | * Generated from protobuf enum UNSOLVABLE_CHALLENGE = 2; 36 | */ 37 | const UNSOLVABLE_CHALLENGE = 2; 38 | 39 | private static $valueToName = [ 40 | self::TESTING_CHALLENGE_UNSPECIFIED => 'TESTING_CHALLENGE_UNSPECIFIED', 41 | self::NOCAPTCHA => 'NOCAPTCHA', 42 | self::UNSOLVABLE_CHALLENGE => 'UNSOLVABLE_CHALLENGE', 43 | ]; 44 | 45 | public static function name($value) 46 | { 47 | if (!isset(self::$valueToName[$value])) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 50 | } 51 | return self::$valueToName[$value]; 52 | } 53 | 54 | 55 | public static function value($name) 56 | { 57 | $const = __CLASS__ . '::' . strtoupper($name); 58 | if (!defined($const)) { 59 | throw new UnexpectedValueException(sprintf( 60 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 61 | } 62 | return constant($const); 63 | } 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/V1/FraudSignals/CardSignals/CardLabel.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FraudSignals.CardSignals.CardLabel 14 | */ 15 | class CardLabel 16 | { 17 | /** 18 | * No label specified. 19 | * 20 | * Generated from protobuf enum CARD_LABEL_UNSPECIFIED = 0; 21 | */ 22 | const CARD_LABEL_UNSPECIFIED = 0; 23 | /** 24 | * This card has been detected as prepaid. 25 | * 26 | * Generated from protobuf enum PREPAID = 1; 27 | */ 28 | const PREPAID = 1; 29 | /** 30 | * This card has been detected as virtual, such as a card number generated 31 | * for a single transaction or merchant. 32 | * 33 | * Generated from protobuf enum VIRTUAL = 2; 34 | */ 35 | const VIRTUAL = 2; 36 | /** 37 | * This card has been detected as being used in an unexpected geographic 38 | * location. 39 | * 40 | * Generated from protobuf enum UNEXPECTED_LOCATION = 3; 41 | */ 42 | const UNEXPECTED_LOCATION = 3; 43 | 44 | private static $valueToName = [ 45 | self::CARD_LABEL_UNSPECIFIED => 'CARD_LABEL_UNSPECIFIED', 46 | self::PREPAID => 'PREPAID', 47 | self::VIRTUAL => 'VIRTUAL', 48 | self::UNEXPECTED_LOCATION => 'UNEXPECTED_LOCATION', 49 | ]; 50 | 51 | public static function name($value) 52 | { 53 | if (!isset(self::$valueToName[$value])) { 54 | throw new UnexpectedValueException(sprintf( 55 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 56 | } 57 | return self::$valueToName[$value]; 58 | } 59 | 60 | 61 | public static function value($name) 62 | { 63 | $const = __CLASS__ . '::' . strtoupper($name); 64 | if (!defined($const)) { 65 | throw new UnexpectedValueException(sprintf( 66 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 67 | } 68 | return constant($const); 69 | } 70 | } 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/V1/WebKeySettings/ChallengeSecurityPreference.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference 14 | */ 15 | class ChallengeSecurityPreference 16 | { 17 | /** 18 | * Default type that indicates this enum hasn't been specified. 19 | * 20 | * Generated from protobuf enum CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0; 21 | */ 22 | const CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0; 23 | /** 24 | * Key tends to show fewer and easier challenges. 25 | * 26 | * Generated from protobuf enum USABILITY = 1; 27 | */ 28 | const USABILITY = 1; 29 | /** 30 | * Key tends to show balanced (in amount and difficulty) challenges. 31 | * 32 | * Generated from protobuf enum BALANCE = 2; 33 | */ 34 | const BALANCE = 2; 35 | /** 36 | * Key tends to show more and harder challenges. 37 | * 38 | * Generated from protobuf enum SECURITY = 3; 39 | */ 40 | const SECURITY = 3; 41 | 42 | private static $valueToName = [ 43 | self::CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED => 'CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED', 44 | self::USABILITY => 'USABILITY', 45 | self::BALANCE => 'BALANCE', 46 | self::SECURITY => 'SECURITY', 47 | ]; 48 | 49 | public static function name($value) 50 | { 51 | if (!isset(self::$valueToName[$value])) { 52 | throw new UnexpectedValueException(sprintf( 53 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 54 | } 55 | return self::$valueToName[$value]; 56 | } 57 | 58 | 59 | public static function value($name) 60 | { 61 | $const = __CLASS__ . '::' . strtoupper($name); 62 | if (!defined($const)) { 63 | throw new UnexpectedValueException(sprintf( 64 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 65 | } 66 | return constant($const); 67 | } 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/V1/FirewallAction/SubstituteAction.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FirewallAction.SubstituteAction 16 | */ 17 | class SubstituteAction extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Optional. The address to redirect to. The target is a relative path in 21 | * the current host. Example: "/blog/404.html". 22 | * 23 | * Generated from protobuf field string path = 1 [(.google.api.field_behavior) = OPTIONAL]; 24 | */ 25 | protected $path = ''; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type string $path 34 | * Optional. The address to redirect to. The target is a relative path in 35 | * the current host. Example: "/blog/404.html". 36 | * } 37 | */ 38 | public function __construct($data = NULL) { 39 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 40 | parent::__construct($data); 41 | } 42 | 43 | /** 44 | * Optional. The address to redirect to. The target is a relative path in 45 | * the current host. Example: "/blog/404.html". 46 | * 47 | * Generated from protobuf field string path = 1 [(.google.api.field_behavior) = OPTIONAL]; 48 | * @return string 49 | */ 50 | public function getPath() 51 | { 52 | return $this->path; 53 | } 54 | 55 | /** 56 | * Optional. The address to redirect to. The target is a relative path in 57 | * the current host. Example: "/blog/404.html". 58 | * 59 | * Generated from protobuf field string path = 1 [(.google.api.field_behavior) = OPTIONAL]; 60 | * @param string $var 61 | * @return $this 62 | */ 63 | public function setPath($var) 64 | { 65 | GPBUtil::checkString($var, True); 66 | $this->path = $var; 67 | 68 | return $this; 69 | } 70 | 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/V1/WebKeySettings/IntegrationType.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType 13 | */ 14 | class IntegrationType 15 | { 16 | /** 17 | * Default type that indicates this enum hasn't been specified. This is not 18 | * a valid IntegrationType, one of the other types must be specified 19 | * instead. 20 | * 21 | * Generated from protobuf enum INTEGRATION_TYPE_UNSPECIFIED = 0; 22 | */ 23 | const INTEGRATION_TYPE_UNSPECIFIED = 0; 24 | /** 25 | * Only used to produce scores. It doesn't display the "I'm not a robot" 26 | * checkbox and never shows captcha challenges. 27 | * 28 | * Generated from protobuf enum SCORE = 1; 29 | */ 30 | const SCORE = 1; 31 | /** 32 | * Displays the "I'm not a robot" checkbox and may show captcha challenges 33 | * after it is checked. 34 | * 35 | * Generated from protobuf enum CHECKBOX = 2; 36 | */ 37 | const CHECKBOX = 2; 38 | /** 39 | * Doesn't display the "I'm not a robot" checkbox, but may show captcha 40 | * challenges after risk analysis. 41 | * 42 | * Generated from protobuf enum INVISIBLE = 3; 43 | */ 44 | const INVISIBLE = 3; 45 | 46 | private static $valueToName = [ 47 | self::INTEGRATION_TYPE_UNSPECIFIED => 'INTEGRATION_TYPE_UNSPECIFIED', 48 | self::SCORE => 'SCORE', 49 | self::CHECKBOX => 'CHECKBOX', 50 | self::INVISIBLE => 'INVISIBLE', 51 | ]; 52 | 53 | public static function name($value) 54 | { 55 | if (!isset(self::$valueToName[$value])) { 56 | throw new UnexpectedValueException(sprintf( 57 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 58 | } 59 | return self::$valueToName[$value]; 60 | } 61 | 62 | 63 | public static function value($name) 64 | { 65 | $const = __CLASS__ . '::' . strtoupper($name); 66 | if (!defined($const)) { 67 | throw new UnexpectedValueException(sprintf( 68 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 69 | } 70 | return constant($const); 71 | } 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/update_firewall_policy.php: -------------------------------------------------------------------------------- 1 | setFirewallPolicy($firewallPolicy); 49 | 50 | // Call the API and handle any network failures. 51 | try { 52 | /** @var FirewallPolicy $response */ 53 | $response = $recaptchaEnterpriseServiceClient->updateFirewallPolicy($request); 54 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 55 | } catch (ApiException $ex) { 56 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 57 | } 58 | } 59 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_UpdateFirewallPolicy_sync] 60 | -------------------------------------------------------------------------------- /src/V1/AccountDefenderAssessment.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment 15 | */ 16 | class AccountDefenderAssessment extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Output only. Labels for this request. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel labels = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 22 | */ 23 | private $labels; 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param array $data { 29 | * Optional. Data for populating the Message object. 30 | * 31 | * @type array|\Google\Protobuf\Internal\RepeatedField $labels 32 | * Output only. Labels for this request. 33 | * } 34 | */ 35 | public function __construct($data = NULL) { 36 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 37 | parent::__construct($data); 38 | } 39 | 40 | /** 41 | * Output only. Labels for this request. 42 | * 43 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel labels = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 44 | * @return \Google\Protobuf\Internal\RepeatedField 45 | */ 46 | public function getLabels() 47 | { 48 | return $this->labels; 49 | } 50 | 51 | /** 52 | * Output only. Labels for this request. 53 | * 54 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel labels = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 55 | * @param array|\Google\Protobuf\Internal\RepeatedField $var 56 | * @return $this 57 | */ 58 | public function setLabels($var) 59 | { 60 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\RecaptchaEnterprise\V1\AccountDefenderAssessment\AccountDefenderLabel::class); 61 | $this->labels = $arr; 62 | 63 | return $this; 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/V1/FraudPreventionAssessment/CardTestingVerdict.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.CardTestingVerdict 16 | */ 17 | class CardTestingVerdict extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Output only. Probability of this transaction attempt being part of a card 21 | * testing attack. Values are from 0.0 (lowest) to 1.0 (highest). 22 | * 23 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 24 | */ 25 | protected $risk = 0.0; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type float $risk 34 | * Output only. Probability of this transaction attempt being part of a card 35 | * testing attack. Values are from 0.0 (lowest) to 1.0 (highest). 36 | * } 37 | */ 38 | public function __construct($data = NULL) { 39 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 40 | parent::__construct($data); 41 | } 42 | 43 | /** 44 | * Output only. Probability of this transaction attempt being part of a card 45 | * testing attack. Values are from 0.0 (lowest) to 1.0 (highest). 46 | * 47 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 48 | * @return float 49 | */ 50 | public function getRisk() 51 | { 52 | return $this->risk; 53 | } 54 | 55 | /** 56 | * Output only. Probability of this transaction attempt being part of a card 57 | * testing attack. Values are from 0.0 (lowest) to 1.0 (highest). 58 | * 59 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 60 | * @param float $var 61 | * @return $this 62 | */ 63 | public function setRisk($var) 64 | { 65 | GPBUtil::checkFloat($var); 66 | $this->risk = $var; 67 | 68 | return $this; 69 | } 70 | 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/V1/FraudPreventionAssessment/StolenInstrumentVerdict.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.StolenInstrumentVerdict 16 | */ 17 | class StolenInstrumentVerdict extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Output only. Probability of this transaction being executed with a stolen 21 | * instrument. Values are from 0.0 (lowest) to 1.0 (highest). 22 | * 23 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 24 | */ 25 | protected $risk = 0.0; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type float $risk 34 | * Output only. Probability of this transaction being executed with a stolen 35 | * instrument. Values are from 0.0 (lowest) to 1.0 (highest). 36 | * } 37 | */ 38 | public function __construct($data = NULL) { 39 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 40 | parent::__construct($data); 41 | } 42 | 43 | /** 44 | * Output only. Probability of this transaction being executed with a stolen 45 | * instrument. Values are from 0.0 (lowest) to 1.0 (highest). 46 | * 47 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 48 | * @return float 49 | */ 50 | public function getRisk() 51 | { 52 | return $this->risk; 53 | } 54 | 55 | /** 56 | * Output only. Probability of this transaction being executed with a stolen 57 | * instrument. Values are from 0.0 (lowest) to 1.0 (highest). 58 | * 59 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 60 | * @param float $var 61 | * @return $this 62 | */ 63 | public function setRisk($var) 64 | { 65 | GPBUtil::checkFloat($var); 66 | $this->risk = $var; 67 | 68 | return $this; 69 | } 70 | 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/V1/WafSettings/WafFeature.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature 14 | */ 15 | class WafFeature 16 | { 17 | /** 18 | * Undefined feature. 19 | * 20 | * Generated from protobuf enum WAF_FEATURE_UNSPECIFIED = 0; 21 | */ 22 | const WAF_FEATURE_UNSPECIFIED = 0; 23 | /** 24 | * Redirects suspicious traffic to reCAPTCHA. 25 | * 26 | * Generated from protobuf enum CHALLENGE_PAGE = 1; 27 | */ 28 | const CHALLENGE_PAGE = 1; 29 | /** 30 | * Use reCAPTCHA session-tokens to protect the whole user session on the 31 | * site's domain. 32 | * 33 | * Generated from protobuf enum SESSION_TOKEN = 2; 34 | */ 35 | const SESSION_TOKEN = 2; 36 | /** 37 | * Use reCAPTCHA action-tokens to protect user actions. 38 | * 39 | * Generated from protobuf enum ACTION_TOKEN = 3; 40 | */ 41 | const ACTION_TOKEN = 3; 42 | /** 43 | * Use reCAPTCHA WAF express protection to protect any content other than 44 | * web pages, like APIs and IoT devices. 45 | * 46 | * Generated from protobuf enum EXPRESS = 5; 47 | */ 48 | const EXPRESS = 5; 49 | 50 | private static $valueToName = [ 51 | self::WAF_FEATURE_UNSPECIFIED => 'WAF_FEATURE_UNSPECIFIED', 52 | self::CHALLENGE_PAGE => 'CHALLENGE_PAGE', 53 | self::SESSION_TOKEN => 'SESSION_TOKEN', 54 | self::ACTION_TOKEN => 'ACTION_TOKEN', 55 | self::EXPRESS => 'EXPRESS', 56 | ]; 57 | 58 | public static function name($value) 59 | { 60 | if (!isset(self::$valueToName[$value])) { 61 | throw new UnexpectedValueException(sprintf( 62 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 63 | } 64 | return self::$valueToName[$value]; 65 | } 66 | 67 | 68 | public static function value($name) 69 | { 70 | $const = __CLASS__ . '::' . strtoupper($name); 71 | if (!defined($const)) { 72 | throw new UnexpectedValueException(sprintf( 73 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 74 | } 75 | return constant($const); 76 | } 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/V1/FraudPreventionAssessment/BehavioralTrustVerdict.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.BehavioralTrustVerdict 15 | */ 16 | class BehavioralTrustVerdict extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Output only. Probability of this transaction attempt being executed in a 20 | * behaviorally trustworthy way. Values are from 0.0 (lowest) to 1.0 21 | * (highest). 22 | * 23 | * Generated from protobuf field float trust = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 24 | */ 25 | protected $trust = 0.0; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type float $trust 34 | * Output only. Probability of this transaction attempt being executed in a 35 | * behaviorally trustworthy way. Values are from 0.0 (lowest) to 1.0 36 | * (highest). 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * Output only. Probability of this transaction attempt being executed in a 46 | * behaviorally trustworthy way. Values are from 0.0 (lowest) to 1.0 47 | * (highest). 48 | * 49 | * Generated from protobuf field float trust = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 50 | * @return float 51 | */ 52 | public function getTrust() 53 | { 54 | return $this->trust; 55 | } 56 | 57 | /** 58 | * Output only. Probability of this transaction attempt being executed in a 59 | * behaviorally trustworthy way. Values are from 0.0 (lowest) to 1.0 60 | * (highest). 61 | * 62 | * Generated from protobuf field float trust = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 63 | * @param float $var 64 | * @return $this 65 | */ 66 | public function setTrust($var) 67 | { 68 | GPBUtil::checkFloat($var); 69 | $this->trust = $var; 70 | 71 | return $this; 72 | } 73 | 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/V1/RelatedAccountGroup.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.RelatedAccountGroup 15 | */ 16 | class RelatedAccountGroup extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. Identifier. The resource name for the related account group in 20 | * the format 21 | * `projects/{project}/relatedaccountgroups/{related_account_group}`. 22 | * 23 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = REQUIRED]; 24 | */ 25 | protected $name = ''; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type string $name 34 | * Required. Identifier. The resource name for the related account group in 35 | * the format 36 | * `projects/{project}/relatedaccountgroups/{related_account_group}`. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * Required. Identifier. The resource name for the related account group in 46 | * the format 47 | * `projects/{project}/relatedaccountgroups/{related_account_group}`. 48 | * 49 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = REQUIRED]; 50 | * @return string 51 | */ 52 | public function getName() 53 | { 54 | return $this->name; 55 | } 56 | 57 | /** 58 | * Required. Identifier. The resource name for the related account group in 59 | * the format 60 | * `projects/{project}/relatedaccountgroups/{related_account_group}`. 61 | * 62 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = REQUIRED]; 63 | * @param string $var 64 | * @return $this 65 | */ 66 | public function setName($var) 67 | { 68 | GPBUtil::checkString($var, True); 69 | $this->name = $var; 70 | 71 | return $this; 72 | } 73 | 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/V1/FraudSignals/CardSignals.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FraudSignals.CardSignals 15 | */ 16 | class CardSignals extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Output only. The labels for the payment card in this transaction. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.FraudSignals.CardSignals.CardLabel card_labels = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 22 | */ 23 | private $card_labels; 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param array $data { 29 | * Optional. Data for populating the Message object. 30 | * 31 | * @type array|\Google\Protobuf\Internal\RepeatedField $card_labels 32 | * Output only. The labels for the payment card in this transaction. 33 | * } 34 | */ 35 | public function __construct($data = NULL) { 36 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 37 | parent::__construct($data); 38 | } 39 | 40 | /** 41 | * Output only. The labels for the payment card in this transaction. 42 | * 43 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.FraudSignals.CardSignals.CardLabel card_labels = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 44 | * @return \Google\Protobuf\Internal\RepeatedField 45 | */ 46 | public function getCardLabels() 47 | { 48 | return $this->card_labels; 49 | } 50 | 51 | /** 52 | * Output only. The labels for the payment card in this transaction. 53 | * 54 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.FraudSignals.CardSignals.CardLabel card_labels = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 55 | * @param array|\Google\Protobuf\Internal\RepeatedField $var 56 | * @return $this 57 | */ 58 | public function setCardLabels($var) 59 | { 60 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\RecaptchaEnterprise\V1\FraudSignals\CardSignals\CardLabel::class); 61 | $this->card_labels = $arr; 62 | 63 | return $this; 64 | } 65 | 66 | } 67 | 68 | 69 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/update_key.php: -------------------------------------------------------------------------------- 1 | setDisplayName($keyDisplayName); 44 | $request = (new UpdateKeyRequest()) 45 | ->setKey($key); 46 | 47 | // Call the API and handle any network failures. 48 | try { 49 | /** @var Key $response */ 50 | $response = $recaptchaEnterpriseServiceClient->updateKey($request); 51 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 52 | } catch (ApiException $ex) { 53 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 54 | } 55 | } 56 | 57 | /** 58 | * Helper to execute the sample. 59 | * 60 | * This sample has been automatically generated and should be regarded as a code 61 | * template only. It will require modifications to work: 62 | * - It may require correct/in-range values for request initialization. 63 | * - It may require specifying regional endpoints when creating the service client, 64 | * please see the apiEndpoint client configuration option for more details. 65 | */ 66 | function callSample(): void 67 | { 68 | $keyDisplayName = '[DISPLAY_NAME]'; 69 | 70 | update_key_sample($keyDisplayName); 71 | } 72 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_UpdateKey_sync] 73 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/delete_key.php: -------------------------------------------------------------------------------- 1 | setName($formattedName); 45 | 46 | // Call the API and handle any network failures. 47 | try { 48 | $recaptchaEnterpriseServiceClient->deleteKey($request); 49 | printf('Call completed successfully.' . PHP_EOL); 50 | } catch (ApiException $ex) { 51 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 52 | } 53 | } 54 | 55 | /** 56 | * Helper to execute the sample. 57 | * 58 | * This sample has been automatically generated and should be regarded as a code 59 | * template only. It will require modifications to work: 60 | * - It may require correct/in-range values for request initialization. 61 | * - It may require specifying regional endpoints when creating the service client, 62 | * please see the apiEndpoint client configuration option for more details. 63 | */ 64 | function callSample(): void 65 | { 66 | $formattedName = RecaptchaEnterpriseServiceClient::keyName('[PROJECT]', '[KEY]'); 67 | 68 | delete_key_sample($formattedName); 69 | } 70 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_DeleteKey_sync] 71 | -------------------------------------------------------------------------------- /src/V1/ScoreDistribution.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ScoreDistribution 15 | */ 16 | class ScoreDistribution extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Map key is score value multiplied by 100. The scores are discrete values 20 | * between [0, 1]. The maximum number of buckets is on order of a few dozen, 21 | * but typically much lower (ie. 10). 22 | * 23 | * Generated from protobuf field map score_buckets = 1; 24 | */ 25 | private $score_buckets; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type array|\Google\Protobuf\Internal\MapField $score_buckets 34 | * Map key is score value multiplied by 100. The scores are discrete values 35 | * between [0, 1]. The maximum number of buckets is on order of a few dozen, 36 | * but typically much lower (ie. 10). 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * Map key is score value multiplied by 100. The scores are discrete values 46 | * between [0, 1]. The maximum number of buckets is on order of a few dozen, 47 | * but typically much lower (ie. 10). 48 | * 49 | * Generated from protobuf field map score_buckets = 1; 50 | * @return \Google\Protobuf\Internal\MapField 51 | */ 52 | public function getScoreBuckets() 53 | { 54 | return $this->score_buckets; 55 | } 56 | 57 | /** 58 | * Map key is score value multiplied by 100. The scores are discrete values 59 | * between [0, 1]. The maximum number of buckets is on order of a few dozen, 60 | * but typically much lower (ie. 10). 61 | * 62 | * Generated from protobuf field map score_buckets = 1; 63 | * @param array|\Google\Protobuf\Internal\MapField $var 64 | * @return $this 65 | */ 66 | public function setScoreBuckets($var) 67 | { 68 | $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::INT32, \Google\Protobuf\Internal\GPBType::INT64); 69 | $this->score_buckets = $arr; 70 | 71 | return $this; 72 | } 73 | 74 | } 75 | 76 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/get_key.php: -------------------------------------------------------------------------------- 1 | setName($formattedName); 46 | 47 | // Call the API and handle any network failures. 48 | try { 49 | /** @var Key $response */ 50 | $response = $recaptchaEnterpriseServiceClient->getKey($request); 51 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 52 | } catch (ApiException $ex) { 53 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 54 | } 55 | } 56 | 57 | /** 58 | * Helper to execute the sample. 59 | * 60 | * This sample has been automatically generated and should be regarded as a code 61 | * template only. It will require modifications to work: 62 | * - It may require correct/in-range values for request initialization. 63 | * - It may require specifying regional endpoints when creating the service client, 64 | * please see the apiEndpoint client configuration option for more details. 65 | */ 66 | function callSample(): void 67 | { 68 | $formattedName = RecaptchaEnterpriseServiceClient::keyName('[PROJECT]', '[KEY]'); 69 | 70 | get_key_sample($formattedName); 71 | } 72 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetKey_sync] 73 | -------------------------------------------------------------------------------- /src/V1/GetKeyRequest.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.GetKeyRequest 15 | */ 16 | class GetKeyRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the requested key, in the format 20 | * `projects/{project}/keys/{key}`. 21 | * 22 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 23 | */ 24 | protected $name = ''; 25 | 26 | /** 27 | * @param string $name Required. The name of the requested key, in the format 28 | * `projects/{project}/keys/{key}`. Please see 29 | * {@see RecaptchaEnterpriseServiceClient::keyName()} for help formatting this field. 30 | * 31 | * @return \Google\Cloud\RecaptchaEnterprise\V1\GetKeyRequest 32 | * 33 | * @experimental 34 | */ 35 | public static function build(string $name): self 36 | { 37 | return (new self()) 38 | ->setName($name); 39 | } 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param array $data { 45 | * Optional. Data for populating the Message object. 46 | * 47 | * @type string $name 48 | * Required. The name of the requested key, in the format 49 | * `projects/{project}/keys/{key}`. 50 | * } 51 | */ 52 | public function __construct($data = NULL) { 53 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 54 | parent::__construct($data); 55 | } 56 | 57 | /** 58 | * Required. The name of the requested key, in the format 59 | * `projects/{project}/keys/{key}`. 60 | * 61 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 62 | * @return string 63 | */ 64 | public function getName() 65 | { 66 | return $this->name; 67 | } 68 | 69 | /** 70 | * Required. The name of the requested key, in the format 71 | * `projects/{project}/keys/{key}`. 72 | * 73 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 74 | * @param string $var 75 | * @return $this 76 | */ 77 | public function setName($var) 78 | { 79 | GPBUtil::checkString($var, True); 80 | $this->name = $var; 81 | 82 | return $this; 83 | } 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /src/V1/AnnotateAssessmentRequest/Annotation.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation 13 | */ 14 | class Annotation 15 | { 16 | /** 17 | * Default unspecified type. 18 | * 19 | * Generated from protobuf enum ANNOTATION_UNSPECIFIED = 0; 20 | */ 21 | const ANNOTATION_UNSPECIFIED = 0; 22 | /** 23 | * Provides information that the event turned out to be legitimate. 24 | * 25 | * Generated from protobuf enum LEGITIMATE = 1; 26 | */ 27 | const LEGITIMATE = 1; 28 | /** 29 | * Provides information that the event turned out to be fraudulent. 30 | * 31 | * Generated from protobuf enum FRAUDULENT = 2; 32 | */ 33 | const FRAUDULENT = 2; 34 | /** 35 | * Provides information that the event was related to a login event in which 36 | * the user typed the correct password. Deprecated, prefer indicating 37 | * CORRECT_PASSWORD through the reasons field instead. 38 | * 39 | * Generated from protobuf enum PASSWORD_CORRECT = 3 [deprecated = true]; 40 | */ 41 | const PASSWORD_CORRECT = 3; 42 | /** 43 | * Provides information that the event was related to a login event in which 44 | * the user typed the incorrect password. Deprecated, prefer indicating 45 | * INCORRECT_PASSWORD through the reasons field instead. 46 | * 47 | * Generated from protobuf enum PASSWORD_INCORRECT = 4 [deprecated = true]; 48 | */ 49 | const PASSWORD_INCORRECT = 4; 50 | 51 | private static $valueToName = [ 52 | self::ANNOTATION_UNSPECIFIED => 'ANNOTATION_UNSPECIFIED', 53 | self::LEGITIMATE => 'LEGITIMATE', 54 | self::FRAUDULENT => 'FRAUDULENT', 55 | self::PASSWORD_CORRECT => 'PASSWORD_CORRECT', 56 | self::PASSWORD_INCORRECT => 'PASSWORD_INCORRECT', 57 | ]; 58 | 59 | public static function name($value) 60 | { 61 | if (!isset(self::$valueToName[$value])) { 62 | throw new UnexpectedValueException(sprintf( 63 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 64 | } 65 | return self::$valueToName[$value]; 66 | } 67 | 68 | 69 | public static function value($name) 70 | { 71 | $const = __CLASS__ . '::' . strtoupper($name); 72 | if (!defined($const)) { 73 | throw new UnexpectedValueException(sprintf( 74 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 75 | } 76 | return constant($const); 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/V1/PhoneFraudAssessment.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.PhoneFraudAssessment 15 | */ 16 | class PhoneFraudAssessment extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Output only. Assessment of this phone event for risk of SMS toll fraud. 20 | * 21 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict sms_toll_fraud_verdict = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 22 | */ 23 | protected $sms_toll_fraud_verdict = null; 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param array $data { 29 | * Optional. Data for populating the Message object. 30 | * 31 | * @type \Google\Cloud\RecaptchaEnterprise\V1\SmsTollFraudVerdict $sms_toll_fraud_verdict 32 | * Output only. Assessment of this phone event for risk of SMS toll fraud. 33 | * } 34 | */ 35 | public function __construct($data = NULL) { 36 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 37 | parent::__construct($data); 38 | } 39 | 40 | /** 41 | * Output only. Assessment of this phone event for risk of SMS toll fraud. 42 | * 43 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict sms_toll_fraud_verdict = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 44 | * @return \Google\Cloud\RecaptchaEnterprise\V1\SmsTollFraudVerdict|null 45 | */ 46 | public function getSmsTollFraudVerdict() 47 | { 48 | return $this->sms_toll_fraud_verdict; 49 | } 50 | 51 | public function hasSmsTollFraudVerdict() 52 | { 53 | return isset($this->sms_toll_fraud_verdict); 54 | } 55 | 56 | public function clearSmsTollFraudVerdict() 57 | { 58 | unset($this->sms_toll_fraud_verdict); 59 | } 60 | 61 | /** 62 | * Output only. Assessment of this phone event for risk of SMS toll fraud. 63 | * 64 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict sms_toll_fraud_verdict = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 65 | * @param \Google\Cloud\RecaptchaEnterprise\V1\SmsTollFraudVerdict $var 66 | * @return $this 67 | */ 68 | public function setSmsTollFraudVerdict($var) 69 | { 70 | GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\SmsTollFraudVerdict::class); 71 | $this->sms_toll_fraud_verdict = $var; 72 | 73 | return $this; 74 | } 75 | 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/V1/DeleteKeyRequest.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.DeleteKeyRequest 15 | */ 16 | class DeleteKeyRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the key to be deleted, in the format 20 | * `projects/{project}/keys/{key}`. 21 | * 22 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 23 | */ 24 | protected $name = ''; 25 | 26 | /** 27 | * @param string $name Required. The name of the key to be deleted, in the format 28 | * `projects/{project}/keys/{key}`. Please see 29 | * {@see RecaptchaEnterpriseServiceClient::keyName()} for help formatting this field. 30 | * 31 | * @return \Google\Cloud\RecaptchaEnterprise\V1\DeleteKeyRequest 32 | * 33 | * @experimental 34 | */ 35 | public static function build(string $name): self 36 | { 37 | return (new self()) 38 | ->setName($name); 39 | } 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param array $data { 45 | * Optional. Data for populating the Message object. 46 | * 47 | * @type string $name 48 | * Required. The name of the key to be deleted, in the format 49 | * `projects/{project}/keys/{key}`. 50 | * } 51 | */ 52 | public function __construct($data = NULL) { 53 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 54 | parent::__construct($data); 55 | } 56 | 57 | /** 58 | * Required. The name of the key to be deleted, in the format 59 | * `projects/{project}/keys/{key}`. 60 | * 61 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 62 | * @return string 63 | */ 64 | public function getName() 65 | { 66 | return $this->name; 67 | } 68 | 69 | /** 70 | * Required. The name of the key to be deleted, in the format 71 | * `projects/{project}/keys/{key}`. 72 | * 73 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 74 | * @param string $var 75 | * @return $this 76 | */ 77 | public function setName($var) 78 | { 79 | GPBUtil::checkString($var, True); 80 | $this->name = $var; 81 | 82 | return $this; 83 | } 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Google Cloud Recaptcha Enterprise for PHP 2 | 3 | > Idiomatic PHP client for [Google Cloud Recaptcha Enterprise](https://cloud.google.com/recaptcha-enterprise). 4 | 5 | [![Latest Stable Version](https://poser.pugx.org/google/cloud-recaptcha-enterprise/v/stable)](https://packagist.org/packages/google/cloud-recaptcha-enterprise) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-recaptcha-enterprise.svg)](https://packagist.org/packages/google/cloud-recaptcha-enterprise) 6 | 7 | * [API documentation](https://cloud.google.com/php/docs/reference/cloud-recaptcha-enterprise/latest) 8 | 9 | **NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any 10 | support requests, bug reports, or development contributions should be directed to 11 | that project. 12 | 13 | ### Installation 14 | 15 | To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). 16 | 17 | Now install this component: 18 | 19 | ```sh 20 | $ composer require google/cloud-recaptcha-enterprise 21 | ``` 22 | 23 | This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods) 24 | please see our [gRPC installation guide](https://cloud.google.com/php/grpc). 25 | 26 | ### Authentication 27 | 28 | Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information 29 | on authenticating your client. Once authenticated, you'll be ready to start making requests. 30 | 31 | ### Sample 32 | 33 | ```php 34 | use Google\ApiCore\ApiException; 35 | use Google\Cloud\RecaptchaEnterprise\V1\Client\RecaptchaEnterpriseServiceClient; 36 | use Google\Cloud\RecaptchaEnterprise\V1\FirewallPolicy; 37 | use Google\Cloud\RecaptchaEnterprise\V1\GetFirewallPolicyRequest; 38 | 39 | // Create a client. 40 | $recaptchaEnterpriseServiceClient = new RecaptchaEnterpriseServiceClient(); 41 | 42 | // Prepare the request message. 43 | $request = (new GetFirewallPolicyRequest()) 44 | ->setName($formattedName); 45 | 46 | // Call the API and handle any network failures. 47 | try { 48 | /** @var FirewallPolicy $response */ 49 | $response = $recaptchaEnterpriseServiceClient->getFirewallPolicy($request); 50 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 51 | } catch (ApiException $ex) { 52 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 53 | } 54 | ``` 55 | 56 | ### Debugging 57 | 58 | Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md) 59 | for more information about the debugging tools. 60 | 61 | ### Version 62 | 63 | This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in 64 | any minor or patch releases. We will address issues and requests with the highest priority. 65 | 66 | ### Next Steps 67 | 68 | 1. Understand the [official documentation](https://cloud.google.com/recaptcha-enterprise/docs). 69 | -------------------------------------------------------------------------------- /src/V1/GetMetricsRequest.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.GetMetricsRequest 15 | */ 16 | class GetMetricsRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the requested metrics, in the format 20 | * `projects/{project}/keys/{key}/metrics`. 21 | * 22 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 23 | */ 24 | protected $name = ''; 25 | 26 | /** 27 | * @param string $name Required. The name of the requested metrics, in the format 28 | * `projects/{project}/keys/{key}/metrics`. Please see 29 | * {@see RecaptchaEnterpriseServiceClient::metricsName()} for help formatting this field. 30 | * 31 | * @return \Google\Cloud\RecaptchaEnterprise\V1\GetMetricsRequest 32 | * 33 | * @experimental 34 | */ 35 | public static function build(string $name): self 36 | { 37 | return (new self()) 38 | ->setName($name); 39 | } 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param array $data { 45 | * Optional. Data for populating the Message object. 46 | * 47 | * @type string $name 48 | * Required. The name of the requested metrics, in the format 49 | * `projects/{project}/keys/{key}/metrics`. 50 | * } 51 | */ 52 | public function __construct($data = NULL) { 53 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 54 | parent::__construct($data); 55 | } 56 | 57 | /** 58 | * Required. The name of the requested metrics, in the format 59 | * `projects/{project}/keys/{key}/metrics`. 60 | * 61 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 62 | * @return string 63 | */ 64 | public function getName() 65 | { 66 | return $this->name; 67 | } 68 | 69 | /** 70 | * Required. The name of the requested metrics, in the format 71 | * `projects/{project}/keys/{key}/metrics`. 72 | * 73 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 74 | * @param string $var 75 | * @return $this 76 | */ 77 | public function setName($var) 78 | { 79 | GPBUtil::checkString($var, True); 80 | $this->name = $var; 81 | 82 | return $this; 83 | } 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/delete_firewall_policy.php: -------------------------------------------------------------------------------- 1 | setName($formattedName); 45 | 46 | // Call the API and handle any network failures. 47 | try { 48 | $recaptchaEnterpriseServiceClient->deleteFirewallPolicy($request); 49 | printf('Call completed successfully.' . PHP_EOL); 50 | } catch (ApiException $ex) { 51 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 52 | } 53 | } 54 | 55 | /** 56 | * Helper to execute the sample. 57 | * 58 | * This sample has been automatically generated and should be regarded as a code 59 | * template only. It will require modifications to work: 60 | * - It may require correct/in-range values for request initialization. 61 | * - It may require specifying regional endpoints when creating the service client, 62 | * please see the apiEndpoint client configuration option for more details. 63 | */ 64 | function callSample(): void 65 | { 66 | $formattedName = RecaptchaEnterpriseServiceClient::firewallPolicyName( 67 | '[PROJECT]', 68 | '[FIREWALLPOLICY]' 69 | ); 70 | 71 | delete_firewall_policy_sample($formattedName); 72 | } 73 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_DeleteFirewallPolicy_sync] 74 | -------------------------------------------------------------------------------- /src/V1/TokenProperties/InvalidReason.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason 13 | */ 14 | class InvalidReason 15 | { 16 | /** 17 | * Default unspecified type. 18 | * 19 | * Generated from protobuf enum INVALID_REASON_UNSPECIFIED = 0; 20 | */ 21 | const INVALID_REASON_UNSPECIFIED = 0; 22 | /** 23 | * If the failure reason was not accounted for. 24 | * 25 | * Generated from protobuf enum UNKNOWN_INVALID_REASON = 1; 26 | */ 27 | const UNKNOWN_INVALID_REASON = 1; 28 | /** 29 | * The provided user verification token was malformed. 30 | * 31 | * Generated from protobuf enum MALFORMED = 2; 32 | */ 33 | const MALFORMED = 2; 34 | /** 35 | * The user verification token had expired. 36 | * 37 | * Generated from protobuf enum EXPIRED = 3; 38 | */ 39 | const EXPIRED = 3; 40 | /** 41 | * The user verification had already been seen. 42 | * 43 | * Generated from protobuf enum DUPE = 4; 44 | */ 45 | const DUPE = 4; 46 | /** 47 | * The user verification token was not present. 48 | * 49 | * Generated from protobuf enum MISSING = 5; 50 | */ 51 | const MISSING = 5; 52 | /** 53 | * A retriable error (such as network failure) occurred on the browser. 54 | * Could easily be simulated by an attacker. 55 | * 56 | * Generated from protobuf enum BROWSER_ERROR = 6; 57 | */ 58 | const BROWSER_ERROR = 6; 59 | 60 | private static $valueToName = [ 61 | self::INVALID_REASON_UNSPECIFIED => 'INVALID_REASON_UNSPECIFIED', 62 | self::UNKNOWN_INVALID_REASON => 'UNKNOWN_INVALID_REASON', 63 | self::MALFORMED => 'MALFORMED', 64 | self::EXPIRED => 'EXPIRED', 65 | self::DUPE => 'DUPE', 66 | self::MISSING => 'MISSING', 67 | self::BROWSER_ERROR => 'BROWSER_ERROR', 68 | ]; 69 | 70 | public static function name($value) 71 | { 72 | if (!isset(self::$valueToName[$value])) { 73 | throw new UnexpectedValueException(sprintf( 74 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 75 | } 76 | return self::$valueToName[$value]; 77 | } 78 | 79 | 80 | public static function value($name) 81 | { 82 | $const = __CLASS__ . '::' . strtoupper($name); 83 | if (!defined($const)) { 84 | throw new UnexpectedValueException(sprintf( 85 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 86 | } 87 | return constant($const); 88 | } 89 | } 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/V1/RetrieveLegacySecretKeyResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse 16 | */ 17 | class RetrieveLegacySecretKeyResponse extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * The secret key (also known as shared secret) authorizes communication 21 | * between your application backend and the reCAPTCHA Enterprise server to 22 | * create an assessment. 23 | * The secret key needs to be kept safe for security purposes. 24 | * 25 | * Generated from protobuf field string legacy_secret_key = 1; 26 | */ 27 | protected $legacy_secret_key = ''; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type string $legacy_secret_key 36 | * The secret key (also known as shared secret) authorizes communication 37 | * between your application backend and the reCAPTCHA Enterprise server to 38 | * create an assessment. 39 | * The secret key needs to be kept safe for security purposes. 40 | * } 41 | */ 42 | public function __construct($data = NULL) { 43 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 44 | parent::__construct($data); 45 | } 46 | 47 | /** 48 | * The secret key (also known as shared secret) authorizes communication 49 | * between your application backend and the reCAPTCHA Enterprise server to 50 | * create an assessment. 51 | * The secret key needs to be kept safe for security purposes. 52 | * 53 | * Generated from protobuf field string legacy_secret_key = 1; 54 | * @return string 55 | */ 56 | public function getLegacySecretKey() 57 | { 58 | return $this->legacy_secret_key; 59 | } 60 | 61 | /** 62 | * The secret key (also known as shared secret) authorizes communication 63 | * between your application backend and the reCAPTCHA Enterprise server to 64 | * create an assessment. 65 | * The secret key needs to be kept safe for security purposes. 66 | * 67 | * Generated from protobuf field string legacy_secret_key = 1; 68 | * @param string $var 69 | * @return $this 70 | */ 71 | public function setLegacySecretKey($var) 72 | { 73 | GPBUtil::checkString($var, True); 74 | $this->legacy_secret_key = $var; 75 | 76 | return $this; 77 | } 78 | 79 | } 80 | 81 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/get_metrics.php: -------------------------------------------------------------------------------- 1 | setName($formattedName); 47 | 48 | // Call the API and handle any network failures. 49 | try { 50 | /** @var Metrics $response */ 51 | $response = $recaptchaEnterpriseServiceClient->getMetrics($request); 52 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 53 | } catch (ApiException $ex) { 54 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 55 | } 56 | } 57 | 58 | /** 59 | * Helper to execute the sample. 60 | * 61 | * This sample has been automatically generated and should be regarded as a code 62 | * template only. It will require modifications to work: 63 | * - It may require correct/in-range values for request initialization. 64 | * - It may require specifying regional endpoints when creating the service client, 65 | * please see the apiEndpoint client configuration option for more details. 66 | */ 67 | function callSample(): void 68 | { 69 | $formattedName = RecaptchaEnterpriseServiceClient::metricsName('[PROJECT]', '[KEY]'); 70 | 71 | get_metrics_sample($formattedName); 72 | } 73 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetMetrics_sync] 74 | -------------------------------------------------------------------------------- /src/V1/AccountDefenderAssessment/AccountDefenderLabel.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel 13 | */ 14 | class AccountDefenderLabel 15 | { 16 | /** 17 | * Default unspecified type. 18 | * 19 | * Generated from protobuf enum ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0; 20 | */ 21 | const ACCOUNT_DEFENDER_LABEL_UNSPECIFIED = 0; 22 | /** 23 | * The request matches a known good profile for the user. 24 | * 25 | * Generated from protobuf enum PROFILE_MATCH = 1; 26 | */ 27 | const PROFILE_MATCH = 1; 28 | /** 29 | * The request is potentially a suspicious login event and must be further 30 | * verified either through multi-factor authentication or another system. 31 | * 32 | * Generated from protobuf enum SUSPICIOUS_LOGIN_ACTIVITY = 2; 33 | */ 34 | const SUSPICIOUS_LOGIN_ACTIVITY = 2; 35 | /** 36 | * The request matched a profile that previously had suspicious account 37 | * creation behavior. This can mean that this is a fake account. 38 | * 39 | * Generated from protobuf enum SUSPICIOUS_ACCOUNT_CREATION = 3; 40 | */ 41 | const SUSPICIOUS_ACCOUNT_CREATION = 3; 42 | /** 43 | * The account in the request has a high number of related accounts. It does 44 | * not necessarily imply that the account is bad but can require further 45 | * investigation. 46 | * 47 | * Generated from protobuf enum RELATED_ACCOUNTS_NUMBER_HIGH = 4; 48 | */ 49 | const RELATED_ACCOUNTS_NUMBER_HIGH = 4; 50 | 51 | private static $valueToName = [ 52 | self::ACCOUNT_DEFENDER_LABEL_UNSPECIFIED => 'ACCOUNT_DEFENDER_LABEL_UNSPECIFIED', 53 | self::PROFILE_MATCH => 'PROFILE_MATCH', 54 | self::SUSPICIOUS_LOGIN_ACTIVITY => 'SUSPICIOUS_LOGIN_ACTIVITY', 55 | self::SUSPICIOUS_ACCOUNT_CREATION => 'SUSPICIOUS_ACCOUNT_CREATION', 56 | self::RELATED_ACCOUNTS_NUMBER_HIGH => 'RELATED_ACCOUNTS_NUMBER_HIGH', 57 | ]; 58 | 59 | public static function name($value) 60 | { 61 | if (!isset(self::$valueToName[$value])) { 62 | throw new UnexpectedValueException(sprintf( 63 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 64 | } 65 | return self::$valueToName[$value]; 66 | } 67 | 68 | 69 | public static function value($name) 70 | { 71 | $const = __CLASS__ . '::' . strtoupper($name); 72 | if (!defined($const)) { 73 | throw new UnexpectedValueException(sprintf( 74 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 75 | } 76 | return constant($const); 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/V1/RetrieveLegacySecretKeyRequest.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest 15 | */ 16 | class RetrieveLegacySecretKeyRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The public key name linked to the requested secret key in the 20 | * format `projects/{project}/keys/{key}`. 21 | * 22 | * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 23 | */ 24 | protected $key = ''; 25 | 26 | /** 27 | * @param string $key Required. The public key name linked to the requested secret key in the 28 | * format `projects/{project}/keys/{key}`. Please see 29 | * {@see RecaptchaEnterpriseServiceClient::keyName()} for help formatting this field. 30 | * 31 | * @return \Google\Cloud\RecaptchaEnterprise\V1\RetrieveLegacySecretKeyRequest 32 | * 33 | * @experimental 34 | */ 35 | public static function build(string $key): self 36 | { 37 | return (new self()) 38 | ->setKey($key); 39 | } 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param array $data { 45 | * Optional. Data for populating the Message object. 46 | * 47 | * @type string $key 48 | * Required. The public key name linked to the requested secret key in the 49 | * format `projects/{project}/keys/{key}`. 50 | * } 51 | */ 52 | public function __construct($data = NULL) { 53 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 54 | parent::__construct($data); 55 | } 56 | 57 | /** 58 | * Required. The public key name linked to the requested secret key in the 59 | * format `projects/{project}/keys/{key}`. 60 | * 61 | * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 62 | * @return string 63 | */ 64 | public function getKey() 65 | { 66 | return $this->key; 67 | } 68 | 69 | /** 70 | * Required. The public key name linked to the requested secret key in the 71 | * format `projects/{project}/keys/{key}`. 72 | * 73 | * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 74 | * @param string $var 75 | * @return $this 76 | */ 77 | public function setKey($var) 78 | { 79 | GPBUtil::checkString($var, True); 80 | $this->key = $var; 81 | 82 | return $this; 83 | } 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /src/V1/GetFirewallPolicyRequest.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.GetFirewallPolicyRequest 15 | */ 16 | class GetFirewallPolicyRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the requested policy, in the format 20 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 21 | * 22 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 23 | */ 24 | protected $name = ''; 25 | 26 | /** 27 | * @param string $name Required. The name of the requested policy, in the format 28 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. Please see 29 | * {@see RecaptchaEnterpriseServiceClient::firewallPolicyName()} for help formatting this field. 30 | * 31 | * @return \Google\Cloud\RecaptchaEnterprise\V1\GetFirewallPolicyRequest 32 | * 33 | * @experimental 34 | */ 35 | public static function build(string $name): self 36 | { 37 | return (new self()) 38 | ->setName($name); 39 | } 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param array $data { 45 | * Optional. Data for populating the Message object. 46 | * 47 | * @type string $name 48 | * Required. The name of the requested policy, in the format 49 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 50 | * } 51 | */ 52 | public function __construct($data = NULL) { 53 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 54 | parent::__construct($data); 55 | } 56 | 57 | /** 58 | * Required. The name of the requested policy, in the format 59 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 60 | * 61 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 62 | * @return string 63 | */ 64 | public function getName() 65 | { 66 | return $this->name; 67 | } 68 | 69 | /** 70 | * Required. The name of the requested policy, in the format 71 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 72 | * 73 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 74 | * @param string $var 75 | * @return $this 76 | */ 77 | public function setName($var) 78 | { 79 | GPBUtil::checkString($var, True); 80 | $this->name = $var; 81 | 82 | return $this; 83 | } 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/get_firewall_policy.php: -------------------------------------------------------------------------------- 1 | setName($formattedName); 46 | 47 | // Call the API and handle any network failures. 48 | try { 49 | /** @var FirewallPolicy $response */ 50 | $response = $recaptchaEnterpriseServiceClient->getFirewallPolicy($request); 51 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 52 | } catch (ApiException $ex) { 53 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 54 | } 55 | } 56 | 57 | /** 58 | * Helper to execute the sample. 59 | * 60 | * This sample has been automatically generated and should be regarded as a code 61 | * template only. It will require modifications to work: 62 | * - It may require correct/in-range values for request initialization. 63 | * - It may require specifying regional endpoints when creating the service client, 64 | * please see the apiEndpoint client configuration option for more details. 65 | */ 66 | function callSample(): void 67 | { 68 | $formattedName = RecaptchaEnterpriseServiceClient::firewallPolicyName( 69 | '[PROJECT]', 70 | '[FIREWALLPOLICY]' 71 | ); 72 | 73 | get_firewall_policy_sample($formattedName); 74 | } 75 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_GetFirewallPolicy_sync] 76 | -------------------------------------------------------------------------------- /src/V1/DeleteFirewallPolicyRequest.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.DeleteFirewallPolicyRequest 15 | */ 16 | class DeleteFirewallPolicyRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the policy to be deleted, in the format 20 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 21 | * 22 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 23 | */ 24 | protected $name = ''; 25 | 26 | /** 27 | * @param string $name Required. The name of the policy to be deleted, in the format 28 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. Please see 29 | * {@see RecaptchaEnterpriseServiceClient::firewallPolicyName()} for help formatting this field. 30 | * 31 | * @return \Google\Cloud\RecaptchaEnterprise\V1\DeleteFirewallPolicyRequest 32 | * 33 | * @experimental 34 | */ 35 | public static function build(string $name): self 36 | { 37 | return (new self()) 38 | ->setName($name); 39 | } 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param array $data { 45 | * Optional. Data for populating the Message object. 46 | * 47 | * @type string $name 48 | * Required. The name of the policy to be deleted, in the format 49 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 50 | * } 51 | */ 52 | public function __construct($data = NULL) { 53 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 54 | parent::__construct($data); 55 | } 56 | 57 | /** 58 | * Required. The name of the policy to be deleted, in the format 59 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 60 | * 61 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 62 | * @return string 63 | */ 64 | public function getName() 65 | { 66 | return $this->name; 67 | } 68 | 69 | /** 70 | * Required. The name of the policy to be deleted, in the format 71 | * `projects/{project}/firewallpolicies/{firewallpolicy}`. 72 | * 73 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 74 | * @param string $var 75 | * @return $this 76 | */ 77 | public function setName($var) 78 | { 79 | GPBUtil::checkString($var, True); 80 | $this->name = $var; 81 | 82 | return $this; 83 | } 84 | 85 | } 86 | 87 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/list_keys.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent); 47 | 48 | // Call the API and handle any network failures. 49 | try { 50 | /** @var PagedListResponse $response */ 51 | $response = $recaptchaEnterpriseServiceClient->listKeys($request); 52 | 53 | /** @var Key $element */ 54 | foreach ($response as $element) { 55 | printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); 56 | } 57 | } catch (ApiException $ex) { 58 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 59 | } 60 | } 61 | 62 | /** 63 | * Helper to execute the sample. 64 | * 65 | * This sample has been automatically generated and should be regarded as a code 66 | * template only. It will require modifications to work: 67 | * - It may require correct/in-range values for request initialization. 68 | * - It may require specifying regional endpoints when creating the service client, 69 | * please see the apiEndpoint client configuration option for more details. 70 | */ 71 | function callSample(): void 72 | { 73 | $formattedParent = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 74 | 75 | list_keys_sample($formattedParent); 76 | } 77 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListKeys_sync] 78 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/create_assessment.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent) 47 | ->setAssessment($assessment); 48 | 49 | // Call the API and handle any network failures. 50 | try { 51 | /** @var Assessment $response */ 52 | $response = $recaptchaEnterpriseServiceClient->createAssessment($request); 53 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 54 | } catch (ApiException $ex) { 55 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 56 | } 57 | } 58 | 59 | /** 60 | * Helper to execute the sample. 61 | * 62 | * This sample has been automatically generated and should be regarded as a code 63 | * template only. It will require modifications to work: 64 | * - It may require correct/in-range values for request initialization. 65 | * - It may require specifying regional endpoints when creating the service client, 66 | * please see the apiEndpoint client configuration option for more details. 67 | */ 68 | function callSample(): void 69 | { 70 | $formattedParent = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 71 | 72 | create_assessment_sample($formattedParent); 73 | } 74 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateAssessment_sync] 75 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/list_ip_overrides.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent); 47 | 48 | // Call the API and handle any network failures. 49 | try { 50 | /** @var PagedListResponse $response */ 51 | $response = $recaptchaEnterpriseServiceClient->listIpOverrides($request); 52 | 53 | /** @var IpOverrideData $element */ 54 | foreach ($response as $element) { 55 | printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); 56 | } 57 | } catch (ApiException $ex) { 58 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 59 | } 60 | } 61 | 62 | /** 63 | * Helper to execute the sample. 64 | * 65 | * This sample has been automatically generated and should be regarded as a code 66 | * template only. It will require modifications to work: 67 | * - It may require correct/in-range values for request initialization. 68 | * - It may require specifying regional endpoints when creating the service client, 69 | * please see the apiEndpoint client configuration option for more details. 70 | */ 71 | function callSample(): void 72 | { 73 | $formattedParent = RecaptchaEnterpriseServiceClient::keyName('[PROJECT]', '[KEY]'); 74 | 75 | list_ip_overrides_sample($formattedParent); 76 | } 77 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListIpOverrides_sync] 78 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/create_key.php: -------------------------------------------------------------------------------- 1 | setDisplayName($keyDisplayName); 47 | $request = (new CreateKeyRequest()) 48 | ->setParent($formattedParent) 49 | ->setKey($key); 50 | 51 | // Call the API and handle any network failures. 52 | try { 53 | /** @var Key $response */ 54 | $response = $recaptchaEnterpriseServiceClient->createKey($request); 55 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 56 | } catch (ApiException $ex) { 57 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 58 | } 59 | } 60 | 61 | /** 62 | * Helper to execute the sample. 63 | * 64 | * This sample has been automatically generated and should be regarded as a code 65 | * template only. It will require modifications to work: 66 | * - It may require correct/in-range values for request initialization. 67 | * - It may require specifying regional endpoints when creating the service client, 68 | * please see the apiEndpoint client configuration option for more details. 69 | */ 70 | function callSample(): void 71 | { 72 | $formattedParent = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 73 | $keyDisplayName = '[DISPLAY_NAME]'; 74 | 75 | create_key_sample($formattedParent, $keyDisplayName); 76 | } 77 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateKey_sync] 78 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/retrieve_legacy_secret_key.php: -------------------------------------------------------------------------------- 1 | setKey($formattedKey); 48 | 49 | // Call the API and handle any network failures. 50 | try { 51 | /** @var RetrieveLegacySecretKeyResponse $response */ 52 | $response = $recaptchaEnterpriseServiceClient->retrieveLegacySecretKey($request); 53 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 54 | } catch (ApiException $ex) { 55 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 56 | } 57 | } 58 | 59 | /** 60 | * Helper to execute the sample. 61 | * 62 | * This sample has been automatically generated and should be regarded as a code 63 | * template only. It will require modifications to work: 64 | * - It may require correct/in-range values for request initialization. 65 | * - It may require specifying regional endpoints when creating the service client, 66 | * please see the apiEndpoint client configuration option for more details. 67 | */ 68 | function callSample(): void 69 | { 70 | $formattedKey = RecaptchaEnterpriseServiceClient::keyName('[PROJECT]', '[KEY]'); 71 | 72 | retrieve_legacy_secret_key_sample($formattedKey); 73 | } 74 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_RetrieveLegacySecretKey_sync] 75 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/list_firewall_policies.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent); 47 | 48 | // Call the API and handle any network failures. 49 | try { 50 | /** @var PagedListResponse $response */ 51 | $response = $recaptchaEnterpriseServiceClient->listFirewallPolicies($request); 52 | 53 | /** @var FirewallPolicy $element */ 54 | foreach ($response as $element) { 55 | printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); 56 | } 57 | } catch (ApiException $ex) { 58 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 59 | } 60 | } 61 | 62 | /** 63 | * Helper to execute the sample. 64 | * 65 | * This sample has been automatically generated and should be regarded as a code 66 | * template only. It will require modifications to work: 67 | * - It may require correct/in-range values for request initialization. 68 | * - It may require specifying regional endpoints when creating the service client, 69 | * please see the apiEndpoint client configuration option for more details. 70 | */ 71 | function callSample(): void 72 | { 73 | $formattedParent = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 74 | 75 | list_firewall_policies_sample($formattedParent); 76 | } 77 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListFirewallPolicies_sync] 78 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/list_related_account_groups.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent); 47 | 48 | // Call the API and handle any network failures. 49 | try { 50 | /** @var PagedListResponse $response */ 51 | $response = $recaptchaEnterpriseServiceClient->listRelatedAccountGroups($request); 52 | 53 | /** @var RelatedAccountGroup $element */ 54 | foreach ($response as $element) { 55 | printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); 56 | } 57 | } catch (ApiException $ex) { 58 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 59 | } 60 | } 61 | 62 | /** 63 | * Helper to execute the sample. 64 | * 65 | * This sample has been automatically generated and should be regarded as a code 66 | * template only. It will require modifications to work: 67 | * - It may require correct/in-range values for request initialization. 68 | * - It may require specifying regional endpoints when creating the service client, 69 | * please see the apiEndpoint client configuration option for more details. 70 | */ 71 | function callSample(): void 72 | { 73 | $formattedParent = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 74 | 75 | list_related_account_groups_sample($formattedParent); 76 | } 77 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroups_sync] 78 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/create_firewall_policy.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent) 49 | ->setFirewallPolicy($firewallPolicy); 50 | 51 | // Call the API and handle any network failures. 52 | try { 53 | /** @var FirewallPolicy $response */ 54 | $response = $recaptchaEnterpriseServiceClient->createFirewallPolicy($request); 55 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 56 | } catch (ApiException $ex) { 57 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 58 | } 59 | } 60 | 61 | /** 62 | * Helper to execute the sample. 63 | * 64 | * This sample has been automatically generated and should be regarded as a code 65 | * template only. It will require modifications to work: 66 | * - It may require correct/in-range values for request initialization. 67 | * - It may require specifying regional endpoints when creating the service client, 68 | * please see the apiEndpoint client configuration option for more details. 69 | */ 70 | function callSample(): void 71 | { 72 | $formattedParent = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 73 | 74 | create_firewall_policy_sample($formattedParent); 75 | } 76 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_CreateFirewallPolicy_sync] 77 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/migrate_key.php: -------------------------------------------------------------------------------- 1 | setName($formattedName); 51 | 52 | // Call the API and handle any network failures. 53 | try { 54 | /** @var Key $response */ 55 | $response = $recaptchaEnterpriseServiceClient->migrateKey($request); 56 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 57 | } catch (ApiException $ex) { 58 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 59 | } 60 | } 61 | 62 | /** 63 | * Helper to execute the sample. 64 | * 65 | * This sample has been automatically generated and should be regarded as a code 66 | * template only. It will require modifications to work: 67 | * - It may require correct/in-range values for request initialization. 68 | * - It may require specifying regional endpoints when creating the service client, 69 | * please see the apiEndpoint client configuration option for more details. 70 | */ 71 | function callSample(): void 72 | { 73 | $formattedName = RecaptchaEnterpriseServiceClient::keyName('[PROJECT]', '[KEY]'); 74 | 75 | migrate_key_sample($formattedName); 76 | } 77 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_MigrateKey_sync] 78 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/list_related_account_group_memberships.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent); 47 | 48 | // Call the API and handle any network failures. 49 | try { 50 | /** @var PagedListResponse $response */ 51 | $response = $recaptchaEnterpriseServiceClient->listRelatedAccountGroupMemberships($request); 52 | 53 | /** @var RelatedAccountGroupMembership $element */ 54 | foreach ($response as $element) { 55 | printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); 56 | } 57 | } catch (ApiException $ex) { 58 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 59 | } 60 | } 61 | 62 | /** 63 | * Helper to execute the sample. 64 | * 65 | * This sample has been automatically generated and should be regarded as a code 66 | * template only. It will require modifications to work: 67 | * - It may require correct/in-range values for request initialization. 68 | * - It may require specifying regional endpoints when creating the service client, 69 | * please see the apiEndpoint client configuration option for more details. 70 | */ 71 | function callSample(): void 72 | { 73 | $formattedParent = RecaptchaEnterpriseServiceClient::relatedAccountGroupName( 74 | '[PROJECT]', 75 | '[RELATEDACCOUNTGROUP]' 76 | ); 77 | 78 | list_related_account_group_memberships_sample($formattedParent); 79 | } 80 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ListRelatedAccountGroupMemberships_sync] 81 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/search_related_account_group_memberships.php: -------------------------------------------------------------------------------- 1 | setProject($formattedProject); 48 | 49 | // Call the API and handle any network failures. 50 | try { 51 | /** @var PagedListResponse $response */ 52 | $response = $recaptchaEnterpriseServiceClient->searchRelatedAccountGroupMemberships($request); 53 | 54 | /** @var RelatedAccountGroupMembership $element */ 55 | foreach ($response as $element) { 56 | printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); 57 | } 58 | } catch (ApiException $ex) { 59 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 60 | } 61 | } 62 | 63 | /** 64 | * Helper to execute the sample. 65 | * 66 | * This sample has been automatically generated and should be regarded as a code 67 | * template only. It will require modifications to work: 68 | * - It may require correct/in-range values for request initialization. 69 | * - It may require specifying regional endpoints when creating the service client, 70 | * please see the apiEndpoint client configuration option for more details. 71 | */ 72 | function callSample(): void 73 | { 74 | $formattedProject = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 75 | 76 | search_related_account_group_memberships_sample($formattedProject); 77 | } 78 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_SearchRelatedAccountGroupMemberships_sync] 79 | -------------------------------------------------------------------------------- /src/V1/FirewallAction/SetHeaderAction.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FirewallAction.SetHeaderAction 17 | */ 18 | class SetHeaderAction extends \Google\Protobuf\Internal\Message 19 | { 20 | /** 21 | * Optional. The header key to set in the request to the backend server. 22 | * 23 | * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = OPTIONAL]; 24 | */ 25 | protected $key = ''; 26 | /** 27 | * Optional. The header value to set in the request to the backend server. 28 | * 29 | * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = OPTIONAL]; 30 | */ 31 | protected $value = ''; 32 | 33 | /** 34 | * Constructor. 35 | * 36 | * @param array $data { 37 | * Optional. Data for populating the Message object. 38 | * 39 | * @type string $key 40 | * Optional. The header key to set in the request to the backend server. 41 | * @type string $value 42 | * Optional. The header value to set in the request to the backend server. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * Optional. The header key to set in the request to the backend server. 52 | * 53 | * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = OPTIONAL]; 54 | * @return string 55 | */ 56 | public function getKey() 57 | { 58 | return $this->key; 59 | } 60 | 61 | /** 62 | * Optional. The header key to set in the request to the backend server. 63 | * 64 | * Generated from protobuf field string key = 1 [(.google.api.field_behavior) = OPTIONAL]; 65 | * @param string $var 66 | * @return $this 67 | */ 68 | public function setKey($var) 69 | { 70 | GPBUtil::checkString($var, True); 71 | $this->key = $var; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * Optional. The header value to set in the request to the backend server. 78 | * 79 | * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = OPTIONAL]; 80 | * @return string 81 | */ 82 | public function getValue() 83 | { 84 | return $this->value; 85 | } 86 | 87 | /** 88 | * Optional. The header value to set in the request to the backend server. 89 | * 90 | * Generated from protobuf field string value = 2 [(.google.api.field_behavior) = OPTIONAL]; 91 | * @param string $var 92 | * @return $this 93 | */ 94 | public function setValue($var) 95 | { 96 | GPBUtil::checkString($var, True); 97 | $this->value = $var; 98 | 99 | return $this; 100 | } 101 | 102 | } 103 | 104 | 105 | -------------------------------------------------------------------------------- /src/V1/ListKeysResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ListKeysResponse 15 | */ 16 | class ListKeysResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Key details. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.Key keys = 1; 22 | */ 23 | private $keys; 24 | /** 25 | * Token to retrieve the next page of results. It is set to empty if no keys 26 | * remain in results. 27 | * 28 | * Generated from protobuf field string next_page_token = 2; 29 | */ 30 | protected $next_page_token = ''; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type array<\Google\Cloud\RecaptchaEnterprise\V1\Key>|\Google\Protobuf\Internal\RepeatedField $keys 39 | * Key details. 40 | * @type string $next_page_token 41 | * Token to retrieve the next page of results. It is set to empty if no keys 42 | * remain in results. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * Key details. 52 | * 53 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.Key keys = 1; 54 | * @return \Google\Protobuf\Internal\RepeatedField 55 | */ 56 | public function getKeys() 57 | { 58 | return $this->keys; 59 | } 60 | 61 | /** 62 | * Key details. 63 | * 64 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.Key keys = 1; 65 | * @param array<\Google\Cloud\RecaptchaEnterprise\V1\Key>|\Google\Protobuf\Internal\RepeatedField $var 66 | * @return $this 67 | */ 68 | public function setKeys($var) 69 | { 70 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\RecaptchaEnterprise\V1\Key::class); 71 | $this->keys = $arr; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * Token to retrieve the next page of results. It is set to empty if no keys 78 | * remain in results. 79 | * 80 | * Generated from protobuf field string next_page_token = 2; 81 | * @return string 82 | */ 83 | public function getNextPageToken() 84 | { 85 | return $this->next_page_token; 86 | } 87 | 88 | /** 89 | * Token to retrieve the next page of results. It is set to empty if no keys 90 | * remain in results. 91 | * 92 | * Generated from protobuf field string next_page_token = 2; 93 | * @param string $var 94 | * @return $this 95 | */ 96 | public function setNextPageToken($var) 97 | { 98 | GPBUtil::checkString($var, True); 99 | $this->next_page_token = $var; 100 | 101 | return $this; 102 | } 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/annotate_assessment.php: -------------------------------------------------------------------------------- 1 | setName($formattedName) 51 | ->setAnnotation($annotation); 52 | 53 | // Call the API and handle any network failures. 54 | try { 55 | /** @var AnnotateAssessmentResponse $response */ 56 | $response = $recaptchaEnterpriseServiceClient->annotateAssessment($request); 57 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 58 | } catch (ApiException $ex) { 59 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 60 | } 61 | } 62 | 63 | /** 64 | * Helper to execute the sample. 65 | * 66 | * This sample has been automatically generated and should be regarded as a code 67 | * template only. It will require modifications to work: 68 | * - It may require correct/in-range values for request initialization. 69 | * - It may require specifying regional endpoints when creating the service client, 70 | * please see the apiEndpoint client configuration option for more details. 71 | */ 72 | function callSample(): void 73 | { 74 | $formattedName = RecaptchaEnterpriseServiceClient::assessmentName('[PROJECT]', '[ASSESSMENT]'); 75 | $annotation = Annotation::ANNOTATION_UNSPECIFIED; 76 | 77 | annotate_assessment_sample($formattedName, $annotation); 78 | } 79 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_AnnotateAssessment_sync] 80 | -------------------------------------------------------------------------------- /src/V1/RiskAnalysis/ClassificationReason.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason 13 | */ 14 | class ClassificationReason 15 | { 16 | /** 17 | * Default unspecified type. 18 | * 19 | * Generated from protobuf enum CLASSIFICATION_REASON_UNSPECIFIED = 0; 20 | */ 21 | const CLASSIFICATION_REASON_UNSPECIFIED = 0; 22 | /** 23 | * Interactions matched the behavior of an automated agent. 24 | * 25 | * Generated from protobuf enum AUTOMATION = 1; 26 | */ 27 | const AUTOMATION = 1; 28 | /** 29 | * The event originated from an illegitimate environment. 30 | * 31 | * Generated from protobuf enum UNEXPECTED_ENVIRONMENT = 2; 32 | */ 33 | const UNEXPECTED_ENVIRONMENT = 2; 34 | /** 35 | * Traffic volume from the event source is higher than normal. 36 | * 37 | * Generated from protobuf enum TOO_MUCH_TRAFFIC = 3; 38 | */ 39 | const TOO_MUCH_TRAFFIC = 3; 40 | /** 41 | * Interactions with the site were significantly different than expected 42 | * patterns. 43 | * 44 | * Generated from protobuf enum UNEXPECTED_USAGE_PATTERNS = 4; 45 | */ 46 | const UNEXPECTED_USAGE_PATTERNS = 4; 47 | /** 48 | * Too little traffic has been received from this site thus far to generate 49 | * quality risk analysis. 50 | * 51 | * Generated from protobuf enum LOW_CONFIDENCE_SCORE = 5; 52 | */ 53 | const LOW_CONFIDENCE_SCORE = 5; 54 | /** 55 | * The request matches behavioral characteristics of a carding attack. 56 | * 57 | * Generated from protobuf enum SUSPECTED_CARDING = 6; 58 | */ 59 | const SUSPECTED_CARDING = 6; 60 | /** 61 | * The request matches behavioral characteristics of chargebacks for fraud. 62 | * 63 | * Generated from protobuf enum SUSPECTED_CHARGEBACK = 7; 64 | */ 65 | const SUSPECTED_CHARGEBACK = 7; 66 | 67 | private static $valueToName = [ 68 | self::CLASSIFICATION_REASON_UNSPECIFIED => 'CLASSIFICATION_REASON_UNSPECIFIED', 69 | self::AUTOMATION => 'AUTOMATION', 70 | self::UNEXPECTED_ENVIRONMENT => 'UNEXPECTED_ENVIRONMENT', 71 | self::TOO_MUCH_TRAFFIC => 'TOO_MUCH_TRAFFIC', 72 | self::UNEXPECTED_USAGE_PATTERNS => 'UNEXPECTED_USAGE_PATTERNS', 73 | self::LOW_CONFIDENCE_SCORE => 'LOW_CONFIDENCE_SCORE', 74 | self::SUSPECTED_CARDING => 'SUSPECTED_CARDING', 75 | self::SUSPECTED_CHARGEBACK => 'SUSPECTED_CHARGEBACK', 76 | ]; 77 | 78 | public static function name($value) 79 | { 80 | if (!isset(self::$valueToName[$value])) { 81 | throw new UnexpectedValueException(sprintf( 82 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 83 | } 84 | return self::$valueToName[$value]; 85 | } 86 | 87 | 88 | public static function value($name) 89 | { 90 | $const = __CLASS__ . '::' . strtoupper($name); 91 | if (!defined($const)) { 92 | throw new UnexpectedValueException(sprintf( 93 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 94 | } 95 | return constant($const); 96 | } 97 | } 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/V1/ListIpOverridesResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ListIpOverridesResponse 15 | */ 16 | class ListIpOverridesResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * IP Overrides details. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.IpOverrideData ip_overrides = 1; 22 | */ 23 | private $ip_overrides; 24 | /** 25 | * Token to retrieve the next page of results. If this field is empty, no keys 26 | * remain in the results. 27 | * 28 | * Generated from protobuf field string next_page_token = 2; 29 | */ 30 | protected $next_page_token = ''; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type array<\Google\Cloud\RecaptchaEnterprise\V1\IpOverrideData>|\Google\Protobuf\Internal\RepeatedField $ip_overrides 39 | * IP Overrides details. 40 | * @type string $next_page_token 41 | * Token to retrieve the next page of results. If this field is empty, no keys 42 | * remain in the results. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * IP Overrides details. 52 | * 53 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.IpOverrideData ip_overrides = 1; 54 | * @return \Google\Protobuf\Internal\RepeatedField 55 | */ 56 | public function getIpOverrides() 57 | { 58 | return $this->ip_overrides; 59 | } 60 | 61 | /** 62 | * IP Overrides details. 63 | * 64 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.IpOverrideData ip_overrides = 1; 65 | * @param array<\Google\Cloud\RecaptchaEnterprise\V1\IpOverrideData>|\Google\Protobuf\Internal\RepeatedField $var 66 | * @return $this 67 | */ 68 | public function setIpOverrides($var) 69 | { 70 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\RecaptchaEnterprise\V1\IpOverrideData::class); 71 | $this->ip_overrides = $arr; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * Token to retrieve the next page of results. If this field is empty, no keys 78 | * remain in the results. 79 | * 80 | * Generated from protobuf field string next_page_token = 2; 81 | * @return string 82 | */ 83 | public function getNextPageToken() 84 | { 85 | return $this->next_page_token; 86 | } 87 | 88 | /** 89 | * Token to retrieve the next page of results. If this field is empty, no keys 90 | * remain in the results. 91 | * 92 | * Generated from protobuf field string next_page_token = 2; 93 | * @param string $var 94 | * @return $this 95 | */ 96 | public function setNextPageToken($var) 97 | { 98 | GPBUtil::checkString($var, True); 99 | $this->next_page_token = $var; 100 | 101 | return $this; 102 | } 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/reorder_firewall_policies.php: -------------------------------------------------------------------------------- 1 | setParent($formattedParent) 52 | ->setNames($formattedNames); 53 | 54 | // Call the API and handle any network failures. 55 | try { 56 | /** @var ReorderFirewallPoliciesResponse $response */ 57 | $response = $recaptchaEnterpriseServiceClient->reorderFirewallPolicies($request); 58 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 59 | } catch (ApiException $ex) { 60 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 61 | } 62 | } 63 | 64 | /** 65 | * Helper to execute the sample. 66 | * 67 | * This sample has been automatically generated and should be regarded as a code 68 | * template only. It will require modifications to work: 69 | * - It may require correct/in-range values for request initialization. 70 | * - It may require specifying regional endpoints when creating the service client, 71 | * please see the apiEndpoint client configuration option for more details. 72 | */ 73 | function callSample(): void 74 | { 75 | $formattedParent = RecaptchaEnterpriseServiceClient::projectName('[PROJECT]'); 76 | $formattedNamesElement = RecaptchaEnterpriseServiceClient::firewallPolicyName( 77 | '[PROJECT]', 78 | '[FIREWALLPOLICY]' 79 | ); 80 | 81 | reorder_firewall_policies_sample($formattedParent, $formattedNamesElement); 82 | } 83 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_ReorderFirewallPolicies_sync] 84 | -------------------------------------------------------------------------------- /src/V1/WafSettings.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.WafSettings 16 | */ 17 | class WafSettings extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The WAF service that uses this key. 21 | * 22 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.WafSettings.WafService waf_service = 1 [(.google.api.field_behavior) = REQUIRED]; 23 | */ 24 | protected $waf_service = 0; 25 | /** 26 | * Required. The WAF feature for which this key is enabled. 27 | * 28 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature waf_feature = 2 [(.google.api.field_behavior) = REQUIRED]; 29 | */ 30 | protected $waf_feature = 0; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type int $waf_service 39 | * Required. The WAF service that uses this key. 40 | * @type int $waf_feature 41 | * Required. The WAF feature for which this key is enabled. 42 | * } 43 | */ 44 | public function __construct($data = NULL) { 45 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 46 | parent::__construct($data); 47 | } 48 | 49 | /** 50 | * Required. The WAF service that uses this key. 51 | * 52 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.WafSettings.WafService waf_service = 1 [(.google.api.field_behavior) = REQUIRED]; 53 | * @return int 54 | */ 55 | public function getWafService() 56 | { 57 | return $this->waf_service; 58 | } 59 | 60 | /** 61 | * Required. The WAF service that uses this key. 62 | * 63 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.WafSettings.WafService waf_service = 1 [(.google.api.field_behavior) = REQUIRED]; 64 | * @param int $var 65 | * @return $this 66 | */ 67 | public function setWafService($var) 68 | { 69 | GPBUtil::checkEnum($var, \Google\Cloud\RecaptchaEnterprise\V1\WafSettings\WafService::class); 70 | $this->waf_service = $var; 71 | 72 | return $this; 73 | } 74 | 75 | /** 76 | * Required. The WAF feature for which this key is enabled. 77 | * 78 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature waf_feature = 2 [(.google.api.field_behavior) = REQUIRED]; 79 | * @return int 80 | */ 81 | public function getWafFeature() 82 | { 83 | return $this->waf_feature; 84 | } 85 | 86 | /** 87 | * Required. The WAF feature for which this key is enabled. 88 | * 89 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature waf_feature = 2 [(.google.api.field_behavior) = REQUIRED]; 90 | * @param int $var 91 | * @return $this 92 | */ 93 | public function setWafFeature($var) 94 | { 95 | GPBUtil::checkEnum($var, \Google\Cloud\RecaptchaEnterprise\V1\WafSettings\WafFeature::class); 96 | $this->waf_feature = $var; 97 | 98 | return $this; 99 | } 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /src/V1/ListFirewallPoliciesResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ListFirewallPoliciesResponse 15 | */ 16 | class ListFirewallPoliciesResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Policy details. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.FirewallPolicy firewall_policies = 1; 22 | */ 23 | private $firewall_policies; 24 | /** 25 | * Token to retrieve the next page of results. It is set to empty if no 26 | * policies remain in results. 27 | * 28 | * Generated from protobuf field string next_page_token = 2; 29 | */ 30 | protected $next_page_token = ''; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type array<\Google\Cloud\RecaptchaEnterprise\V1\FirewallPolicy>|\Google\Protobuf\Internal\RepeatedField $firewall_policies 39 | * Policy details. 40 | * @type string $next_page_token 41 | * Token to retrieve the next page of results. It is set to empty if no 42 | * policies remain in results. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * Policy details. 52 | * 53 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.FirewallPolicy firewall_policies = 1; 54 | * @return \Google\Protobuf\Internal\RepeatedField 55 | */ 56 | public function getFirewallPolicies() 57 | { 58 | return $this->firewall_policies; 59 | } 60 | 61 | /** 62 | * Policy details. 63 | * 64 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.FirewallPolicy firewall_policies = 1; 65 | * @param array<\Google\Cloud\RecaptchaEnterprise\V1\FirewallPolicy>|\Google\Protobuf\Internal\RepeatedField $var 66 | * @return $this 67 | */ 68 | public function setFirewallPolicies($var) 69 | { 70 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\RecaptchaEnterprise\V1\FirewallPolicy::class); 71 | $this->firewall_policies = $arr; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * Token to retrieve the next page of results. It is set to empty if no 78 | * policies remain in results. 79 | * 80 | * Generated from protobuf field string next_page_token = 2; 81 | * @return string 82 | */ 83 | public function getNextPageToken() 84 | { 85 | return $this->next_page_token; 86 | } 87 | 88 | /** 89 | * Token to retrieve the next page of results. It is set to empty if no 90 | * policies remain in results. 91 | * 92 | * Generated from protobuf field string next_page_token = 2; 93 | * @param string $var 94 | * @return $this 95 | */ 96 | public function setNextPageToken($var) 97 | { 98 | GPBUtil::checkString($var, True); 99 | $this->next_page_token = $var; 100 | 101 | return $this; 102 | } 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /src/V1/SmsTollFraudVerdict.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict 15 | */ 16 | class SmsTollFraudVerdict extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Output only. Probability of an SMS event being fraudulent. 20 | * Values are from 0.0 (lowest) to 1.0 (highest). 21 | * 22 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 23 | */ 24 | protected $risk = 0.0; 25 | /** 26 | * Output only. Reasons contributing to the SMS toll fraud verdict. 27 | * 28 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict.SmsTollFraudReason reasons = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; 29 | */ 30 | private $reasons; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type float $risk 39 | * Output only. Probability of an SMS event being fraudulent. 40 | * Values are from 0.0 (lowest) to 1.0 (highest). 41 | * @type array|\Google\Protobuf\Internal\RepeatedField $reasons 42 | * Output only. Reasons contributing to the SMS toll fraud verdict. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * Output only. Probability of an SMS event being fraudulent. 52 | * Values are from 0.0 (lowest) to 1.0 (highest). 53 | * 54 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 55 | * @return float 56 | */ 57 | public function getRisk() 58 | { 59 | return $this->risk; 60 | } 61 | 62 | /** 63 | * Output only. Probability of an SMS event being fraudulent. 64 | * Values are from 0.0 (lowest) to 1.0 (highest). 65 | * 66 | * Generated from protobuf field float risk = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 67 | * @param float $var 68 | * @return $this 69 | */ 70 | public function setRisk($var) 71 | { 72 | GPBUtil::checkFloat($var); 73 | $this->risk = $var; 74 | 75 | return $this; 76 | } 77 | 78 | /** 79 | * Output only. Reasons contributing to the SMS toll fraud verdict. 80 | * 81 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict.SmsTollFraudReason reasons = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; 82 | * @return \Google\Protobuf\Internal\RepeatedField 83 | */ 84 | public function getReasons() 85 | { 86 | return $this->reasons; 87 | } 88 | 89 | /** 90 | * Output only. Reasons contributing to the SMS toll fraud verdict. 91 | * 92 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict.SmsTollFraudReason reasons = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; 93 | * @param array|\Google\Protobuf\Internal\RepeatedField $var 94 | * @return $this 95 | */ 96 | public function setReasons($var) 97 | { 98 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\RecaptchaEnterprise\V1\SmsTollFraudVerdict\SmsTollFraudReason::class); 99 | $this->reasons = $arr; 100 | 101 | return $this; 102 | } 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /src/V1/ListRelatedAccountGroupsResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse 15 | */ 16 | class ListRelatedAccountGroupsResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * The groups of related accounts listed by the query. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroup related_account_groups = 1; 22 | */ 23 | private $related_account_groups; 24 | /** 25 | * A token, which can be sent as `page_token` to retrieve the next page. 26 | * If this field is omitted, there are no subsequent pages. 27 | * 28 | * Generated from protobuf field string next_page_token = 2; 29 | */ 30 | protected $next_page_token = ''; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type array<\Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroup>|\Google\Protobuf\Internal\RepeatedField $related_account_groups 39 | * The groups of related accounts listed by the query. 40 | * @type string $next_page_token 41 | * A token, which can be sent as `page_token` to retrieve the next page. 42 | * If this field is omitted, there are no subsequent pages. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * The groups of related accounts listed by the query. 52 | * 53 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroup related_account_groups = 1; 54 | * @return \Google\Protobuf\Internal\RepeatedField 55 | */ 56 | public function getRelatedAccountGroups() 57 | { 58 | return $this->related_account_groups; 59 | } 60 | 61 | /** 62 | * The groups of related accounts listed by the query. 63 | * 64 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroup related_account_groups = 1; 65 | * @param array<\Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroup>|\Google\Protobuf\Internal\RepeatedField $var 66 | * @return $this 67 | */ 68 | public function setRelatedAccountGroups($var) 69 | { 70 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroup::class); 71 | $this->related_account_groups = $arr; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * A token, which can be sent as `page_token` to retrieve the next page. 78 | * If this field is omitted, there are no subsequent pages. 79 | * 80 | * Generated from protobuf field string next_page_token = 2; 81 | * @return string 82 | */ 83 | public function getNextPageToken() 84 | { 85 | return $this->next_page_token; 86 | } 87 | 88 | /** 89 | * A token, which can be sent as `page_token` to retrieve the next page. 90 | * If this field is omitted, there are no subsequent pages. 91 | * 92 | * Generated from protobuf field string next_page_token = 2; 93 | * @param string $var 94 | * @return $this 95 | */ 96 | public function setNextPageToken($var) 97 | { 98 | GPBUtil::checkString($var, True); 99 | $this->next_page_token = $var; 100 | 101 | return $this; 102 | } 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /src/V1/SearchRelatedAccountGroupMembershipsResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse 15 | */ 16 | class SearchRelatedAccountGroupMembershipsResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * The queried memberships. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership related_account_group_memberships = 1; 22 | */ 23 | private $related_account_group_memberships; 24 | /** 25 | * A token, which can be sent as `page_token` to retrieve the next page. 26 | * If this field is omitted, there are no subsequent pages. 27 | * 28 | * Generated from protobuf field string next_page_token = 2; 29 | */ 30 | protected $next_page_token = ''; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type array<\Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroupMembership>|\Google\Protobuf\Internal\RepeatedField $related_account_group_memberships 39 | * The queried memberships. 40 | * @type string $next_page_token 41 | * A token, which can be sent as `page_token` to retrieve the next page. 42 | * If this field is omitted, there are no subsequent pages. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * The queried memberships. 52 | * 53 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership related_account_group_memberships = 1; 54 | * @return \Google\Protobuf\Internal\RepeatedField 55 | */ 56 | public function getRelatedAccountGroupMemberships() 57 | { 58 | return $this->related_account_group_memberships; 59 | } 60 | 61 | /** 62 | * The queried memberships. 63 | * 64 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership related_account_group_memberships = 1; 65 | * @param array<\Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroupMembership>|\Google\Protobuf\Internal\RepeatedField $var 66 | * @return $this 67 | */ 68 | public function setRelatedAccountGroupMemberships($var) 69 | { 70 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroupMembership::class); 71 | $this->related_account_group_memberships = $arr; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * A token, which can be sent as `page_token` to retrieve the next page. 78 | * If this field is omitted, there are no subsequent pages. 79 | * 80 | * Generated from protobuf field string next_page_token = 2; 81 | * @return string 82 | */ 83 | public function getNextPageToken() 84 | { 85 | return $this->next_page_token; 86 | } 87 | 88 | /** 89 | * A token, which can be sent as `page_token` to retrieve the next page. 90 | * If this field is omitted, there are no subsequent pages. 91 | * 92 | * Generated from protobuf field string next_page_token = 2; 93 | * @param string $var 94 | * @return $this 95 | */ 96 | public function setNextPageToken($var) 97 | { 98 | GPBUtil::checkString($var, True); 99 | $this->next_page_token = $var; 100 | 101 | return $this; 102 | } 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /src/V1/ListRelatedAccountGroupMembershipsResponse.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse 15 | */ 16 | class ListRelatedAccountGroupMembershipsResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * The memberships listed by the query. 20 | * 21 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership related_account_group_memberships = 1; 22 | */ 23 | private $related_account_group_memberships; 24 | /** 25 | * A token, which can be sent as `page_token` to retrieve the next page. 26 | * If this field is omitted, there are no subsequent pages. 27 | * 28 | * Generated from protobuf field string next_page_token = 2; 29 | */ 30 | protected $next_page_token = ''; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type array<\Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroupMembership>|\Google\Protobuf\Internal\RepeatedField $related_account_group_memberships 39 | * The memberships listed by the query. 40 | * @type string $next_page_token 41 | * A token, which can be sent as `page_token` to retrieve the next page. 42 | * If this field is omitted, there are no subsequent pages. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * The memberships listed by the query. 52 | * 53 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership related_account_group_memberships = 1; 54 | * @return \Google\Protobuf\Internal\RepeatedField 55 | */ 56 | public function getRelatedAccountGroupMemberships() 57 | { 58 | return $this->related_account_group_memberships; 59 | } 60 | 61 | /** 62 | * The memberships listed by the query. 63 | * 64 | * Generated from protobuf field repeated .google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership related_account_group_memberships = 1; 65 | * @param array<\Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroupMembership>|\Google\Protobuf\Internal\RepeatedField $var 66 | * @return $this 67 | */ 68 | public function setRelatedAccountGroupMemberships($var) 69 | { 70 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\RecaptchaEnterprise\V1\RelatedAccountGroupMembership::class); 71 | $this->related_account_group_memberships = $arr; 72 | 73 | return $this; 74 | } 75 | 76 | /** 77 | * A token, which can be sent as `page_token` to retrieve the next page. 78 | * If this field is omitted, there are no subsequent pages. 79 | * 80 | * Generated from protobuf field string next_page_token = 2; 81 | * @return string 82 | */ 83 | public function getNextPageToken() 84 | { 85 | return $this->next_page_token; 86 | } 87 | 88 | /** 89 | * A token, which can be sent as `page_token` to retrieve the next page. 90 | * If this field is omitted, there are no subsequent pages. 91 | * 92 | * Generated from protobuf field string next_page_token = 2; 93 | * @param string $var 94 | * @return $this 95 | */ 96 | public function setNextPageToken($var) 97 | { 98 | GPBUtil::checkString($var, True); 99 | $this->next_page_token = $var; 100 | 101 | return $this; 102 | } 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /src/V1/ScoreMetrics.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.ScoreMetrics 15 | */ 16 | class ScoreMetrics extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Aggregated score metrics for all traffic. 20 | * 21 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.ScoreDistribution overall_metrics = 1; 22 | */ 23 | protected $overall_metrics = null; 24 | /** 25 | * Action-based metrics. The map key is the action name which specified by the 26 | * site owners at time of the "execute" client-side call. 27 | * 28 | * Generated from protobuf field map action_metrics = 2; 29 | */ 30 | private $action_metrics; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type \Google\Cloud\RecaptchaEnterprise\V1\ScoreDistribution $overall_metrics 39 | * Aggregated score metrics for all traffic. 40 | * @type array|\Google\Protobuf\Internal\MapField $action_metrics 41 | * Action-based metrics. The map key is the action name which specified by the 42 | * site owners at time of the "execute" client-side call. 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * Aggregated score metrics for all traffic. 52 | * 53 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.ScoreDistribution overall_metrics = 1; 54 | * @return \Google\Cloud\RecaptchaEnterprise\V1\ScoreDistribution|null 55 | */ 56 | public function getOverallMetrics() 57 | { 58 | return $this->overall_metrics; 59 | } 60 | 61 | public function hasOverallMetrics() 62 | { 63 | return isset($this->overall_metrics); 64 | } 65 | 66 | public function clearOverallMetrics() 67 | { 68 | unset($this->overall_metrics); 69 | } 70 | 71 | /** 72 | * Aggregated score metrics for all traffic. 73 | * 74 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.ScoreDistribution overall_metrics = 1; 75 | * @param \Google\Cloud\RecaptchaEnterprise\V1\ScoreDistribution $var 76 | * @return $this 77 | */ 78 | public function setOverallMetrics($var) 79 | { 80 | GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\ScoreDistribution::class); 81 | $this->overall_metrics = $var; 82 | 83 | return $this; 84 | } 85 | 86 | /** 87 | * Action-based metrics. The map key is the action name which specified by the 88 | * site owners at time of the "execute" client-side call. 89 | * 90 | * Generated from protobuf field map action_metrics = 2; 91 | * @return \Google\Protobuf\Internal\MapField 92 | */ 93 | public function getActionMetrics() 94 | { 95 | return $this->action_metrics; 96 | } 97 | 98 | /** 99 | * Action-based metrics. The map key is the action name which specified by the 100 | * site owners at time of the "execute" client-side call. 101 | * 102 | * Generated from protobuf field map action_metrics = 2; 103 | * @param array|\Google\Protobuf\Internal\MapField $var 104 | * @return $this 105 | */ 106 | public function setActionMetrics($var) 107 | { 108 | $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\RecaptchaEnterprise\V1\ScoreDistribution::class); 109 | $this->action_metrics = $arr; 110 | 111 | return $this; 112 | } 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /samples/V1/RecaptchaEnterpriseServiceClient/add_ip_override.php: -------------------------------------------------------------------------------- 1 | setIp($ipOverrideDataIp) 62 | ->setOverrideType($ipOverrideDataOverrideType); 63 | $request = (new AddIpOverrideRequest()) 64 | ->setName($formattedName) 65 | ->setIpOverrideData($ipOverrideData); 66 | 67 | // Call the API and handle any network failures. 68 | try { 69 | /** @var AddIpOverrideResponse $response */ 70 | $response = $recaptchaEnterpriseServiceClient->addIpOverride($request); 71 | printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); 72 | } catch (ApiException $ex) { 73 | printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); 74 | } 75 | } 76 | 77 | /** 78 | * Helper to execute the sample. 79 | * 80 | * This sample has been automatically generated and should be regarded as a code 81 | * template only. It will require modifications to work: 82 | * - It may require correct/in-range values for request initialization. 83 | * - It may require specifying regional endpoints when creating the service client, 84 | * please see the apiEndpoint client configuration option for more details. 85 | */ 86 | function callSample(): void 87 | { 88 | $formattedName = RecaptchaEnterpriseServiceClient::keyName('[PROJECT]', '[KEY]'); 89 | $ipOverrideDataIp = '[IP]'; 90 | $ipOverrideDataOverrideType = OverrideType::OVERRIDE_TYPE_UNSPECIFIED; 91 | 92 | add_ip_override_sample($formattedName, $ipOverrideDataIp, $ipOverrideDataOverrideType); 93 | } 94 | // [END recaptchaenterprise_v1_generated_RecaptchaEnterpriseService_AddIpOverride_sync] 95 | -------------------------------------------------------------------------------- /src/V1/FraudSignals/UserSignals.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.FraudSignals.UserSignals 15 | */ 16 | class UserSignals extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Output only. This user (based on email, phone, and other identifiers) has 20 | * been seen on the internet for at least this number of days. 21 | * 22 | * Generated from protobuf field int32 active_days_lower_bound = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 23 | */ 24 | protected $active_days_lower_bound = 0; 25 | /** 26 | * Output only. Likelihood (from 0.0 to 1.0) this user includes synthetic 27 | * components in their identity, such as a randomly generated email address, 28 | * temporary phone number, or fake shipping address. 29 | * 30 | * Generated from protobuf field float synthetic_risk = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; 31 | */ 32 | protected $synthetic_risk = 0.0; 33 | 34 | /** 35 | * Constructor. 36 | * 37 | * @param array $data { 38 | * Optional. Data for populating the Message object. 39 | * 40 | * @type int $active_days_lower_bound 41 | * Output only. This user (based on email, phone, and other identifiers) has 42 | * been seen on the internet for at least this number of days. 43 | * @type float $synthetic_risk 44 | * Output only. Likelihood (from 0.0 to 1.0) this user includes synthetic 45 | * components in their identity, such as a randomly generated email address, 46 | * temporary phone number, or fake shipping address. 47 | * } 48 | */ 49 | public function __construct($data = NULL) { 50 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 51 | parent::__construct($data); 52 | } 53 | 54 | /** 55 | * Output only. This user (based on email, phone, and other identifiers) has 56 | * been seen on the internet for at least this number of days. 57 | * 58 | * Generated from protobuf field int32 active_days_lower_bound = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 59 | * @return int 60 | */ 61 | public function getActiveDaysLowerBound() 62 | { 63 | return $this->active_days_lower_bound; 64 | } 65 | 66 | /** 67 | * Output only. This user (based on email, phone, and other identifiers) has 68 | * been seen on the internet for at least this number of days. 69 | * 70 | * Generated from protobuf field int32 active_days_lower_bound = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; 71 | * @param int $var 72 | * @return $this 73 | */ 74 | public function setActiveDaysLowerBound($var) 75 | { 76 | GPBUtil::checkInt32($var); 77 | $this->active_days_lower_bound = $var; 78 | 79 | return $this; 80 | } 81 | 82 | /** 83 | * Output only. Likelihood (from 0.0 to 1.0) this user includes synthetic 84 | * components in their identity, such as a randomly generated email address, 85 | * temporary phone number, or fake shipping address. 86 | * 87 | * Generated from protobuf field float synthetic_risk = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; 88 | * @return float 89 | */ 90 | public function getSyntheticRisk() 91 | { 92 | return $this->synthetic_risk; 93 | } 94 | 95 | /** 96 | * Output only. Likelihood (from 0.0 to 1.0) this user includes synthetic 97 | * components in their identity, such as a randomly generated email address, 98 | * temporary phone number, or fake shipping address. 99 | * 100 | * Generated from protobuf field float synthetic_risk = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; 101 | * @param float $var 102 | * @return $this 103 | */ 104 | public function setSyntheticRisk($var) 105 | { 106 | GPBUtil::checkFloat($var); 107 | $this->synthetic_risk = $var; 108 | 109 | return $this; 110 | } 111 | 112 | } 113 | 114 | 115 | -------------------------------------------------------------------------------- /src/V1/TestingOptions.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.TestingOptions 15 | */ 16 | class TestingOptions extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Optional. All assessments for this Key return this score. Must be between 0 20 | * (likely not legitimate) and 1 (likely legitimate) inclusive. 21 | * 22 | * Generated from protobuf field float testing_score = 1 [(.google.api.field_behavior) = OPTIONAL]; 23 | */ 24 | protected $testing_score = 0.0; 25 | /** 26 | * Optional. For challenge-based keys only (CHECKBOX, INVISIBLE), all 27 | * challenge requests for this site return nocaptcha if NOCAPTCHA, or an 28 | * unsolvable challenge if CHALLENGE. 29 | * 30 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge testing_challenge = 2 [(.google.api.field_behavior) = OPTIONAL]; 31 | */ 32 | protected $testing_challenge = 0; 33 | 34 | /** 35 | * Constructor. 36 | * 37 | * @param array $data { 38 | * Optional. Data for populating the Message object. 39 | * 40 | * @type float $testing_score 41 | * Optional. All assessments for this Key return this score. Must be between 0 42 | * (likely not legitimate) and 1 (likely legitimate) inclusive. 43 | * @type int $testing_challenge 44 | * Optional. For challenge-based keys only (CHECKBOX, INVISIBLE), all 45 | * challenge requests for this site return nocaptcha if NOCAPTCHA, or an 46 | * unsolvable challenge if CHALLENGE. 47 | * } 48 | */ 49 | public function __construct($data = NULL) { 50 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 51 | parent::__construct($data); 52 | } 53 | 54 | /** 55 | * Optional. All assessments for this Key return this score. Must be between 0 56 | * (likely not legitimate) and 1 (likely legitimate) inclusive. 57 | * 58 | * Generated from protobuf field float testing_score = 1 [(.google.api.field_behavior) = OPTIONAL]; 59 | * @return float 60 | */ 61 | public function getTestingScore() 62 | { 63 | return $this->testing_score; 64 | } 65 | 66 | /** 67 | * Optional. All assessments for this Key return this score. Must be between 0 68 | * (likely not legitimate) and 1 (likely legitimate) inclusive. 69 | * 70 | * Generated from protobuf field float testing_score = 1 [(.google.api.field_behavior) = OPTIONAL]; 71 | * @param float $var 72 | * @return $this 73 | */ 74 | public function setTestingScore($var) 75 | { 76 | GPBUtil::checkFloat($var); 77 | $this->testing_score = $var; 78 | 79 | return $this; 80 | } 81 | 82 | /** 83 | * Optional. For challenge-based keys only (CHECKBOX, INVISIBLE), all 84 | * challenge requests for this site return nocaptcha if NOCAPTCHA, or an 85 | * unsolvable challenge if CHALLENGE. 86 | * 87 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge testing_challenge = 2 [(.google.api.field_behavior) = OPTIONAL]; 88 | * @return int 89 | */ 90 | public function getTestingChallenge() 91 | { 92 | return $this->testing_challenge; 93 | } 94 | 95 | /** 96 | * Optional. For challenge-based keys only (CHECKBOX, INVISIBLE), all 97 | * challenge requests for this site return nocaptcha if NOCAPTCHA, or an 98 | * unsolvable challenge if CHALLENGE. 99 | * 100 | * Generated from protobuf field .google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge testing_challenge = 2 [(.google.api.field_behavior) = OPTIONAL]; 101 | * @param int $var 102 | * @return $this 103 | */ 104 | public function setTestingChallenge($var) 105 | { 106 | GPBUtil::checkEnum($var, \Google\Cloud\RecaptchaEnterprise\V1\TestingOptions\TestingChallenge::class); 107 | $this->testing_challenge = $var; 108 | 109 | return $this; 110 | } 111 | 112 | } 113 | 114 | -------------------------------------------------------------------------------- /src/V1/UserId.php: -------------------------------------------------------------------------------- 1 | google.cloud.recaptchaenterprise.v1.UserId 15 | */ 16 | class UserId extends \Google\Protobuf\Internal\Message 17 | { 18 | protected $id_oneof; 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * @type string $email 27 | * Optional. An email address. 28 | * @type string $phone_number 29 | * Optional. A phone number. Should use the E.164 format. 30 | * @type string $username 31 | * Optional. A unique username, if different from all the other identifiers 32 | * and `account_id` that are provided. Can be a unique login handle or 33 | * display name for a user. 34 | * } 35 | */ 36 | public function __construct($data = NULL) { 37 | \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce(); 38 | parent::__construct($data); 39 | } 40 | 41 | /** 42 | * Optional. An email address. 43 | * 44 | * Generated from protobuf field string email = 1 [(.google.api.field_behavior) = OPTIONAL]; 45 | * @return string 46 | */ 47 | public function getEmail() 48 | { 49 | return $this->readOneof(1); 50 | } 51 | 52 | public function hasEmail() 53 | { 54 | return $this->hasOneof(1); 55 | } 56 | 57 | /** 58 | * Optional. An email address. 59 | * 60 | * Generated from protobuf field string email = 1 [(.google.api.field_behavior) = OPTIONAL]; 61 | * @param string $var 62 | * @return $this 63 | */ 64 | public function setEmail($var) 65 | { 66 | GPBUtil::checkString($var, True); 67 | $this->writeOneof(1, $var); 68 | 69 | return $this; 70 | } 71 | 72 | /** 73 | * Optional. A phone number. Should use the E.164 format. 74 | * 75 | * Generated from protobuf field string phone_number = 2 [(.google.api.field_behavior) = OPTIONAL]; 76 | * @return string 77 | */ 78 | public function getPhoneNumber() 79 | { 80 | return $this->readOneof(2); 81 | } 82 | 83 | public function hasPhoneNumber() 84 | { 85 | return $this->hasOneof(2); 86 | } 87 | 88 | /** 89 | * Optional. A phone number. Should use the E.164 format. 90 | * 91 | * Generated from protobuf field string phone_number = 2 [(.google.api.field_behavior) = OPTIONAL]; 92 | * @param string $var 93 | * @return $this 94 | */ 95 | public function setPhoneNumber($var) 96 | { 97 | GPBUtil::checkString($var, True); 98 | $this->writeOneof(2, $var); 99 | 100 | return $this; 101 | } 102 | 103 | /** 104 | * Optional. A unique username, if different from all the other identifiers 105 | * and `account_id` that are provided. Can be a unique login handle or 106 | * display name for a user. 107 | * 108 | * Generated from protobuf field string username = 3 [(.google.api.field_behavior) = OPTIONAL]; 109 | * @return string 110 | */ 111 | public function getUsername() 112 | { 113 | return $this->readOneof(3); 114 | } 115 | 116 | public function hasUsername() 117 | { 118 | return $this->hasOneof(3); 119 | } 120 | 121 | /** 122 | * Optional. A unique username, if different from all the other identifiers 123 | * and `account_id` that are provided. Can be a unique login handle or 124 | * display name for a user. 125 | * 126 | * Generated from protobuf field string username = 3 [(.google.api.field_behavior) = OPTIONAL]; 127 | * @param string $var 128 | * @return $this 129 | */ 130 | public function setUsername($var) 131 | { 132 | GPBUtil::checkString($var, True); 133 | $this->writeOneof(3, $var); 134 | 135 | return $this; 136 | } 137 | 138 | /** 139 | * @return string 140 | */ 141 | public function getIdOneof() 142 | { 143 | return $this->whichOneof("id_oneof"); 144 | } 145 | 146 | } 147 | 148 | --------------------------------------------------------------------------------