zitadel-with-serde 0.1.1-alpha.6

An implementation of ZITADEL API access and authentication in Rust. Now with support for serde for easy JSON serialization and deserialization.
Documentation
// @generated
// This file is @generated by prost-build.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthRequest {
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    #[prost(message, optional, tag="2")]
    pub creation_date: ::core::option::Option<::pbjson_types::Timestamp>,
    #[prost(string, tag="3")]
    pub client_id: ::prost::alloc::string::String,
    #[prost(string, repeated, tag="4")]
    pub scope: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(string, tag="5")]
    pub redirect_uri: ::prost::alloc::string::String,
    #[prost(enumeration="Prompt", repeated, packed="false", tag="6")]
    pub prompt: ::prost::alloc::vec::Vec<i32>,
    #[prost(string, repeated, tag="7")]
    pub ui_locales: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(string, optional, tag="8")]
    pub login_hint: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, optional, tag="9")]
    pub max_age: ::core::option::Option<::pbjson_types::Duration>,
    #[prost(string, optional, tag="10")]
    pub hint_user_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthorizationError {
    #[prost(enumeration="ErrorReason", tag="1")]
    pub error: i32,
    #[prost(string, optional, tag="2")]
    pub error_description: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag="3")]
    pub error_uri: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeviceAuthorizationRequest {
    /// The unique identifier of the device authorization request to be used for authorizing or denying the request.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// The client_id of the application that initiated the device authorization request.
    #[prost(string, tag="2")]
    pub client_id: ::prost::alloc::string::String,
    /// The scopes requested by the application.
    #[prost(string, repeated, tag="3")]
    pub scope: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Name of the client application.
    #[prost(string, tag="4")]
    pub app_name: ::prost::alloc::string::String,
    /// Name of the project the client application is part of.
    #[prost(string, tag="5")]
    pub project_name: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Prompt {
    Unspecified = 0,
    None = 1,
    Login = 2,
    Consent = 3,
    SelectAccount = 4,
    Create = 5,
}
impl Prompt {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "PROMPT_UNSPECIFIED",
            Self::None => "PROMPT_NONE",
            Self::Login => "PROMPT_LOGIN",
            Self::Consent => "PROMPT_CONSENT",
            Self::SelectAccount => "PROMPT_SELECT_ACCOUNT",
            Self::Create => "PROMPT_CREATE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "PROMPT_UNSPECIFIED" => Some(Self::Unspecified),
            "PROMPT_NONE" => Some(Self::None),
            "PROMPT_LOGIN" => Some(Self::Login),
            "PROMPT_CONSENT" => Some(Self::Consent),
            "PROMPT_SELECT_ACCOUNT" => Some(Self::SelectAccount),
            "PROMPT_CREATE" => Some(Self::Create),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ErrorReason {
    Unspecified = 0,
    /// Error states from <https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2.1>
    InvalidRequest = 1,
    UnauthorizedClient = 2,
    AccessDenied = 3,
    UnsupportedResponseType = 4,
    InvalidScope = 5,
    ServerError = 6,
    TemporaryUnavailable = 7,
    /// Error states from <https://openid.net/specs/openid-connect-core-1_0.html#AuthError>
    InteractionRequired = 8,
    LoginRequired = 9,
    AccountSelectionRequired = 10,
    ConsentRequired = 11,
    InvalidRequestUri = 12,
    InvalidRequestObject = 13,
    RequestNotSupported = 14,
    RequestUriNotSupported = 15,
    RegistrationNotSupported = 16,
}
impl ErrorReason {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ERROR_REASON_UNSPECIFIED",
            Self::InvalidRequest => "ERROR_REASON_INVALID_REQUEST",
            Self::UnauthorizedClient => "ERROR_REASON_UNAUTHORIZED_CLIENT",
            Self::AccessDenied => "ERROR_REASON_ACCESS_DENIED",
            Self::UnsupportedResponseType => "ERROR_REASON_UNSUPPORTED_RESPONSE_TYPE",
            Self::InvalidScope => "ERROR_REASON_INVALID_SCOPE",
            Self::ServerError => "ERROR_REASON_SERVER_ERROR",
            Self::TemporaryUnavailable => "ERROR_REASON_TEMPORARY_UNAVAILABLE",
            Self::InteractionRequired => "ERROR_REASON_INTERACTION_REQUIRED",
            Self::LoginRequired => "ERROR_REASON_LOGIN_REQUIRED",
            Self::AccountSelectionRequired => "ERROR_REASON_ACCOUNT_SELECTION_REQUIRED",
            Self::ConsentRequired => "ERROR_REASON_CONSENT_REQUIRED",
            Self::InvalidRequestUri => "ERROR_REASON_INVALID_REQUEST_URI",
            Self::InvalidRequestObject => "ERROR_REASON_INVALID_REQUEST_OBJECT",
            Self::RequestNotSupported => "ERROR_REASON_REQUEST_NOT_SUPPORTED",
            Self::RequestUriNotSupported => "ERROR_REASON_REQUEST_URI_NOT_SUPPORTED",
            Self::RegistrationNotSupported => "ERROR_REASON_REGISTRATION_NOT_SUPPORTED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ERROR_REASON_UNSPECIFIED" => Some(Self::Unspecified),
            "ERROR_REASON_INVALID_REQUEST" => Some(Self::InvalidRequest),
            "ERROR_REASON_UNAUTHORIZED_CLIENT" => Some(Self::UnauthorizedClient),
            "ERROR_REASON_ACCESS_DENIED" => Some(Self::AccessDenied),
            "ERROR_REASON_UNSUPPORTED_RESPONSE_TYPE" => Some(Self::UnsupportedResponseType),
            "ERROR_REASON_INVALID_SCOPE" => Some(Self::InvalidScope),
            "ERROR_REASON_SERVER_ERROR" => Some(Self::ServerError),
            "ERROR_REASON_TEMPORARY_UNAVAILABLE" => Some(Self::TemporaryUnavailable),
            "ERROR_REASON_INTERACTION_REQUIRED" => Some(Self::InteractionRequired),
            "ERROR_REASON_LOGIN_REQUIRED" => Some(Self::LoginRequired),
            "ERROR_REASON_ACCOUNT_SELECTION_REQUIRED" => Some(Self::AccountSelectionRequired),
            "ERROR_REASON_CONSENT_REQUIRED" => Some(Self::ConsentRequired),
            "ERROR_REASON_INVALID_REQUEST_URI" => Some(Self::InvalidRequestUri),
            "ERROR_REASON_INVALID_REQUEST_OBJECT" => Some(Self::InvalidRequestObject),
            "ERROR_REASON_REQUEST_NOT_SUPPORTED" => Some(Self::RequestNotSupported),
            "ERROR_REASON_REQUEST_URI_NOT_SUPPORTED" => Some(Self::RequestUriNotSupported),
            "ERROR_REASON_REGISTRATION_NOT_SUPPORTED" => Some(Self::RegistrationNotSupported),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAuthRequestRequest {
    #[prost(string, tag="1")]
    pub auth_request_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAuthRequestResponse {
    #[prost(message, optional, tag="1")]
    pub auth_request: ::core::option::Option<AuthRequest>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCallbackRequest {
    #[prost(string, tag="1")]
    pub auth_request_id: ::prost::alloc::string::String,
    #[prost(oneof="create_callback_request::CallbackKind", tags="2, 3")]
    pub callback_kind: ::core::option::Option<create_callback_request::CallbackKind>,
}
/// Nested message and enum types in `CreateCallbackRequest`.
pub mod create_callback_request {
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum CallbackKind {
        #[prost(message, tag="2")]
        Session(super::Session),
        #[prost(message, tag="3")]
        Error(super::AuthorizationError),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Session {
    #[prost(string, tag="1")]
    pub session_id: ::prost::alloc::string::String,
    #[prost(string, tag="2")]
    pub session_token: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCallbackResponse {
    #[prost(message, optional, tag="1")]
    pub details: ::core::option::Option<super::super::object::v2::Details>,
    #[prost(string, tag="2")]
    pub callback_url: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDeviceAuthorizationRequestRequest {
    /// The user_code returned by the device authorization request and provided to the user by the device.
    #[prost(string, tag="1")]
    pub user_code: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDeviceAuthorizationRequestResponse {
    #[prost(message, optional, tag="1")]
    pub device_authorization_request: ::core::option::Option<DeviceAuthorizationRequest>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthorizeOrDenyDeviceAuthorizationRequest {
    /// The device authorization id returned when submitting the user code.
    #[prost(string, tag="1")]
    pub device_authorization_id: ::prost::alloc::string::String,
    /// The decision of the user to authorize or deny the device authorization request.
    #[prost(oneof="authorize_or_deny_device_authorization_request::Decision", tags="2, 3")]
    pub decision: ::core::option::Option<authorize_or_deny_device_authorization_request::Decision>,
}
/// Nested message and enum types in `AuthorizeOrDenyDeviceAuthorizationRequest`.
pub mod authorize_or_deny_device_authorization_request {
    /// The decision of the user to authorize or deny the device authorization request.
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Decision {
        /// To authorize the device authorization request, the user's session must be provided.
        #[prost(message, tag="2")]
        Session(super::Session),
        /// Deny the device authorization request.
        #[prost(message, tag="3")]
        Deny(super::Deny),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Deny {
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AuthorizeOrDenyDeviceAuthorizationResponse {
}
include!("zitadel.oidc.v2.tonic.rs");
// @@protoc_insertion_point(module)