jacquard_api/com_atproto/sync/
get_host_status.rs1#[derive(
9 serde::Serialize,
10 serde::Deserialize,
11 Debug,
12 Clone,
13 PartialEq,
14 Eq,
15 jacquard_derive::IntoStatic
16)]
17#[serde(rename_all = "camelCase")]
18pub struct GetHostStatus<'a> {
19 #[serde(borrow)]
20 pub hostname: jacquard_common::CowStr<'a>,
21}
22
23pub mod get_host_status_state {
24
25 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
26 #[allow(unused)]
27 use ::core::marker::PhantomData;
28 mod sealed {
29 pub trait Sealed {}
30 }
31 pub trait State: sealed::Sealed {
33 type Hostname;
34 }
35 pub struct Empty(());
37 impl sealed::Sealed for Empty {}
38 impl State for Empty {
39 type Hostname = Unset;
40 }
41 pub struct SetHostname<S: State = Empty>(PhantomData<fn() -> S>);
43 impl<S: State> sealed::Sealed for SetHostname<S> {}
44 impl<S: State> State for SetHostname<S> {
45 type Hostname = Set<members::hostname>;
46 }
47 #[allow(non_camel_case_types)]
49 pub mod members {
50 pub struct hostname(());
52 }
53}
54
55pub struct GetHostStatusBuilder<'a, S: get_host_status_state::State> {
57 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
58 __unsafe_private_named: (::core::option::Option<jacquard_common::CowStr<'a>>,),
59 _phantom: ::core::marker::PhantomData<&'a ()>,
60}
61
62impl<'a> GetHostStatus<'a> {
63 pub fn new() -> GetHostStatusBuilder<'a, get_host_status_state::Empty> {
65 GetHostStatusBuilder::new()
66 }
67}
68
69impl<'a> GetHostStatusBuilder<'a, get_host_status_state::Empty> {
70 pub fn new() -> Self {
72 GetHostStatusBuilder {
73 _phantom_state: ::core::marker::PhantomData,
74 __unsafe_private_named: (None,),
75 _phantom: ::core::marker::PhantomData,
76 }
77 }
78}
79
80impl<'a, S> GetHostStatusBuilder<'a, S>
81where
82 S: get_host_status_state::State,
83 S::Hostname: get_host_status_state::IsUnset,
84{
85 pub fn hostname(
87 mut self,
88 value: impl Into<jacquard_common::CowStr<'a>>,
89 ) -> GetHostStatusBuilder<'a, get_host_status_state::SetHostname<S>> {
90 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
91 GetHostStatusBuilder {
92 _phantom_state: ::core::marker::PhantomData,
93 __unsafe_private_named: self.__unsafe_private_named,
94 _phantom: ::core::marker::PhantomData,
95 }
96 }
97}
98
99impl<'a, S> GetHostStatusBuilder<'a, S>
100where
101 S: get_host_status_state::State,
102 S::Hostname: get_host_status_state::IsSet,
103{
104 pub fn build(self) -> GetHostStatus<'a> {
106 GetHostStatus {
107 hostname: self.__unsafe_private_named.0.unwrap(),
108 }
109 }
110}
111
112#[jacquard_derive::lexicon]
113#[derive(
114 serde::Serialize,
115 serde::Deserialize,
116 Debug,
117 Clone,
118 PartialEq,
119 Eq,
120 jacquard_derive::IntoStatic,
121 Default
122)]
123#[serde(rename_all = "camelCase")]
124pub struct GetHostStatusOutput<'a> {
125 #[serde(skip_serializing_if = "std::option::Option::is_none")]
127 pub account_count: std::option::Option<i64>,
128 #[serde(borrow)]
129 pub hostname: jacquard_common::CowStr<'a>,
130 #[serde(skip_serializing_if = "std::option::Option::is_none")]
132 pub seq: std::option::Option<i64>,
133 #[serde(skip_serializing_if = "std::option::Option::is_none")]
134 #[serde(borrow)]
135 pub status: std::option::Option<crate::com_atproto::sync::HostStatus<'a>>,
136}
137
138#[jacquard_derive::open_union]
139#[derive(
140 serde::Serialize,
141 serde::Deserialize,
142 Debug,
143 Clone,
144 PartialEq,
145 Eq,
146 thiserror::Error,
147 miette::Diagnostic,
148 jacquard_derive::IntoStatic
149)]
150#[serde(tag = "error", content = "message")]
151#[serde(bound(deserialize = "'de: 'a"))]
152pub enum GetHostStatusError<'a> {
153 #[serde(rename = "HostNotFound")]
154 HostNotFound(std::option::Option<String>),
155}
156
157impl std::fmt::Display for GetHostStatusError<'_> {
158 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
159 match self {
160 Self::HostNotFound(msg) => {
161 write!(f, "HostNotFound")?;
162 if let Some(msg) = msg {
163 write!(f, ": {}", msg)?;
164 }
165 Ok(())
166 }
167 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
168 }
169 }
170}
171
172pub struct GetHostStatusResponse;
175impl jacquard_common::xrpc::XrpcResp for GetHostStatusResponse {
176 const NSID: &'static str = "com.atproto.sync.getHostStatus";
177 const ENCODING: &'static str = "application/json";
178 type Output<'de> = GetHostStatusOutput<'de>;
179 type Err<'de> = GetHostStatusError<'de>;
180}
181
182impl<'a> jacquard_common::xrpc::XrpcRequest for GetHostStatus<'a> {
183 const NSID: &'static str = "com.atproto.sync.getHostStatus";
184 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
185 type Response = GetHostStatusResponse;
186}
187
188pub struct GetHostStatusRequest;
191impl jacquard_common::xrpc::XrpcEndpoint for GetHostStatusRequest {
192 const PATH: &'static str = "/xrpc/com.atproto.sync.getHostStatus";
193 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
194 type Request<'de> = GetHostStatus<'de>;
195 type Response = GetHostStatusResponse;
196}