1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.sync.getHead
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 GetHead<'a> {
21 #[serde(borrow)]
22 pub did: jacquard_common::types::string::Did<'a>,
23}
24
25#[jacquard_derive::lexicon]
26#[derive(
27 serde::Serialize,
28 serde::Deserialize,
29 Debug,
30 Clone,
31 PartialEq,
32 Eq,
33 jacquard_derive::IntoStatic
34)]
35#[serde(rename_all = "camelCase")]
36pub struct GetHeadOutput<'a> {
37 #[serde(borrow)]
38 pub root: jacquard_common::types::string::Cid<'a>,
39}
40
41#[jacquard_derive::open_union]
42#[derive(
43 serde::Serialize,
44 serde::Deserialize,
45 Debug,
46 Clone,
47 PartialEq,
48 Eq,
49 thiserror::Error,
50 miette::Diagnostic
51)]
52#[serde(tag = "error", content = "message")]
53#[serde(bound(deserialize = "'de: 'a"))]
54pub enum GetHeadError<'a> {
55 #[serde(rename = "HeadNotFound")]
56 HeadNotFound(std::option::Option<String>),
57}
58
59impl std::fmt::Display for GetHeadError<'_> {
60 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
61 match self {
62 Self::HeadNotFound(msg) => {
63 write!(f, "HeadNotFound")?;
64 if let Some(msg) = msg {
65 write!(f, ": {}", msg)?;
66 }
67 Ok(())
68 }
69 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
70 }
71 }
72}
73
74impl jacquard_common::IntoStatic for GetHeadError<'_> {
75 type Output = GetHeadError<'static>;
76 fn into_static(self) -> Self::Output {
77 match self {
78 GetHeadError::HeadNotFound(v) => GetHeadError::HeadNotFound(v.into_static()),
79 GetHeadError::Unknown(v) => GetHeadError::Unknown(v.into_static()),
80 }
81 }
82}
83
84///Response type for
85///com.atproto.sync.getHead
86pub struct GetHeadResponse;
87impl jacquard_common::xrpc::XrpcResp for GetHeadResponse {
88 const NSID: &'static str = "com.atproto.sync.getHead";
89 const ENCODING: &'static str = "application/json";
90 type Output<'de> = GetHeadOutput<'de>;
91 type Err<'de> = GetHeadError<'de>;
92}
93
94impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetHead<'de> {
95 const NSID: &'static str = "com.atproto.sync.getHead";
96 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
97 type Response = GetHeadResponse;
98}
99
100///Endpoint type for
101///com.atproto.sync.getHead
102pub struct GetHeadRequest;
103impl jacquard_common::xrpc::XrpcEndpoint for GetHeadRequest {
104 const PATH: &'static str = "/xrpc/com.atproto.sync.getHead";
105 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
106 type Request<'de> = GetHead<'de>;
107 type Response = GetHeadResponse;
108}