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)]
18#[serde(rename_all = "camelCase")]
19pub struct LinearDocumentQuote<'a> {
20 #[serde(borrow)]
21 pub document: jacquard_common::types::string::AtUri<'a>,
22 #[serde(borrow)]
23 pub quote: crate::pub_leaflet::pages::linear_document::Quote<'a>,
24}
25
26///Record containing a comment
27#[jacquard_derive::lexicon]
28#[derive(
29 serde::Serialize,
30 serde::Deserialize,
31 Debug,
32 Clone,
33 PartialEq,
34 Eq,
35 jacquard_derive::IntoStatic
36)]
37#[serde(rename_all = "camelCase")]
38pub struct Comment<'a> {
39 #[serde(skip_serializing_if = "std::option::Option::is_none")]
40 #[serde(borrow)]
41 pub attachment: std::option::Option<
42 crate::pub_leaflet::comment::LinearDocumentQuote<'a>,
43 >,
44 pub created_at: jacquard_common::types::string::Datetime,
45 #[serde(skip_serializing_if = "std::option::Option::is_none")]
46 #[serde(borrow)]
47 pub facets: std::option::Option<Vec<crate::pub_leaflet::richtext::facet::Facet<'a>>>,
48 #[serde(borrow)]
49 pub plaintext: jacquard_common::CowStr<'a>,
50 #[serde(skip_serializing_if = "std::option::Option::is_none")]
51 #[serde(borrow)]
52 pub reply: std::option::Option<crate::pub_leaflet::comment::ReplyRef<'a>>,
53 #[serde(borrow)]
54 pub subject: jacquard_common::types::string::AtUri<'a>,
55}
56
57/// Typed wrapper for GetRecord response with this collection's record type.
58#[derive(
59 serde::Serialize,
60 serde::Deserialize,
61 Debug,
62 Clone,
63 PartialEq,
64 Eq,
65 jacquard_derive::IntoStatic
66)]
67#[serde(rename_all = "camelCase")]
68pub struct CommentGetRecordOutput<'a> {
69 #[serde(skip_serializing_if = "std::option::Option::is_none")]
70 #[serde(borrow)]
71 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
72 #[serde(borrow)]
73 pub uri: jacquard_common::types::string::AtUri<'a>,
74 #[serde(borrow)]
75 pub value: Comment<'a>,
76}
77
78/// Marker type for deserializing records from this collection.
79pub struct CommentRecord;
80impl jacquard_common::xrpc::XrpcResp for CommentRecord {
81 const NSID: &'static str = "pub.leaflet.comment";
82 const ENCODING: &'static str = "application/json";
83 type Output<'de> = CommentGetRecordOutput<'de>;
84 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
85}
86
87impl jacquard_common::types::collection::Collection for Comment<'_> {
88 const NSID: &'static str = "pub.leaflet.comment";
89 type Record = CommentRecord;
90}
91
92impl From<CommentGetRecordOutput<'_>> for Comment<'_> {
93 fn from(output: CommentGetRecordOutput<'_>) -> Self {
94 use jacquard_common::IntoStatic;
95 output.value.into_static()
96 }
97}
98
99#[jacquard_derive::lexicon]
100#[derive(
101 serde::Serialize,
102 serde::Deserialize,
103 Debug,
104 Clone,
105 PartialEq,
106 Eq,
107 jacquard_derive::IntoStatic
108)]
109#[serde(rename_all = "camelCase")]
110pub struct ReplyRef<'a> {
111 #[serde(borrow)]
112 pub parent: jacquard_common::types::string::AtUri<'a>,
113}