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