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