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 jacquard_derive::IntoStatic
62)]
63#[serde(tag = "error", content = "message")]
64#[serde(bound(deserialize = "'de: 'a"))]
65pub enum GetHostStatusError<'a> {
66 #[serde(rename = "HostNotFound")]
67 HostNotFound(std::option::Option<String>),
68}
69
70impl std::fmt::Display for GetHostStatusError<'_> {
71 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
72 match self {
73 Self::HostNotFound(msg) => {
74 write!(f, "HostNotFound")?;
75 if let Some(msg) = msg {
76 write!(f, ": {}", msg)?;
77 }
78 Ok(())
79 }
80 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
81 }
82 }
83}
84
85///Response type for
86///com.atproto.sync.getHostStatus
87pub struct GetHostStatusResponse;
88impl jacquard_common::xrpc::XrpcResp for GetHostStatusResponse {
89 const NSID: &'static str = "com.atproto.sync.getHostStatus";
90 const ENCODING: &'static str = "application/json";
91 type Output<'de> = GetHostStatusOutput<'de>;
92 type Err<'de> = GetHostStatusError<'de>;
93}
94
95impl<'a> jacquard_common::xrpc::XrpcRequest for GetHostStatus<'a> {
96 const NSID: &'static str = "com.atproto.sync.getHostStatus";
97 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
98 type Response = GetHostStatusResponse;
99}
100
101///Endpoint type for
102///com.atproto.sync.getHostStatus
103pub struct GetHostStatusRequest;
104impl jacquard_common::xrpc::XrpcEndpoint for GetHostStatusRequest {
105 const PATH: &'static str = "/xrpc/com.atproto.sync.getHostStatus";
106 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
107 type Request<'de> = GetHostStatus<'de>;
108 type Response = GetHostStatusResponse;
109}