A better Rust ATProto crate
at main 3.9 kB view raw
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 jacquard_derive::IntoStatic 50)] 51#[serde(tag = "error", content = "message")] 52#[serde(bound(deserialize = "'de: 'a"))] 53pub enum GetBlobError<'a> { 54 #[serde(rename = "BlobNotFound")] 55 BlobNotFound(std::option::Option<String>), 56 #[serde(rename = "RepoNotFound")] 57 RepoNotFound(std::option::Option<String>), 58 #[serde(rename = "RepoTakendown")] 59 RepoTakendown(std::option::Option<String>), 60 #[serde(rename = "RepoSuspended")] 61 RepoSuspended(std::option::Option<String>), 62 #[serde(rename = "RepoDeactivated")] 63 RepoDeactivated(std::option::Option<String>), 64} 65 66impl std::fmt::Display for GetBlobError<'_> { 67 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 68 match self { 69 Self::BlobNotFound(msg) => { 70 write!(f, "BlobNotFound")?; 71 if let Some(msg) = msg { 72 write!(f, ": {}", msg)?; 73 } 74 Ok(()) 75 } 76 Self::RepoNotFound(msg) => { 77 write!(f, "RepoNotFound")?; 78 if let Some(msg) = msg { 79 write!(f, ": {}", msg)?; 80 } 81 Ok(()) 82 } 83 Self::RepoTakendown(msg) => { 84 write!(f, "RepoTakendown")?; 85 if let Some(msg) = msg { 86 write!(f, ": {}", msg)?; 87 } 88 Ok(()) 89 } 90 Self::RepoSuspended(msg) => { 91 write!(f, "RepoSuspended")?; 92 if let Some(msg) = msg { 93 write!(f, ": {}", msg)?; 94 } 95 Ok(()) 96 } 97 Self::RepoDeactivated(msg) => { 98 write!(f, "RepoDeactivated")?; 99 if let Some(msg) = msg { 100 write!(f, ": {}", msg)?; 101 } 102 Ok(()) 103 } 104 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 105 } 106 } 107} 108 109///Response type for 110///com.atproto.sync.getBlob 111pub struct GetBlobResponse; 112impl jacquard_common::xrpc::XrpcResp for GetBlobResponse { 113 const NSID: &'static str = "com.atproto.sync.getBlob"; 114 const ENCODING: &'static str = "*/*"; 115 type Output<'de> = GetBlobOutput<'de>; 116 type Err<'de> = GetBlobError<'de>; 117} 118 119impl<'a> jacquard_common::xrpc::XrpcRequest for GetBlob<'a> { 120 const NSID: &'static str = "com.atproto.sync.getBlob"; 121 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 122 type Response = GetBlobResponse; 123} 124 125///Endpoint type for 126///com.atproto.sync.getBlob 127pub struct GetBlobRequest; 128impl jacquard_common::xrpc::XrpcEndpoint for GetBlobRequest { 129 const PATH: &'static str = "/xrpc/com.atproto.sync.getBlob"; 130 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 131 type Request<'de> = GetBlob<'de>; 132 type Response = GetBlobResponse; 133}