1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.sync.getBlocks
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)]
17#[builder(start_fn = new)]
18#[serde(rename_all = "camelCase")]
19pub struct GetBlocks<'a> {
20 #[serde(borrow)]
21 pub cids: Vec<jacquard_common::types::string::Cid<'a>>,
22 #[serde(borrow)]
23 pub did: jacquard_common::types::string::Did<'a>,
24}
25
26impl jacquard_common::IntoStatic for GetBlocks<'_> {
27 type Output = GetBlocks<'static>;
28 fn into_static(self) -> Self::Output {
29 GetBlocks {
30 cids: self.cids.into_static(),
31 did: self.did.into_static(),
32 }
33 }
34}
35
36#[jacquard_derive::lexicon]
37#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
38#[serde(rename_all = "camelCase")]
39pub struct GetBlocksOutput<'a> {}
40impl jacquard_common::IntoStatic for GetBlocksOutput<'_> {
41 type Output = GetBlocksOutput<'static>;
42 fn into_static(self) -> Self::Output {
43 GetBlocksOutput {
44 extra_data: self.extra_data.into_static(),
45 }
46 }
47}
48
49#[jacquard_derive::open_union]
50#[derive(
51 serde::Serialize,
52 serde::Deserialize,
53 Debug,
54 Clone,
55 PartialEq,
56 Eq,
57 thiserror::Error,
58 miette::Diagnostic
59)]
60#[serde(tag = "error", content = "message")]
61#[serde(bound(deserialize = "'de: 'a"))]
62pub enum GetBlocksError<'a> {
63 #[serde(rename = "BlockNotFound")]
64 BlockNotFound(std::option::Option<String>),
65 #[serde(rename = "RepoNotFound")]
66 RepoNotFound(std::option::Option<String>),
67 #[serde(rename = "RepoTakendown")]
68 RepoTakendown(std::option::Option<String>),
69 #[serde(rename = "RepoSuspended")]
70 RepoSuspended(std::option::Option<String>),
71 #[serde(rename = "RepoDeactivated")]
72 RepoDeactivated(std::option::Option<String>),
73}
74
75impl std::fmt::Display for GetBlocksError<'_> {
76 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
77 match self {
78 Self::BlockNotFound(msg) => {
79 write!(f, "BlockNotFound")?;
80 if let Some(msg) = msg {
81 write!(f, ": {}", msg)?;
82 }
83 Ok(())
84 }
85 Self::RepoNotFound(msg) => {
86 write!(f, "RepoNotFound")?;
87 if let Some(msg) = msg {
88 write!(f, ": {}", msg)?;
89 }
90 Ok(())
91 }
92 Self::RepoTakendown(msg) => {
93 write!(f, "RepoTakendown")?;
94 if let Some(msg) = msg {
95 write!(f, ": {}", msg)?;
96 }
97 Ok(())
98 }
99 Self::RepoSuspended(msg) => {
100 write!(f, "RepoSuspended")?;
101 if let Some(msg) = msg {
102 write!(f, ": {}", msg)?;
103 }
104 Ok(())
105 }
106 Self::RepoDeactivated(msg) => {
107 write!(f, "RepoDeactivated")?;
108 if let Some(msg) = msg {
109 write!(f, ": {}", msg)?;
110 }
111 Ok(())
112 }
113 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
114 }
115 }
116}
117
118impl jacquard_common::IntoStatic for GetBlocksError<'_> {
119 type Output = GetBlocksError<'static>;
120 fn into_static(self) -> Self::Output {
121 match self {
122 GetBlocksError::BlockNotFound(v) => {
123 GetBlocksError::BlockNotFound(v.into_static())
124 }
125 GetBlocksError::RepoNotFound(v) => {
126 GetBlocksError::RepoNotFound(v.into_static())
127 }
128 GetBlocksError::RepoTakendown(v) => {
129 GetBlocksError::RepoTakendown(v.into_static())
130 }
131 GetBlocksError::RepoSuspended(v) => {
132 GetBlocksError::RepoSuspended(v.into_static())
133 }
134 GetBlocksError::RepoDeactivated(v) => {
135 GetBlocksError::RepoDeactivated(v.into_static())
136 }
137 GetBlocksError::Unknown(v) => GetBlocksError::Unknown(v.into_static()),
138 }
139 }
140}
141
142impl jacquard_common::types::xrpc::XrpcRequest for GetBlocks<'_> {
143 const NSID: &'static str = "com.atproto.sync.getBlocks";
144 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
145 const OUTPUT_ENCODING: &'static str = "application/vnd.ipld.car";
146 type Output<'de> = GetBlocksOutput<'de>;
147 type Err<'de> = GetBlocksError<'de>;
148}