A better Rust ATProto crate
at oauth 3.5 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.server.deleteAccount 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 bon::Builder 17)] 18#[serde(rename_all = "camelCase")] 19#[builder(start_fn = new)] 20pub struct DeleteAccount<'a> { 21 #[serde(borrow)] 22 pub did: jacquard_common::types::string::Did<'a>, 23 #[serde(borrow)] 24 #[builder(into)] 25 pub password: jacquard_common::CowStr<'a>, 26 #[serde(borrow)] 27 #[builder(into)] 28 pub token: jacquard_common::CowStr<'a>, 29 #[serde(flatten)] 30 #[serde(borrow)] 31 #[builder(default)] 32 pub extra_data: ::std::collections::BTreeMap< 33 ::jacquard_common::smol_str::SmolStr, 34 ::jacquard_common::types::value::Data<'a>, 35 >, 36} 37 38impl jacquard_common::IntoStatic for DeleteAccount<'_> { 39 type Output = DeleteAccount<'static>; 40 fn into_static(self) -> Self::Output { 41 DeleteAccount { 42 did: self.did.into_static(), 43 password: self.password.into_static(), 44 token: self.token.into_static(), 45 extra_data: self.extra_data.into_static(), 46 } 47 } 48} 49 50#[jacquard_derive::open_union] 51#[derive( 52 serde::Serialize, 53 serde::Deserialize, 54 Debug, 55 Clone, 56 PartialEq, 57 Eq, 58 thiserror::Error, 59 miette::Diagnostic 60)] 61#[serde(tag = "error", content = "message")] 62#[serde(bound(deserialize = "'de: 'a"))] 63pub enum DeleteAccountError<'a> { 64 #[serde(rename = "ExpiredToken")] 65 ExpiredToken(std::option::Option<String>), 66 #[serde(rename = "InvalidToken")] 67 InvalidToken(std::option::Option<String>), 68} 69 70impl std::fmt::Display for DeleteAccountError<'_> { 71 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 72 match self { 73 Self::ExpiredToken(msg) => { 74 write!(f, "ExpiredToken")?; 75 if let Some(msg) = msg { 76 write!(f, ": {}", msg)?; 77 } 78 Ok(()) 79 } 80 Self::InvalidToken(msg) => { 81 write!(f, "InvalidToken")?; 82 if let Some(msg) = msg { 83 write!(f, ": {}", msg)?; 84 } 85 Ok(()) 86 } 87 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 88 } 89 } 90} 91 92impl jacquard_common::IntoStatic for DeleteAccountError<'_> { 93 type Output = DeleteAccountError<'static>; 94 fn into_static(self) -> Self::Output { 95 match self { 96 DeleteAccountError::ExpiredToken(v) => { 97 DeleteAccountError::ExpiredToken(v.into_static()) 98 } 99 DeleteAccountError::InvalidToken(v) => { 100 DeleteAccountError::InvalidToken(v.into_static()) 101 } 102 DeleteAccountError::Unknown(v) => { 103 DeleteAccountError::Unknown(v.into_static()) 104 } 105 } 106 } 107} 108 109impl jacquard_common::types::xrpc::XrpcRequest for DeleteAccount<'_> { 110 const NSID: &'static str = "com.atproto.server.deleteAccount"; 111 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure( 112 "application/json", 113 ); 114 const OUTPUT_ENCODING: &'static str = "application/json"; 115 type Output<'de> = (); 116 type Err<'de> = DeleteAccountError<'de>; 117}