atproto blogging
at main 183 lines 6.2 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.admin.disableAccountInvites 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[jacquard_derive::lexicon] 9#[derive( 10 serde::Serialize, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 jacquard_derive::IntoStatic 17)] 18#[serde(rename_all = "camelCase")] 19pub struct DisableAccountInvites<'a> { 20 #[serde(borrow)] 21 pub account: jacquard_common::types::string::Did<'a>, 22 /// Optional reason for disabled invites. 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 #[serde(borrow)] 25 pub note: std::option::Option<jacquard_common::CowStr<'a>>, 26} 27 28pub mod disable_account_invites_state { 29 30 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 31 #[allow(unused)] 32 use ::core::marker::PhantomData; 33 mod sealed { 34 pub trait Sealed {} 35 } 36 /// State trait tracking which required fields have been set 37 pub trait State: sealed::Sealed { 38 type Account; 39 } 40 /// Empty state - all required fields are unset 41 pub struct Empty(()); 42 impl sealed::Sealed for Empty {} 43 impl State for Empty { 44 type Account = Unset; 45 } 46 ///State transition - sets the `account` field to Set 47 pub struct SetAccount<S: State = Empty>(PhantomData<fn() -> S>); 48 impl<S: State> sealed::Sealed for SetAccount<S> {} 49 impl<S: State> State for SetAccount<S> { 50 type Account = Set<members::account>; 51 } 52 /// Marker types for field names 53 #[allow(non_camel_case_types)] 54 pub mod members { 55 ///Marker type for the `account` field 56 pub struct account(()); 57 } 58} 59 60/// Builder for constructing an instance of this type 61pub struct DisableAccountInvitesBuilder<'a, S: disable_account_invites_state::State> { 62 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 63 __unsafe_private_named: ( 64 ::core::option::Option<jacquard_common::types::string::Did<'a>>, 65 ::core::option::Option<jacquard_common::CowStr<'a>>, 66 ), 67 _phantom: ::core::marker::PhantomData<&'a ()>, 68} 69 70impl<'a> DisableAccountInvites<'a> { 71 /// Create a new builder for this type 72 pub fn new() -> DisableAccountInvitesBuilder< 73 'a, 74 disable_account_invites_state::Empty, 75 > { 76 DisableAccountInvitesBuilder::new() 77 } 78} 79 80impl<'a> DisableAccountInvitesBuilder<'a, disable_account_invites_state::Empty> { 81 /// Create a new builder with all fields unset 82 pub fn new() -> Self { 83 DisableAccountInvitesBuilder { 84 _phantom_state: ::core::marker::PhantomData, 85 __unsafe_private_named: (None, None), 86 _phantom: ::core::marker::PhantomData, 87 } 88 } 89} 90 91impl<'a, S> DisableAccountInvitesBuilder<'a, S> 92where 93 S: disable_account_invites_state::State, 94 S::Account: disable_account_invites_state::IsUnset, 95{ 96 /// Set the `account` field (required) 97 pub fn account( 98 mut self, 99 value: impl Into<jacquard_common::types::string::Did<'a>>, 100 ) -> DisableAccountInvitesBuilder<'a, disable_account_invites_state::SetAccount<S>> { 101 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 102 DisableAccountInvitesBuilder { 103 _phantom_state: ::core::marker::PhantomData, 104 __unsafe_private_named: self.__unsafe_private_named, 105 _phantom: ::core::marker::PhantomData, 106 } 107 } 108} 109 110impl<'a, S: disable_account_invites_state::State> DisableAccountInvitesBuilder<'a, S> { 111 /// Set the `note` field (optional) 112 pub fn note( 113 mut self, 114 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 115 ) -> Self { 116 self.__unsafe_private_named.1 = value.into(); 117 self 118 } 119 /// Set the `note` field to an Option value (optional) 120 pub fn maybe_note(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 121 self.__unsafe_private_named.1 = value; 122 self 123 } 124} 125 126impl<'a, S> DisableAccountInvitesBuilder<'a, S> 127where 128 S: disable_account_invites_state::State, 129 S::Account: disable_account_invites_state::IsSet, 130{ 131 /// Build the final struct 132 pub fn build(self) -> DisableAccountInvites<'a> { 133 DisableAccountInvites { 134 account: self.__unsafe_private_named.0.unwrap(), 135 note: self.__unsafe_private_named.1, 136 extra_data: Default::default(), 137 } 138 } 139 /// Build the final struct with custom extra_data 140 pub fn build_with_data( 141 self, 142 extra_data: std::collections::BTreeMap< 143 jacquard_common::smol_str::SmolStr, 144 jacquard_common::types::value::Data<'a>, 145 >, 146 ) -> DisableAccountInvites<'a> { 147 DisableAccountInvites { 148 account: self.__unsafe_private_named.0.unwrap(), 149 note: self.__unsafe_private_named.1, 150 extra_data: Some(extra_data), 151 } 152 } 153} 154 155/// Response type for 156///com.atproto.admin.disableAccountInvites 157pub struct DisableAccountInvitesResponse; 158impl jacquard_common::xrpc::XrpcResp for DisableAccountInvitesResponse { 159 const NSID: &'static str = "com.atproto.admin.disableAccountInvites"; 160 const ENCODING: &'static str = "application/json"; 161 type Output<'de> = (); 162 type Err<'de> = jacquard_common::xrpc::GenericError<'de>; 163} 164 165impl<'a> jacquard_common::xrpc::XrpcRequest for DisableAccountInvites<'a> { 166 const NSID: &'static str = "com.atproto.admin.disableAccountInvites"; 167 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 168 "application/json", 169 ); 170 type Response = DisableAccountInvitesResponse; 171} 172 173/// Endpoint type for 174///com.atproto.admin.disableAccountInvites 175pub struct DisableAccountInvitesRequest; 176impl jacquard_common::xrpc::XrpcEndpoint for DisableAccountInvitesRequest { 177 const PATH: &'static str = "/xrpc/com.atproto.admin.disableAccountInvites"; 178 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 179 "application/json", 180 ); 181 type Request<'de> = DisableAccountInvites<'de>; 182 type Response = DisableAccountInvitesResponse; 183}