A better Rust ATProto crate
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: net.altq.aqfile 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// Cryptographic checksum for integrity verification. 9#[jacquard_derive::lexicon] 10#[derive( 11 serde::Serialize, 12 serde::Deserialize, 13 Debug, 14 Clone, 15 PartialEq, 16 Eq, 17 jacquard_derive::IntoStatic, 18 Default 19)] 20#[serde(rename_all = "camelCase")] 21pub struct Checksum<'a> { 22 /// Hash algorithm name. 23 #[serde(borrow)] 24 pub algo: jacquard_common::CowStr<'a>, 25 /// Hex or base64 encoded digest produced by the algorithm. 26 #[serde(borrow)] 27 pub hash: jacquard_common::CowStr<'a>, 28} 29 30/// File metadata describing the uploaded blob. 31#[jacquard_derive::lexicon] 32#[derive( 33 serde::Serialize, 34 serde::Deserialize, 35 Debug, 36 Clone, 37 PartialEq, 38 Eq, 39 jacquard_derive::IntoStatic, 40 bon::Builder 41)] 42#[serde(rename_all = "camelCase")] 43pub struct File<'a> { 44 /// MIME type, e.g. 'video/mp4'. 45 #[serde(skip_serializing_if = "std::option::Option::is_none")] 46 #[builder(into)] 47 #[serde(borrow)] 48 pub mime_type: Option<jacquard_common::CowStr<'a>>, 49 /// Client-side last-modified timestamp. 50 #[serde(skip_serializing_if = "std::option::Option::is_none")] 51 #[builder(into)] 52 pub modified_at: Option<jacquard_common::types::string::Datetime>, 53 /// User-visible filename. 54 #[serde(borrow)] 55 #[builder(into)] 56 pub name: jacquard_common::CowStr<'a>, 57 /// File size in bytes. 58 pub size: i64, 59} 60 61/// A record representing an uploaded file blob with metadata. 62#[jacquard_derive::lexicon] 63#[derive( 64 serde::Serialize, 65 serde::Deserialize, 66 Debug, 67 Clone, 68 PartialEq, 69 Eq, 70 jacquard_derive::IntoStatic, 71 bon::Builder 72)] 73#[serde(rename_all = "camelCase")] 74pub struct Aqfile<'a> { 75 /// Handle or DID of the account to attribute this upload to. 76 #[serde(skip_serializing_if = "std::option::Option::is_none")] 77 #[builder(into)] 78 #[serde(borrow)] 79 pub attribution: Option<jacquard_common::types::ident::AtIdentifier<'a>>, 80 /// The uploaded blob reference. Note: Individual PDS instances may enforce lower size limits. 81 #[serde(borrow)] 82 pub blob: jacquard_common::types::blob::Blob<'a>, 83 /// Optional cryptographic checksum for integrity verification. 84 #[serde(skip_serializing_if = "std::option::Option::is_none")] 85 #[builder(into)] 86 #[serde(borrow)] 87 pub checksum: Option<crate::net_altq::aqfile::Checksum<'a>>, 88 /// Timestamp when this record was created. 89 pub created_at: jacquard_common::types::string::Datetime, 90 /// Metadata about the file. 91 #[serde(borrow)] 92 pub file: crate::net_altq::aqfile::File<'a>, 93} 94 95/// Typed wrapper for GetRecord response with this collection's record type. 96#[derive( 97 serde::Serialize, 98 serde::Deserialize, 99 Debug, 100 Clone, 101 PartialEq, 102 Eq, 103 jacquard_derive::IntoStatic 104)] 105#[serde(rename_all = "camelCase")] 106pub struct AqfileGetRecordOutput<'a> { 107 #[serde(skip_serializing_if = "std::option::Option::is_none")] 108 #[serde(borrow)] 109 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 110 #[serde(borrow)] 111 pub uri: jacquard_common::types::string::AtUri<'a>, 112 #[serde(borrow)] 113 pub value: Aqfile<'a>, 114} 115 116/// Marker type for deserializing records from this collection. 117pub struct AqfileRecord; 118impl jacquard_common::xrpc::XrpcResp for AqfileRecord { 119 const NSID: &'static str = "net.altq.aqfile"; 120 const ENCODING: &'static str = "application/json"; 121 type Output<'de> = AqfileGetRecordOutput<'de>; 122 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 123} 124 125impl jacquard_common::types::collection::Collection for Aqfile<'_> { 126 const NSID: &'static str = "net.altq.aqfile"; 127 type Record = AqfileRecord; 128} 129 130impl From<AqfileGetRecordOutput<'_>> for Aqfile<'_> { 131 fn from(output: AqfileGetRecordOutput<'_>) -> Self { 132 use jacquard_common::IntoStatic; 133 output.value.into_static() 134 } 135}