use crate::{ objects::{person::ApubPerson, private_message::ApubPrivateMessage}, protocol::{Source, Unparsed}, }; use chrono::{DateTime, FixedOffset}; use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml}; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; #[skip_serializing_none] #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChatMessage { pub(crate) r#type: ChatMessageType, pub(crate) id: ObjectId, pub(crate) attributed_to: ObjectId, #[serde(deserialize_with = "crate::deserialize_one")] pub(crate) to: [ObjectId; 1], pub(crate) content: String, pub(crate) media_type: Option, pub(crate) source: Option, pub(crate) published: Option>, pub(crate) updated: Option>, #[serde(flatten)] pub(crate) unparsed: Unparsed, } /// https://docs.pleroma.social/backend/development/ap_extensions/#chatmessages #[derive(Clone, Debug, Deserialize, Serialize)] pub enum ChatMessageType { ChatMessage, }