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