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