// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.admin.sendEmail // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct SendEmail<'a> { /// Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub comment: std::option::Option>, #[serde(borrow)] pub content: jacquard_common::CowStr<'a>, #[serde(borrow)] pub recipient_did: jacquard_common::types::string::Did<'a>, #[serde(borrow)] pub sender_did: jacquard_common::types::string::Did<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub subject: std::option::Option>, } pub mod send_email_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type RecipientDid; type Content; type SenderDid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type RecipientDid = Unset; type Content = Unset; type SenderDid = Unset; } ///State transition - sets the `recipient_did` field to Set pub struct SetRecipientDid(PhantomData S>); impl sealed::Sealed for SetRecipientDid {} impl State for SetRecipientDid { type RecipientDid = Set; type Content = S::Content; type SenderDid = S::SenderDid; } ///State transition - sets the `content` field to Set pub struct SetContent(PhantomData S>); impl sealed::Sealed for SetContent {} impl State for SetContent { type RecipientDid = S::RecipientDid; type Content = Set; type SenderDid = S::SenderDid; } ///State transition - sets the `sender_did` field to Set pub struct SetSenderDid(PhantomData S>); impl sealed::Sealed for SetSenderDid {} impl State for SetSenderDid { type RecipientDid = S::RecipientDid; type Content = S::Content; type SenderDid = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `recipient_did` field pub struct recipient_did(()); ///Marker type for the `content` field pub struct content(()); ///Marker type for the `sender_did` field pub struct sender_did(()); } } /// Builder for constructing an instance of this type pub struct SendEmailBuilder<'a, S: send_email_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> SendEmail<'a> { /// Create a new builder for this type pub fn new() -> SendEmailBuilder<'a, send_email_state::Empty> { SendEmailBuilder::new() } } impl<'a> SendEmailBuilder<'a, send_email_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { SendEmailBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: send_email_state::State> SendEmailBuilder<'a, S> { /// Set the `comment` field (optional) pub fn comment( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `comment` field to an Option value (optional) pub fn maybe_comment(mut self, value: Option>) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S> SendEmailBuilder<'a, S> where S: send_email_state::State, S::Content: send_email_state::IsUnset, { /// Set the `content` field (required) pub fn content( mut self, value: impl Into>, ) -> SendEmailBuilder<'a, send_email_state::SetContent> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); SendEmailBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> SendEmailBuilder<'a, S> where S: send_email_state::State, S::RecipientDid: send_email_state::IsUnset, { /// Set the `recipientDid` field (required) pub fn recipient_did( mut self, value: impl Into>, ) -> SendEmailBuilder<'a, send_email_state::SetRecipientDid> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); SendEmailBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> SendEmailBuilder<'a, S> where S: send_email_state::State, S::SenderDid: send_email_state::IsUnset, { /// Set the `senderDid` field (required) pub fn sender_did( mut self, value: impl Into>, ) -> SendEmailBuilder<'a, send_email_state::SetSenderDid> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); SendEmailBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: send_email_state::State> SendEmailBuilder<'a, S> { /// Set the `subject` field (optional) pub fn subject( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `subject` field to an Option value (optional) pub fn maybe_subject(mut self, value: Option>) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> SendEmailBuilder<'a, S> where S: send_email_state::State, S::RecipientDid: send_email_state::IsSet, S::Content: send_email_state::IsSet, S::SenderDid: send_email_state::IsSet, { /// Build the final struct pub fn build(self) -> SendEmail<'a> { SendEmail { comment: self.__unsafe_private_named.0, content: self.__unsafe_private_named.1.unwrap(), recipient_did: self.__unsafe_private_named.2.unwrap(), sender_did: self.__unsafe_private_named.3.unwrap(), subject: self.__unsafe_private_named.4, extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> SendEmail<'a> { SendEmail { comment: self.__unsafe_private_named.0, content: self.__unsafe_private_named.1.unwrap(), recipient_did: self.__unsafe_private_named.2.unwrap(), sender_did: self.__unsafe_private_named.3.unwrap(), subject: self.__unsafe_private_named.4, extra_data: Some(extra_data), } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct SendEmailOutput<'a> { pub sent: bool, } /// Response type for ///com.atproto.admin.sendEmail pub struct SendEmailResponse; impl jacquard_common::xrpc::XrpcResp for SendEmailResponse { const NSID: &'static str = "com.atproto.admin.sendEmail"; const ENCODING: &'static str = "application/json"; type Output<'de> = SendEmailOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for SendEmail<'a> { const NSID: &'static str = "com.atproto.admin.sendEmail"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = SendEmailResponse; } /// Endpoint type for ///com.atproto.admin.sendEmail pub struct SendEmailRequest; impl jacquard_common::xrpc::XrpcEndpoint for SendEmailRequest { const PATH: &'static str = "/xrpc/com.atproto.admin.sendEmail"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = SendEmail<'de>; type Response = SendEmailResponse; }