#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConsentTransactionRequest {
#[prost(string, tag = "1")]
pub transaction_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConsentTransactionResponse {
#[prost(message, optional, tag = "1")]
pub client: ::core::option::Option<ConsentClient>,
#[prost(message, optional, tag = "2")]
pub redirect: ::core::option::Option<RedirectTarget>,
#[prost(message, repeated, tag = "3")]
pub requested_access: ::prost::alloc::vec::Vec<RequestedAccess>,
#[prost(message, repeated, tag = "4")]
pub organizations: ::prost::alloc::vec::Vec<ConsentOrganization>,
#[prost(string, optional, tag = "5")]
pub suggested_organization_rid: ::core::option::Option<
::prost::alloc::string::String,
>,
#[prost(message, optional, tag = "6")]
pub expires_at: ::core::option::Option<
super::super::super::super::google::protobuf::Timestamp,
>,
#[prost(enumeration = "ConsentVariant", tag = "7")]
pub variant: i32,
#[prost(enumeration = "SuggestionReason", tag = "8")]
pub suggestion_reason: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConsentClient {
#[prost(string, tag = "1")]
pub client_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(enumeration = "ClientRegistration", tag = "3")]
pub registration: i32,
#[prost(enumeration = "ClientVerification", tag = "4")]
pub verification: i32,
#[prost(string, optional, tag = "5")]
pub client_id_host: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RedirectTarget {
#[prost(string, tag = "1")]
pub host: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub is_loopback: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestedAccess {
#[prost(string, tag = "1")]
pub scope: ::prost::alloc::string::String,
#[prost(string, optional, tag = "2")]
pub resource: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConsentOrganization {
#[prost(string, tag = "1")]
pub organization_rid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DecideConsentTransactionRequest {
#[prost(string, tag = "1")]
pub transaction_id: ::prost::alloc::string::String,
#[prost(oneof = "decide_consent_transaction_request::Decision", tags = "2, 3")]
pub decision: ::core::option::Option<decide_consent_transaction_request::Decision>,
}
pub mod decide_consent_transaction_request {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Accept {
#[prost(string, tag = "1")]
pub organization_rid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Deny {}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Decision {
#[prost(message, tag = "2")]
Accept(Accept),
#[prost(message, tag = "3")]
Deny(Deny),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DecideConsentTransactionResponse {
#[prost(string, tag = "1")]
pub redirect_uri: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ConsentVariant {
Unspecified = 0,
AuthorizeClient = 1,
ChooseOrganization = 2,
}
impl ConsentVariant {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CONSENT_VARIANT_UNSPECIFIED",
Self::AuthorizeClient => "CONSENT_VARIANT_AUTHORIZE_CLIENT",
Self::ChooseOrganization => "CONSENT_VARIANT_CHOOSE_ORGANIZATION",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CONSENT_VARIANT_UNSPECIFIED" => Some(Self::Unspecified),
"CONSENT_VARIANT_AUTHORIZE_CLIENT" => Some(Self::AuthorizeClient),
"CONSENT_VARIANT_CHOOSE_ORGANIZATION" => Some(Self::ChooseOrganization),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SuggestionReason {
Unspecified = 0,
LastUsed = 1,
Default = 2,
}
impl SuggestionReason {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "SUGGESTION_REASON_UNSPECIFIED",
Self::LastUsed => "SUGGESTION_REASON_LAST_USED",
Self::Default => "SUGGESTION_REASON_DEFAULT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SUGGESTION_REASON_UNSPECIFIED" => Some(Self::Unspecified),
"SUGGESTION_REASON_LAST_USED" => Some(Self::LastUsed),
"SUGGESTION_REASON_DEFAULT" => Some(Self::Default),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ClientRegistration {
Unspecified = 0,
FirstParty = 1,
MetadataDocument = 2,
Dynamic = 3,
}
impl ClientRegistration {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CLIENT_REGISTRATION_UNSPECIFIED",
Self::FirstParty => "CLIENT_REGISTRATION_FIRST_PARTY",
Self::MetadataDocument => "CLIENT_REGISTRATION_METADATA_DOCUMENT",
Self::Dynamic => "CLIENT_REGISTRATION_DYNAMIC",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CLIENT_REGISTRATION_UNSPECIFIED" => Some(Self::Unspecified),
"CLIENT_REGISTRATION_FIRST_PARTY" => Some(Self::FirstParty),
"CLIENT_REGISTRATION_METADATA_DOCUMENT" => Some(Self::MetadataDocument),
"CLIENT_REGISTRATION_DYNAMIC" => Some(Self::Dynamic),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ClientVerification {
Unspecified = 0,
Verified = 1,
Unverified = 2,
}
impl ClientVerification {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CLIENT_VERIFICATION_UNSPECIFIED",
Self::Verified => "CLIENT_VERIFICATION_VERIFIED",
Self::Unverified => "CLIENT_VERIFICATION_UNVERIFIED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CLIENT_VERIFICATION_UNSPECIFIED" => Some(Self::Unspecified),
"CLIENT_VERIFICATION_VERIFIED" => Some(Self::Verified),
"CLIENT_VERIFICATION_UNVERIFIED" => Some(Self::Unverified),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ConsentError {
Unspecified = 0,
TransactionNotFound = 1,
UserMismatch = 2,
SessionNotAllowed = 3,
OrganizationNotAllowed = 4,
}
impl ConsentError {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "CONSENT_ERROR_UNSPECIFIED",
Self::TransactionNotFound => "CONSENT_ERROR_TRANSACTION_NOT_FOUND",
Self::UserMismatch => "CONSENT_ERROR_USER_MISMATCH",
Self::SessionNotAllowed => "CONSENT_ERROR_SESSION_NOT_ALLOWED",
Self::OrganizationNotAllowed => "CONSENT_ERROR_ORGANIZATION_NOT_ALLOWED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CONSENT_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
"CONSENT_ERROR_TRANSACTION_NOT_FOUND" => Some(Self::TransactionNotFound),
"CONSENT_ERROR_USER_MISMATCH" => Some(Self::UserMismatch),
"CONSENT_ERROR_SESSION_NOT_ALLOWED" => Some(Self::SessionNotAllowed),
"CONSENT_ERROR_ORGANIZATION_NOT_ALLOWED" => {
Some(Self::OrganizationNotAllowed)
}
_ => None,
}
}
}
pub mod o_auth_consent_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct OAuthConsentServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl OAuthConsentServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> OAuthConsentServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> OAuthConsentServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
OAuthConsentServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_consent_transaction(
&mut self,
request: impl tonic::IntoRequest<super::GetConsentTransactionRequest>,
) -> std::result::Result<
tonic::Response<super::GetConsentTransactionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authentication.oauth.v1.OAuthConsentService/GetConsentTransaction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authentication.oauth.v1.OAuthConsentService",
"GetConsentTransaction",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn decide_consent_transaction(
&mut self,
request: impl tonic::IntoRequest<super::DecideConsentTransactionRequest>,
) -> std::result::Result<
tonic::Response<super::DecideConsentTransactionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authentication.oauth.v1.OAuthConsentService/DecideConsentTransaction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authentication.oauth.v1.OAuthConsentService",
"DecideConsentTransaction",
),
);
self.inner.unary(req, path, codec).await
}
}
}