A better Rust ATProto crate
at main 2.9 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.server.resetPassword 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 Default 18)] 19#[serde(rename_all = "camelCase")] 20pub struct ResetPassword<'a> { 21 #[serde(borrow)] 22 pub password: jacquard_common::CowStr<'a>, 23 #[serde(borrow)] 24 pub token: jacquard_common::CowStr<'a>, 25} 26 27#[jacquard_derive::open_union] 28#[derive( 29 serde::Serialize, 30 serde::Deserialize, 31 Debug, 32 Clone, 33 PartialEq, 34 Eq, 35 thiserror::Error, 36 miette::Diagnostic, 37 jacquard_derive::IntoStatic 38)] 39#[serde(tag = "error", content = "message")] 40#[serde(bound(deserialize = "'de: 'a"))] 41pub enum ResetPasswordError<'a> { 42 #[serde(rename = "ExpiredToken")] 43 ExpiredToken(std::option::Option<String>), 44 #[serde(rename = "InvalidToken")] 45 InvalidToken(std::option::Option<String>), 46} 47 48impl std::fmt::Display for ResetPasswordError<'_> { 49 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 50 match self { 51 Self::ExpiredToken(msg) => { 52 write!(f, "ExpiredToken")?; 53 if let Some(msg) = msg { 54 write!(f, ": {}", msg)?; 55 } 56 Ok(()) 57 } 58 Self::InvalidToken(msg) => { 59 write!(f, "InvalidToken")?; 60 if let Some(msg) = msg { 61 write!(f, ": {}", msg)?; 62 } 63 Ok(()) 64 } 65 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 66 } 67 } 68} 69 70///Response type for 71///com.atproto.server.resetPassword 72pub struct ResetPasswordResponse; 73impl jacquard_common::xrpc::XrpcResp for ResetPasswordResponse { 74 const NSID: &'static str = "com.atproto.server.resetPassword"; 75 const ENCODING: &'static str = "application/json"; 76 type Output<'de> = (); 77 type Err<'de> = ResetPasswordError<'de>; 78} 79 80impl<'a> jacquard_common::xrpc::XrpcRequest for ResetPassword<'a> { 81 const NSID: &'static str = "com.atproto.server.resetPassword"; 82 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 83 "application/json", 84 ); 85 type Response = ResetPasswordResponse; 86} 87 88///Endpoint type for 89///com.atproto.server.resetPassword 90pub struct ResetPasswordRequest; 91impl jacquard_common::xrpc::XrpcEndpoint for ResetPasswordRequest { 92 const PATH: &'static str = "/xrpc/com.atproto.server.resetPassword"; 93 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 94 "application/json", 95 ); 96 type Request<'de> = ResetPassword<'de>; 97 type Response = ResetPasswordResponse; 98}