A better Rust ATProto crate
at main 3.4 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: pub.leaflet.comment 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[jacquard_derive::lexicon] 9#[derive( 10 serde::Serialize, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 jacquard_derive::IntoStatic, 17 bon::Builder 18)] 19#[serde(rename_all = "camelCase")] 20pub struct LinearDocumentQuote<'a> { 21 #[serde(borrow)] 22 pub document: jacquard_common::types::string::AtUri<'a>, 23 #[serde(borrow)] 24 pub quote: crate::pub_leaflet::pages::linear_document::Quote<'a>, 25} 26 27/// Record containing a comment 28#[jacquard_derive::lexicon] 29#[derive( 30 serde::Serialize, 31 serde::Deserialize, 32 Debug, 33 Clone, 34 PartialEq, 35 Eq, 36 jacquard_derive::IntoStatic, 37 bon::Builder 38)] 39#[serde(rename_all = "camelCase")] 40pub struct Comment<'a> { 41 #[serde(skip_serializing_if = "std::option::Option::is_none")] 42 #[builder(into)] 43 #[serde(borrow)] 44 pub attachment: Option<crate::pub_leaflet::comment::LinearDocumentQuote<'a>>, 45 pub created_at: jacquard_common::types::string::Datetime, 46 #[serde(skip_serializing_if = "std::option::Option::is_none")] 47 #[builder(into)] 48 #[serde(borrow)] 49 pub facets: Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>, 50 #[serde(borrow)] 51 #[builder(into)] 52 pub plaintext: jacquard_common::CowStr<'a>, 53 #[serde(skip_serializing_if = "std::option::Option::is_none")] 54 #[builder(into)] 55 #[serde(borrow)] 56 pub reply: Option<crate::pub_leaflet::comment::ReplyRef<'a>>, 57 #[serde(borrow)] 58 pub subject: jacquard_common::types::string::AtUri<'a>, 59} 60 61/// Typed wrapper for GetRecord response with this collection's record type. 62#[derive( 63 serde::Serialize, 64 serde::Deserialize, 65 Debug, 66 Clone, 67 PartialEq, 68 Eq, 69 jacquard_derive::IntoStatic 70)] 71#[serde(rename_all = "camelCase")] 72pub struct CommentGetRecordOutput<'a> { 73 #[serde(skip_serializing_if = "std::option::Option::is_none")] 74 #[serde(borrow)] 75 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 76 #[serde(borrow)] 77 pub uri: jacquard_common::types::string::AtUri<'a>, 78 #[serde(borrow)] 79 pub value: Comment<'a>, 80} 81 82/// Marker type for deserializing records from this collection. 83pub struct CommentRecord; 84impl jacquard_common::xrpc::XrpcResp for CommentRecord { 85 const NSID: &'static str = "pub.leaflet.comment"; 86 const ENCODING: &'static str = "application/json"; 87 type Output<'de> = CommentGetRecordOutput<'de>; 88 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 89} 90 91impl jacquard_common::types::collection::Collection for Comment<'_> { 92 const NSID: &'static str = "pub.leaflet.comment"; 93 type Record = CommentRecord; 94} 95 96impl From<CommentGetRecordOutput<'_>> for Comment<'_> { 97 fn from(output: CommentGetRecordOutput<'_>) -> Self { 98 use jacquard_common::IntoStatic; 99 output.value.into_static() 100 } 101} 102 103#[jacquard_derive::lexicon] 104#[derive( 105 serde::Serialize, 106 serde::Deserialize, 107 Debug, 108 Clone, 109 PartialEq, 110 Eq, 111 jacquard_derive::IntoStatic, 112 bon::Builder 113)] 114#[serde(rename_all = "camelCase")] 115pub struct ReplyRef<'a> { 116 #[serde(borrow)] 117 pub parent: jacquard_common::types::string::AtUri<'a>, 118}