use crate::types::*;
use crate::errors::*;
use std::fmt::Debug;
use serde::de::{Deserialize, Deserializer};
pub trait TDAuthorizationState: Debug + RObject {}
#[derive(Debug, Clone, Serialize)]
#[serde(untagged)]
pub enum AuthorizationState {
#[doc(hidden)] _Default(()),
Closed(AuthorizationStateClosed),
Closing(AuthorizationStateClosing),
LoggingOut(AuthorizationStateLoggingOut),
Ready(AuthorizationStateReady),
WaitCode(AuthorizationStateWaitCode),
WaitEncryptionKey(AuthorizationStateWaitEncryptionKey),
WaitOtherDeviceConfirmation(AuthorizationStateWaitOtherDeviceConfirmation),
WaitPassword(AuthorizationStateWaitPassword),
WaitPhoneNumber(AuthorizationStateWaitPhoneNumber),
WaitRegistration(AuthorizationStateWaitRegistration),
WaitTdlibParameters(AuthorizationStateWaitTdlibParameters),
GetAuthorizationState(GetAuthorizationState),
}
impl Default for AuthorizationState {
fn default() -> Self { AuthorizationState::_Default(()) }
}
impl<'de> Deserialize<'de> for AuthorizationState {
fn deserialize<D>(deserializer: D) -> Result<AuthorizationState, D::Error> where D: Deserializer<'de> {
use serde::de::Error;
rtd_enum_deserialize!(
AuthorizationState,
(authorizationStateClosed, Closed);
(authorizationStateClosing, Closing);
(authorizationStateLoggingOut, LoggingOut);
(authorizationStateReady, Ready);
(authorizationStateWaitCode, WaitCode);
(authorizationStateWaitEncryptionKey, WaitEncryptionKey);
(authorizationStateWaitOtherDeviceConfirmation, WaitOtherDeviceConfirmation);
(authorizationStateWaitPassword, WaitPassword);
(authorizationStateWaitPhoneNumber, WaitPhoneNumber);
(authorizationStateWaitRegistration, WaitRegistration);
(authorizationStateWaitTdlibParameters, WaitTdlibParameters);
(getAuthorizationState, GetAuthorizationState);
)(deserializer)
}
}
impl RObject for AuthorizationState {
#[doc(hidden)] fn td_name(&self) -> &'static str {
match self {
AuthorizationState::Closed(t) => t.td_name(),
AuthorizationState::Closing(t) => t.td_name(),
AuthorizationState::LoggingOut(t) => t.td_name(),
AuthorizationState::Ready(t) => t.td_name(),
AuthorizationState::WaitCode(t) => t.td_name(),
AuthorizationState::WaitEncryptionKey(t) => t.td_name(),
AuthorizationState::WaitOtherDeviceConfirmation(t) => t.td_name(),
AuthorizationState::WaitPassword(t) => t.td_name(),
AuthorizationState::WaitPhoneNumber(t) => t.td_name(),
AuthorizationState::WaitRegistration(t) => t.td_name(),
AuthorizationState::WaitTdlibParameters(t) => t.td_name(),
AuthorizationState::GetAuthorizationState(t) => t.td_name(),
_ => "-1",
}
}
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl AuthorizationState {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
#[doc(hidden)] pub fn _is_default(&self) -> bool { if let AuthorizationState::_Default(_) = self { true } else { false } }
pub fn is_closed(&self) -> bool { if let AuthorizationState::Closed(_) = self { true } else { false } }
pub fn is_closing(&self) -> bool { if let AuthorizationState::Closing(_) = self { true } else { false } }
pub fn is_logging_out(&self) -> bool { if let AuthorizationState::LoggingOut(_) = self { true } else { false } }
pub fn is_ready(&self) -> bool { if let AuthorizationState::Ready(_) = self { true } else { false } }
pub fn is_wait_code(&self) -> bool { if let AuthorizationState::WaitCode(_) = self { true } else { false } }
pub fn is_wait_encryption_key(&self) -> bool { if let AuthorizationState::WaitEncryptionKey(_) = self { true } else { false } }
pub fn is_wait_other_device_confirmation(&self) -> bool { if let AuthorizationState::WaitOtherDeviceConfirmation(_) = self { true } else { false } }
pub fn is_wait_password(&self) -> bool { if let AuthorizationState::WaitPassword(_) = self { true } else { false } }
pub fn is_wait_phone_number(&self) -> bool { if let AuthorizationState::WaitPhoneNumber(_) = self { true } else { false } }
pub fn is_wait_registration(&self) -> bool { if let AuthorizationState::WaitRegistration(_) = self { true } else { false } }
pub fn is_wait_tdlib_parameters(&self) -> bool { if let AuthorizationState::WaitTdlibParameters(_) = self { true } else { false } }
pub fn is_get_authorization_state(&self) -> bool { if let AuthorizationState::GetAuthorizationState(_) = self { true } else { false } }
pub fn on_closed<F: FnOnce(&AuthorizationStateClosed)>(&self, fnc: F) -> &Self { if let AuthorizationState::Closed(t) = self { fnc(t) }; self }
pub fn on_closing<F: FnOnce(&AuthorizationStateClosing)>(&self, fnc: F) -> &Self { if let AuthorizationState::Closing(t) = self { fnc(t) }; self }
pub fn on_logging_out<F: FnOnce(&AuthorizationStateLoggingOut)>(&self, fnc: F) -> &Self { if let AuthorizationState::LoggingOut(t) = self { fnc(t) }; self }
pub fn on_ready<F: FnOnce(&AuthorizationStateReady)>(&self, fnc: F) -> &Self { if let AuthorizationState::Ready(t) = self { fnc(t) }; self }
pub fn on_wait_code<F: FnOnce(&AuthorizationStateWaitCode)>(&self, fnc: F) -> &Self { if let AuthorizationState::WaitCode(t) = self { fnc(t) }; self }
pub fn on_wait_encryption_key<F: FnOnce(&AuthorizationStateWaitEncryptionKey)>(&self, fnc: F) -> &Self { if let AuthorizationState::WaitEncryptionKey(t) = self { fnc(t) }; self }
pub fn on_wait_other_device_confirmation<F: FnOnce(&AuthorizationStateWaitOtherDeviceConfirmation)>(&self, fnc: F) -> &Self { if let AuthorizationState::WaitOtherDeviceConfirmation(t) = self { fnc(t) }; self }
pub fn on_wait_password<F: FnOnce(&AuthorizationStateWaitPassword)>(&self, fnc: F) -> &Self { if let AuthorizationState::WaitPassword(t) = self { fnc(t) }; self }
pub fn on_wait_phone_number<F: FnOnce(&AuthorizationStateWaitPhoneNumber)>(&self, fnc: F) -> &Self { if let AuthorizationState::WaitPhoneNumber(t) = self { fnc(t) }; self }
pub fn on_wait_registration<F: FnOnce(&AuthorizationStateWaitRegistration)>(&self, fnc: F) -> &Self { if let AuthorizationState::WaitRegistration(t) = self { fnc(t) }; self }
pub fn on_wait_tdlib_parameters<F: FnOnce(&AuthorizationStateWaitTdlibParameters)>(&self, fnc: F) -> &Self { if let AuthorizationState::WaitTdlibParameters(t) = self { fnc(t) }; self }
pub fn on_get_authorization_state<F: FnOnce(&GetAuthorizationState)>(&self, fnc: F) -> &Self { if let AuthorizationState::GetAuthorizationState(t) = self { fnc(t) }; self }
pub fn as_closed(&self) -> Option<&AuthorizationStateClosed> { if let AuthorizationState::Closed(t) = self { return Some(t) } None }
pub fn as_closing(&self) -> Option<&AuthorizationStateClosing> { if let AuthorizationState::Closing(t) = self { return Some(t) } None }
pub fn as_logging_out(&self) -> Option<&AuthorizationStateLoggingOut> { if let AuthorizationState::LoggingOut(t) = self { return Some(t) } None }
pub fn as_ready(&self) -> Option<&AuthorizationStateReady> { if let AuthorizationState::Ready(t) = self { return Some(t) } None }
pub fn as_wait_code(&self) -> Option<&AuthorizationStateWaitCode> { if let AuthorizationState::WaitCode(t) = self { return Some(t) } None }
pub fn as_wait_encryption_key(&self) -> Option<&AuthorizationStateWaitEncryptionKey> { if let AuthorizationState::WaitEncryptionKey(t) = self { return Some(t) } None }
pub fn as_wait_other_device_confirmation(&self) -> Option<&AuthorizationStateWaitOtherDeviceConfirmation> { if let AuthorizationState::WaitOtherDeviceConfirmation(t) = self { return Some(t) } None }
pub fn as_wait_password(&self) -> Option<&AuthorizationStateWaitPassword> { if let AuthorizationState::WaitPassword(t) = self { return Some(t) } None }
pub fn as_wait_phone_number(&self) -> Option<&AuthorizationStateWaitPhoneNumber> { if let AuthorizationState::WaitPhoneNumber(t) = self { return Some(t) } None }
pub fn as_wait_registration(&self) -> Option<&AuthorizationStateWaitRegistration> { if let AuthorizationState::WaitRegistration(t) = self { return Some(t) } None }
pub fn as_wait_tdlib_parameters(&self) -> Option<&AuthorizationStateWaitTdlibParameters> { if let AuthorizationState::WaitTdlibParameters(t) = self { return Some(t) } None }
pub fn as_get_authorization_state(&self) -> Option<&GetAuthorizationState> { if let AuthorizationState::GetAuthorizationState(t) = self { return Some(t) } None }
pub fn closed<T: AsRef<AuthorizationStateClosed>>(t: T) -> Self { AuthorizationState::Closed(t.as_ref().clone()) }
pub fn closing<T: AsRef<AuthorizationStateClosing>>(t: T) -> Self { AuthorizationState::Closing(t.as_ref().clone()) }
pub fn logging_out<T: AsRef<AuthorizationStateLoggingOut>>(t: T) -> Self { AuthorizationState::LoggingOut(t.as_ref().clone()) }
pub fn ready<T: AsRef<AuthorizationStateReady>>(t: T) -> Self { AuthorizationState::Ready(t.as_ref().clone()) }
pub fn wait_code<T: AsRef<AuthorizationStateWaitCode>>(t: T) -> Self { AuthorizationState::WaitCode(t.as_ref().clone()) }
pub fn wait_encryption_key<T: AsRef<AuthorizationStateWaitEncryptionKey>>(t: T) -> Self { AuthorizationState::WaitEncryptionKey(t.as_ref().clone()) }
pub fn wait_other_device_confirmation<T: AsRef<AuthorizationStateWaitOtherDeviceConfirmation>>(t: T) -> Self { AuthorizationState::WaitOtherDeviceConfirmation(t.as_ref().clone()) }
pub fn wait_password<T: AsRef<AuthorizationStateWaitPassword>>(t: T) -> Self { AuthorizationState::WaitPassword(t.as_ref().clone()) }
pub fn wait_phone_number<T: AsRef<AuthorizationStateWaitPhoneNumber>>(t: T) -> Self { AuthorizationState::WaitPhoneNumber(t.as_ref().clone()) }
pub fn wait_registration<T: AsRef<AuthorizationStateWaitRegistration>>(t: T) -> Self { AuthorizationState::WaitRegistration(t.as_ref().clone()) }
pub fn wait_tdlib_parameters<T: AsRef<AuthorizationStateWaitTdlibParameters>>(t: T) -> Self { AuthorizationState::WaitTdlibParameters(t.as_ref().clone()) }
pub fn get_authorization_state<T: AsRef<GetAuthorizationState>>(t: T) -> Self { AuthorizationState::GetAuthorizationState(t.as_ref().clone()) }
}
impl AsRef<AuthorizationState> for AuthorizationState {
fn as_ref(&self) -> &AuthorizationState { self }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateClosed {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
}
impl RObject for AuthorizationStateClosed {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateClosed" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateClosed {}
impl AuthorizationStateClosed {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateClosedBuilder {
let mut inner = AuthorizationStateClosed::default();
inner.td_name = "authorizationStateClosed".to_string();
RTDAuthorizationStateClosedBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDAuthorizationStateClosedBuilder {
inner: AuthorizationStateClosed
}
impl RTDAuthorizationStateClosedBuilder {
pub fn build(&self) -> AuthorizationStateClosed { self.inner.clone() }
}
impl AsRef<AuthorizationStateClosed> for AuthorizationStateClosed {
fn as_ref(&self) -> &AuthorizationStateClosed { self }
}
impl AsRef<AuthorizationStateClosed> for RTDAuthorizationStateClosedBuilder {
fn as_ref(&self) -> &AuthorizationStateClosed { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateClosing {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
}
impl RObject for AuthorizationStateClosing {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateClosing" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateClosing {}
impl AuthorizationStateClosing {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateClosingBuilder {
let mut inner = AuthorizationStateClosing::default();
inner.td_name = "authorizationStateClosing".to_string();
RTDAuthorizationStateClosingBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDAuthorizationStateClosingBuilder {
inner: AuthorizationStateClosing
}
impl RTDAuthorizationStateClosingBuilder {
pub fn build(&self) -> AuthorizationStateClosing { self.inner.clone() }
}
impl AsRef<AuthorizationStateClosing> for AuthorizationStateClosing {
fn as_ref(&self) -> &AuthorizationStateClosing { self }
}
impl AsRef<AuthorizationStateClosing> for RTDAuthorizationStateClosingBuilder {
fn as_ref(&self) -> &AuthorizationStateClosing { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateLoggingOut {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
}
impl RObject for AuthorizationStateLoggingOut {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateLoggingOut" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateLoggingOut {}
impl AuthorizationStateLoggingOut {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateLoggingOutBuilder {
let mut inner = AuthorizationStateLoggingOut::default();
inner.td_name = "authorizationStateLoggingOut".to_string();
RTDAuthorizationStateLoggingOutBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDAuthorizationStateLoggingOutBuilder {
inner: AuthorizationStateLoggingOut
}
impl RTDAuthorizationStateLoggingOutBuilder {
pub fn build(&self) -> AuthorizationStateLoggingOut { self.inner.clone() }
}
impl AsRef<AuthorizationStateLoggingOut> for AuthorizationStateLoggingOut {
fn as_ref(&self) -> &AuthorizationStateLoggingOut { self }
}
impl AsRef<AuthorizationStateLoggingOut> for RTDAuthorizationStateLoggingOutBuilder {
fn as_ref(&self) -> &AuthorizationStateLoggingOut { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateReady {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
}
impl RObject for AuthorizationStateReady {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateReady" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateReady {}
impl AuthorizationStateReady {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateReadyBuilder {
let mut inner = AuthorizationStateReady::default();
inner.td_name = "authorizationStateReady".to_string();
RTDAuthorizationStateReadyBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDAuthorizationStateReadyBuilder {
inner: AuthorizationStateReady
}
impl RTDAuthorizationStateReadyBuilder {
pub fn build(&self) -> AuthorizationStateReady { self.inner.clone() }
}
impl AsRef<AuthorizationStateReady> for AuthorizationStateReady {
fn as_ref(&self) -> &AuthorizationStateReady { self }
}
impl AsRef<AuthorizationStateReady> for RTDAuthorizationStateReadyBuilder {
fn as_ref(&self) -> &AuthorizationStateReady { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateWaitCode {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
code_info: AuthenticationCodeInfo,
}
impl RObject for AuthorizationStateWaitCode {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateWaitCode" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateWaitCode {}
impl AuthorizationStateWaitCode {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateWaitCodeBuilder {
let mut inner = AuthorizationStateWaitCode::default();
inner.td_name = "authorizationStateWaitCode".to_string();
RTDAuthorizationStateWaitCodeBuilder { inner }
}
pub fn code_info(&self) -> &AuthenticationCodeInfo { &self.code_info }
}
#[doc(hidden)]
pub struct RTDAuthorizationStateWaitCodeBuilder {
inner: AuthorizationStateWaitCode
}
impl RTDAuthorizationStateWaitCodeBuilder {
pub fn build(&self) -> AuthorizationStateWaitCode { self.inner.clone() }
pub fn code_info<T: AsRef<AuthenticationCodeInfo>>(&mut self, code_info: T) -> &mut Self {
self.inner.code_info = code_info.as_ref().clone();
self
}
}
impl AsRef<AuthorizationStateWaitCode> for AuthorizationStateWaitCode {
fn as_ref(&self) -> &AuthorizationStateWaitCode { self }
}
impl AsRef<AuthorizationStateWaitCode> for RTDAuthorizationStateWaitCodeBuilder {
fn as_ref(&self) -> &AuthorizationStateWaitCode { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateWaitEncryptionKey {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
is_encrypted: bool,
}
impl RObject for AuthorizationStateWaitEncryptionKey {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateWaitEncryptionKey" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateWaitEncryptionKey {}
impl AuthorizationStateWaitEncryptionKey {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateWaitEncryptionKeyBuilder {
let mut inner = AuthorizationStateWaitEncryptionKey::default();
inner.td_name = "authorizationStateWaitEncryptionKey".to_string();
RTDAuthorizationStateWaitEncryptionKeyBuilder { inner }
}
pub fn is_encrypted(&self) -> bool { self.is_encrypted }
}
#[doc(hidden)]
pub struct RTDAuthorizationStateWaitEncryptionKeyBuilder {
inner: AuthorizationStateWaitEncryptionKey
}
impl RTDAuthorizationStateWaitEncryptionKeyBuilder {
pub fn build(&self) -> AuthorizationStateWaitEncryptionKey { self.inner.clone() }
pub fn is_encrypted(&mut self, is_encrypted: bool) -> &mut Self {
self.inner.is_encrypted = is_encrypted;
self
}
}
impl AsRef<AuthorizationStateWaitEncryptionKey> for AuthorizationStateWaitEncryptionKey {
fn as_ref(&self) -> &AuthorizationStateWaitEncryptionKey { self }
}
impl AsRef<AuthorizationStateWaitEncryptionKey> for RTDAuthorizationStateWaitEncryptionKeyBuilder {
fn as_ref(&self) -> &AuthorizationStateWaitEncryptionKey { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateWaitOtherDeviceConfirmation {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
link: String,
}
impl RObject for AuthorizationStateWaitOtherDeviceConfirmation {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateWaitOtherDeviceConfirmation" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateWaitOtherDeviceConfirmation {}
impl AuthorizationStateWaitOtherDeviceConfirmation {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateWaitOtherDeviceConfirmationBuilder {
let mut inner = AuthorizationStateWaitOtherDeviceConfirmation::default();
inner.td_name = "authorizationStateWaitOtherDeviceConfirmation".to_string();
RTDAuthorizationStateWaitOtherDeviceConfirmationBuilder { inner }
}
pub fn link(&self) -> &String { &self.link }
}
#[doc(hidden)]
pub struct RTDAuthorizationStateWaitOtherDeviceConfirmationBuilder {
inner: AuthorizationStateWaitOtherDeviceConfirmation
}
impl RTDAuthorizationStateWaitOtherDeviceConfirmationBuilder {
pub fn build(&self) -> AuthorizationStateWaitOtherDeviceConfirmation { self.inner.clone() }
pub fn link<T: AsRef<str>>(&mut self, link: T) -> &mut Self {
self.inner.link = link.as_ref().to_string();
self
}
}
impl AsRef<AuthorizationStateWaitOtherDeviceConfirmation> for AuthorizationStateWaitOtherDeviceConfirmation {
fn as_ref(&self) -> &AuthorizationStateWaitOtherDeviceConfirmation { self }
}
impl AsRef<AuthorizationStateWaitOtherDeviceConfirmation> for RTDAuthorizationStateWaitOtherDeviceConfirmationBuilder {
fn as_ref(&self) -> &AuthorizationStateWaitOtherDeviceConfirmation { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateWaitPassword {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
password_hint: String,
has_recovery_email_address: bool,
recovery_email_address_pattern: String,
}
impl RObject for AuthorizationStateWaitPassword {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateWaitPassword" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateWaitPassword {}
impl AuthorizationStateWaitPassword {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateWaitPasswordBuilder {
let mut inner = AuthorizationStateWaitPassword::default();
inner.td_name = "authorizationStateWaitPassword".to_string();
RTDAuthorizationStateWaitPasswordBuilder { inner }
}
pub fn password_hint(&self) -> &String { &self.password_hint }
pub fn has_recovery_email_address(&self) -> bool { self.has_recovery_email_address }
pub fn recovery_email_address_pattern(&self) -> &String { &self.recovery_email_address_pattern }
}
#[doc(hidden)]
pub struct RTDAuthorizationStateWaitPasswordBuilder {
inner: AuthorizationStateWaitPassword
}
impl RTDAuthorizationStateWaitPasswordBuilder {
pub fn build(&self) -> AuthorizationStateWaitPassword { self.inner.clone() }
pub fn password_hint<T: AsRef<str>>(&mut self, password_hint: T) -> &mut Self {
self.inner.password_hint = password_hint.as_ref().to_string();
self
}
pub fn has_recovery_email_address(&mut self, has_recovery_email_address: bool) -> &mut Self {
self.inner.has_recovery_email_address = has_recovery_email_address;
self
}
pub fn recovery_email_address_pattern<T: AsRef<str>>(&mut self, recovery_email_address_pattern: T) -> &mut Self {
self.inner.recovery_email_address_pattern = recovery_email_address_pattern.as_ref().to_string();
self
}
}
impl AsRef<AuthorizationStateWaitPassword> for AuthorizationStateWaitPassword {
fn as_ref(&self) -> &AuthorizationStateWaitPassword { self }
}
impl AsRef<AuthorizationStateWaitPassword> for RTDAuthorizationStateWaitPasswordBuilder {
fn as_ref(&self) -> &AuthorizationStateWaitPassword { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateWaitPhoneNumber {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
}
impl RObject for AuthorizationStateWaitPhoneNumber {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateWaitPhoneNumber" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateWaitPhoneNumber {}
impl AuthorizationStateWaitPhoneNumber {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateWaitPhoneNumberBuilder {
let mut inner = AuthorizationStateWaitPhoneNumber::default();
inner.td_name = "authorizationStateWaitPhoneNumber".to_string();
RTDAuthorizationStateWaitPhoneNumberBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDAuthorizationStateWaitPhoneNumberBuilder {
inner: AuthorizationStateWaitPhoneNumber
}
impl RTDAuthorizationStateWaitPhoneNumberBuilder {
pub fn build(&self) -> AuthorizationStateWaitPhoneNumber { self.inner.clone() }
}
impl AsRef<AuthorizationStateWaitPhoneNumber> for AuthorizationStateWaitPhoneNumber {
fn as_ref(&self) -> &AuthorizationStateWaitPhoneNumber { self }
}
impl AsRef<AuthorizationStateWaitPhoneNumber> for RTDAuthorizationStateWaitPhoneNumberBuilder {
fn as_ref(&self) -> &AuthorizationStateWaitPhoneNumber { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateWaitRegistration {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
terms_of_service: TermsOfService,
}
impl RObject for AuthorizationStateWaitRegistration {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateWaitRegistration" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateWaitRegistration {}
impl AuthorizationStateWaitRegistration {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateWaitRegistrationBuilder {
let mut inner = AuthorizationStateWaitRegistration::default();
inner.td_name = "authorizationStateWaitRegistration".to_string();
RTDAuthorizationStateWaitRegistrationBuilder { inner }
}
pub fn terms_of_service(&self) -> &TermsOfService { &self.terms_of_service }
}
#[doc(hidden)]
pub struct RTDAuthorizationStateWaitRegistrationBuilder {
inner: AuthorizationStateWaitRegistration
}
impl RTDAuthorizationStateWaitRegistrationBuilder {
pub fn build(&self) -> AuthorizationStateWaitRegistration { self.inner.clone() }
pub fn terms_of_service<T: AsRef<TermsOfService>>(&mut self, terms_of_service: T) -> &mut Self {
self.inner.terms_of_service = terms_of_service.as_ref().clone();
self
}
}
impl AsRef<AuthorizationStateWaitRegistration> for AuthorizationStateWaitRegistration {
fn as_ref(&self) -> &AuthorizationStateWaitRegistration { self }
}
impl AsRef<AuthorizationStateWaitRegistration> for RTDAuthorizationStateWaitRegistrationBuilder {
fn as_ref(&self) -> &AuthorizationStateWaitRegistration { &self.inner }
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AuthorizationStateWaitTdlibParameters {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
}
impl RObject for AuthorizationStateWaitTdlibParameters {
#[doc(hidden)] fn td_name(&self) -> &'static str { "authorizationStateWaitTdlibParameters" }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl TDAuthorizationState for AuthorizationStateWaitTdlibParameters {}
impl AuthorizationStateWaitTdlibParameters {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDAuthorizationStateWaitTdlibParametersBuilder {
let mut inner = AuthorizationStateWaitTdlibParameters::default();
inner.td_name = "authorizationStateWaitTdlibParameters".to_string();
RTDAuthorizationStateWaitTdlibParametersBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDAuthorizationStateWaitTdlibParametersBuilder {
inner: AuthorizationStateWaitTdlibParameters
}
impl RTDAuthorizationStateWaitTdlibParametersBuilder {
pub fn build(&self) -> AuthorizationStateWaitTdlibParameters { self.inner.clone() }
}
impl AsRef<AuthorizationStateWaitTdlibParameters> for AuthorizationStateWaitTdlibParameters {
fn as_ref(&self) -> &AuthorizationStateWaitTdlibParameters { self }
}
impl AsRef<AuthorizationStateWaitTdlibParameters> for RTDAuthorizationStateWaitTdlibParametersBuilder {
fn as_ref(&self) -> &AuthorizationStateWaitTdlibParameters { &self.inner }
}