#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateAssessmentRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub assessment: ::core::option::Option<Assessment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateAssessmentRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration = "annotate_assessment_request::Annotation", tag = "2")]
pub annotation: i32,
}
pub mod annotate_assessment_request {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Annotation {
Unspecified = 0,
Legitimate = 1,
Fraudulent = 2,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateAssessmentResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Assessment {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub event: ::core::option::Option<Event>,
#[prost(float, tag = "3")]
pub score: f32,
#[prost(message, optional, tag = "4")]
pub token_properties: ::core::option::Option<TokenProperties>,
#[prost(
enumeration = "assessment::ClassificationReason",
repeated,
packed = "false",
tag = "5"
)]
pub reasons: ::prost::alloc::vec::Vec<i32>,
}
pub mod assessment {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ClassificationReason {
Unspecified = 0,
Automation = 1,
UnexpectedEnvironment = 2,
TooMuchTraffic = 3,
UnexpectedUsagePatterns = 4,
LowConfidenceScore = 5,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Event {
#[prost(string, tag = "1")]
pub token: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub site_key: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub user_agent: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub user_ip_address: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub expected_action: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TokenProperties {
#[prost(bool, tag = "1")]
pub valid: bool,
#[prost(enumeration = "token_properties::InvalidReason", tag = "2")]
pub invalid_reason: i32,
#[prost(message, optional, tag = "3")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "4")]
pub hostname: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub action: ::prost::alloc::string::String,
}
pub mod token_properties {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InvalidReason {
Unspecified = 0,
UnknownInvalidReason = 1,
Malformed = 2,
Expired = 3,
Dupe = 4,
SiteMismatch = 5,
Missing = 6,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateKeyRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub key: ::core::option::Option<Key>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListKeysRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListKeysResponse {
#[prost(message, repeated, tag = "1")]
pub keys: ::prost::alloc::vec::Vec<Key>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetKeyRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateKeyRequest {
#[prost(message, optional, tag = "1")]
pub key: ::core::option::Option<Key>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteKeyRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Key {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(oneof = "key::PlatformSettings", tags = "3, 4, 5")]
pub platform_settings: ::core::option::Option<key::PlatformSettings>,
}
pub mod key {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum PlatformSettings {
#[prost(message, tag = "3")]
WebSettings(super::WebKeySettings),
#[prost(message, tag = "4")]
AndroidSettings(super::AndroidKeySettings),
#[prost(message, tag = "5")]
IosSettings(super::IosKeySettings),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebKeySettings {
#[prost(bool, tag = "3")]
pub enforce_allowed_domains: bool,
#[prost(string, repeated, tag = "1")]
pub allowed_domains: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "2")]
pub allow_amp_traffic: bool,
#[prost(enumeration = "web_key_settings::IntegrationType", tag = "4")]
pub integration_type: i32,
#[prost(enumeration = "web_key_settings::ChallengeSecurityPreference", tag = "5")]
pub challenge_security_preference: i32,
}
pub mod web_key_settings {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum IntegrationType {
Unspecified = 0,
ScoreOnly = 1,
CheckboxChallenge = 2,
InvisibleChallenge = 3,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ChallengeSecurityPreference {
Unspecified = 0,
Usability = 1,
Balanced = 2,
Security = 3,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AndroidKeySettings {
#[prost(string, repeated, tag = "1")]
pub allowed_package_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IosKeySettings {
#[prost(string, repeated, tag = "1")]
pub allowed_bundle_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[doc = r" Generated client implementations."]
pub mod recaptcha_enterprise_service_v1_beta1_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Service to determine the likelihood an event is legitimate."]
#[derive(Debug, Clone)]
pub struct RecaptchaEnterpriseServiceV1Beta1Client<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> RecaptchaEnterpriseServiceV1Beta1Client<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> RecaptchaEnterpriseServiceV1Beta1Client<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
RecaptchaEnterpriseServiceV1Beta1Client::new(InterceptedService::new(
inner,
interceptor,
))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Creates an Assessment of the likelihood an event is legitimate."]
pub async fn create_assessment(
&mut self,
request: impl tonic::IntoRequest<super::CreateAssessmentRequest>,
) -> Result<tonic::Response<super::Assessment>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1/CreateAssessment") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Annotates a previously created Assessment to provide additional information"]
#[doc = " on whether the event turned out to be authentic or fradulent."]
pub async fn annotate_assessment(
&mut self,
request: impl tonic::IntoRequest<super::AnnotateAssessmentRequest>,
) -> Result<tonic::Response<super::AnnotateAssessmentResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1/AnnotateAssessment") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new reCAPTCHA Enterprise key."]
pub async fn create_key(
&mut self,
request: impl tonic::IntoRequest<super::CreateKeyRequest>,
) -> Result<tonic::Response<super::Key>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1/CreateKey") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the list of all keys that belong to a project."]
pub async fn list_keys(
&mut self,
request: impl tonic::IntoRequest<super::ListKeysRequest>,
) -> Result<tonic::Response<super::ListKeysResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1/ListKeys") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns the specified key."]
pub async fn get_key(
&mut self,
request: impl tonic::IntoRequest<super::GetKeyRequest>,
) -> Result<tonic::Response<super::Key>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1/GetKey") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates the specified key."]
pub async fn update_key(
&mut self,
request: impl tonic::IntoRequest<super::UpdateKeyRequest>,
) -> Result<tonic::Response<super::Key>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1/UpdateKey") ;
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes the specified key."]
pub async fn delete_key(
&mut self,
request: impl tonic::IntoRequest<super::DeleteKeyRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http :: uri :: PathAndQuery :: from_static ("/google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1/DeleteKey") ;
self.inner.unary(request.into_request(), path, codec).await
}
}
}