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