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