A better Rust ATProto crate
at lifetimes 3.7 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.server.getAccountInviteCodes 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[derive( 9 serde::Serialize, 10 serde::Deserialize, 11 Debug, 12 Clone, 13 PartialEq, 14 Eq, 15 bon::Builder, 16 jacquard_derive::IntoStatic 17)] 18#[builder(start_fn = new)] 19#[serde(rename_all = "camelCase")] 20pub struct GetAccountInviteCodes { 21 ///(default: true) 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 pub create_available: std::option::Option<bool>, 24 ///(default: true) 25 #[serde(skip_serializing_if = "std::option::Option::is_none")] 26 pub include_used: std::option::Option<bool>, 27} 28 29#[jacquard_derive::lexicon] 30#[derive( 31 serde::Serialize, 32 serde::Deserialize, 33 Debug, 34 Clone, 35 PartialEq, 36 Eq, 37 jacquard_derive::IntoStatic 38)] 39#[serde(rename_all = "camelCase")] 40pub struct GetAccountInviteCodesOutput<'a> { 41 #[serde(borrow)] 42 pub codes: Vec<crate::com_atproto::server::InviteCode<'a>>, 43} 44 45#[jacquard_derive::open_union] 46#[derive( 47 serde::Serialize, 48 serde::Deserialize, 49 Debug, 50 Clone, 51 PartialEq, 52 Eq, 53 thiserror::Error, 54 miette::Diagnostic 55)] 56#[serde(tag = "error", content = "message")] 57#[serde(bound(deserialize = "'de: 'a"))] 58pub enum GetAccountInviteCodesError<'a> { 59 #[serde(rename = "DuplicateCreate")] 60 DuplicateCreate(std::option::Option<String>), 61} 62 63impl std::fmt::Display for GetAccountInviteCodesError<'_> { 64 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 65 match self { 66 Self::DuplicateCreate(msg) => { 67 write!(f, "DuplicateCreate")?; 68 if let Some(msg) = msg { 69 write!(f, ": {}", msg)?; 70 } 71 Ok(()) 72 } 73 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 74 } 75 } 76} 77 78impl jacquard_common::IntoStatic for GetAccountInviteCodesError<'_> { 79 type Output = GetAccountInviteCodesError<'static>; 80 fn into_static(self) -> Self::Output { 81 match self { 82 GetAccountInviteCodesError::DuplicateCreate(v) => { 83 GetAccountInviteCodesError::DuplicateCreate(v.into_static()) 84 } 85 GetAccountInviteCodesError::Unknown(v) => { 86 GetAccountInviteCodesError::Unknown(v.into_static()) 87 } 88 } 89 } 90} 91 92///Response type for 93///com.atproto.server.getAccountInviteCodes 94pub struct GetAccountInviteCodesResponse; 95impl jacquard_common::xrpc::XrpcResp for GetAccountInviteCodesResponse { 96 const NSID: &'static str = "com.atproto.server.getAccountInviteCodes"; 97 const ENCODING: &'static str = "application/json"; 98 type Output<'de> = GetAccountInviteCodesOutput<'de>; 99 type Err<'de> = GetAccountInviteCodesError<'de>; 100} 101 102impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetAccountInviteCodes { 103 const NSID: &'static str = "com.atproto.server.getAccountInviteCodes"; 104 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 105 type Response = GetAccountInviteCodesResponse; 106} 107 108///Endpoint type for 109///com.atproto.server.getAccountInviteCodes 110pub struct GetAccountInviteCodesRequest; 111impl jacquard_common::xrpc::XrpcEndpoint for GetAccountInviteCodesRequest { 112 const PATH: &'static str = "/xrpc/com.atproto.server.getAccountInviteCodes"; 113 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 114 type Request<'de> = GetAccountInviteCodes; 115 type Response = GetAccountInviteCodesResponse; 116}