jacquard_api/place_stream/chat/
message.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: place.stream.chat.message
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8///Record containing a Streamplace chat message.
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)]
19#[serde(rename_all = "camelCase")]
20pub struct Message<'a> {
21    ///Client-declared timestamp when this message was originally created.
22    pub created_at: jacquard_common::types::string::Datetime,
23    ///Annotations of text (mentions, URLs, etc)
24    #[serde(skip_serializing_if = "std::option::Option::is_none")]
25    #[serde(borrow)]
26    pub facets: std::option::Option<
27        Vec<crate::place_stream::richtext::facet::Facet<'a>>,
28    >,
29    #[serde(skip_serializing_if = "std::option::Option::is_none")]
30    #[serde(borrow)]
31    pub reply: std::option::Option<crate::place_stream::chat::message::ReplyRef<'a>>,
32    ///The DID of the streamer whose chat this is.
33    #[serde(borrow)]
34    pub streamer: jacquard_common::types::string::Did<'a>,
35    ///The primary message content. May be an empty string, if there are embeds.
36    #[serde(borrow)]
37    pub text: jacquard_common::CowStr<'a>,
38}
39
40/// Typed wrapper for GetRecord response with this collection's record type.
41#[derive(
42    serde::Serialize,
43    serde::Deserialize,
44    Debug,
45    Clone,
46    PartialEq,
47    Eq,
48    jacquard_derive::IntoStatic
49)]
50#[serde(rename_all = "camelCase")]
51pub struct MessageGetRecordOutput<'a> {
52    #[serde(skip_serializing_if = "std::option::Option::is_none")]
53    #[serde(borrow)]
54    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
55    #[serde(borrow)]
56    pub uri: jacquard_common::types::string::AtUri<'a>,
57    #[serde(borrow)]
58    pub value: Message<'a>,
59}
60
61/// Marker type for deserializing records from this collection.
62pub struct MessageRecord;
63impl jacquard_common::xrpc::XrpcResp for MessageRecord {
64    const NSID: &'static str = "place.stream.chat.message";
65    const ENCODING: &'static str = "application/json";
66    type Output<'de> = MessageGetRecordOutput<'de>;
67    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
68}
69
70impl jacquard_common::types::collection::Collection for Message<'_> {
71    const NSID: &'static str = "place.stream.chat.message";
72    type Record = MessageRecord;
73}
74
75impl From<MessageGetRecordOutput<'_>> for Message<'_> {
76    fn from(output: MessageGetRecordOutput<'_>) -> Self {
77        use jacquard_common::IntoStatic;
78        output.value.into_static()
79    }
80}
81
82#[jacquard_derive::lexicon]
83#[derive(
84    serde::Serialize,
85    serde::Deserialize,
86    Debug,
87    Clone,
88    PartialEq,
89    Eq,
90    jacquard_derive::IntoStatic
91)]
92#[serde(rename_all = "camelCase")]
93pub struct ReplyRef<'a> {
94    #[serde(borrow)]
95    pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
96    #[serde(borrow)]
97    pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
98}