A better Rust ATProto crate
at lifetimes 3.9 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.sync.getHostStatus 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 GetHostStatus<'a> { 21 #[serde(borrow)] 22 #[builder(into)] 23 pub hostname: jacquard_common::CowStr<'a>, 24} 25 26#[jacquard_derive::lexicon] 27#[derive( 28 serde::Serialize, 29 serde::Deserialize, 30 Debug, 31 Clone, 32 PartialEq, 33 Eq, 34 jacquard_derive::IntoStatic 35)] 36#[serde(rename_all = "camelCase")] 37pub struct GetHostStatusOutput<'a> { 38 ///Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts. 39 #[serde(skip_serializing_if = "std::option::Option::is_none")] 40 pub account_count: std::option::Option<i64>, 41 #[serde(borrow)] 42 pub hostname: jacquard_common::CowStr<'a>, 43 ///Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). 44 #[serde(skip_serializing_if = "std::option::Option::is_none")] 45 pub seq: std::option::Option<i64>, 46 #[serde(skip_serializing_if = "std::option::Option::is_none")] 47 #[serde(borrow)] 48 pub status: std::option::Option<crate::com_atproto::sync::HostStatus<'a>>, 49} 50 51#[jacquard_derive::open_union] 52#[derive( 53 serde::Serialize, 54 serde::Deserialize, 55 Debug, 56 Clone, 57 PartialEq, 58 Eq, 59 thiserror::Error, 60 miette::Diagnostic 61)] 62#[serde(tag = "error", content = "message")] 63#[serde(bound(deserialize = "'de: 'a"))] 64pub enum GetHostStatusError<'a> { 65 #[serde(rename = "HostNotFound")] 66 HostNotFound(std::option::Option<String>), 67} 68 69impl std::fmt::Display for GetHostStatusError<'_> { 70 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 71 match self { 72 Self::HostNotFound(msg) => { 73 write!(f, "HostNotFound")?; 74 if let Some(msg) = msg { 75 write!(f, ": {}", msg)?; 76 } 77 Ok(()) 78 } 79 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 80 } 81 } 82} 83 84impl jacquard_common::IntoStatic for GetHostStatusError<'_> { 85 type Output = GetHostStatusError<'static>; 86 fn into_static(self) -> Self::Output { 87 match self { 88 GetHostStatusError::HostNotFound(v) => { 89 GetHostStatusError::HostNotFound(v.into_static()) 90 } 91 GetHostStatusError::Unknown(v) => { 92 GetHostStatusError::Unknown(v.into_static()) 93 } 94 } 95 } 96} 97 98///Response type for 99///com.atproto.sync.getHostStatus 100pub struct GetHostStatusResponse; 101impl jacquard_common::xrpc::XrpcResp for GetHostStatusResponse { 102 const NSID: &'static str = "com.atproto.sync.getHostStatus"; 103 const ENCODING: &'static str = "application/json"; 104 type Output<'de> = GetHostStatusOutput<'de>; 105 type Err<'de> = GetHostStatusError<'de>; 106} 107 108impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetHostStatus<'de> { 109 const NSID: &'static str = "com.atproto.sync.getHostStatus"; 110 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 111 type Response = GetHostStatusResponse; 112} 113 114///Endpoint type for 115///com.atproto.sync.getHostStatus 116pub struct GetHostStatusRequest; 117impl jacquard_common::xrpc::XrpcEndpoint for GetHostStatusRequest { 118 const PATH: &'static str = "/xrpc/com.atproto.sync.getHostStatus"; 119 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 120 type Request<'de> = GetHostStatus<'de>; 121 type Response = GetHostStatusResponse; 122}