// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.sync.getHostStatus // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder )] #[builder(start_fn = new)] #[serde(rename_all = "camelCase")] pub struct GetHostStatus<'a> { #[serde(borrow)] #[builder(into)] pub hostname: jacquard_common::CowStr<'a>, } impl jacquard_common::IntoStatic for GetHostStatus<'_> { type Output = GetHostStatus<'static>; fn into_static(self) -> Self::Output { GetHostStatus { hostname: self.hostname.into_static(), } } } #[jacquard_derive::lexicon] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct GetHostStatusOutput<'a> { ///Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub account_count: std::option::Option, #[serde(borrow)] pub hostname: jacquard_common::CowStr<'a>, ///Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor). #[serde(skip_serializing_if = "std::option::Option::is_none")] pub seq: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub status: std::option::Option>, } impl jacquard_common::IntoStatic for GetHostStatusOutput<'_> { type Output = GetHostStatusOutput<'static>; fn into_static(self) -> Self::Output { GetHostStatusOutput { account_count: self.account_count.into_static(), hostname: self.hostname.into_static(), seq: self.seq.into_static(), status: self.status.into_static(), extra_data: self.extra_data.into_static(), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum GetHostStatusError<'a> { #[serde(rename = "HostNotFound")] HostNotFound(std::option::Option), } impl std::fmt::Display for GetHostStatusError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::HostNotFound(msg) => { write!(f, "HostNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } impl jacquard_common::IntoStatic for GetHostStatusError<'_> { type Output = GetHostStatusError<'static>; fn into_static(self) -> Self::Output { match self { GetHostStatusError::HostNotFound(v) => { GetHostStatusError::HostNotFound(v.into_static()) } GetHostStatusError::Unknown(v) => { GetHostStatusError::Unknown(v.into_static()) } } } } impl jacquard_common::types::xrpc::XrpcRequest for GetHostStatus<'_> { const NSID: &'static str = "com.atproto.sync.getHostStatus"; const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; const OUTPUT_ENCODING: &'static str = "application/json"; type Output<'de> = GetHostStatusOutput<'de>; type Err<'de> = GetHostStatusError<'de>; }