2021-11-03 16:26:09 +00:00
|
|
|
use crate::{
|
|
|
|
objects::{person::ApubPerson, private_message::ApubPrivateMessage},
|
2021-11-19 17:47:06 +00:00
|
|
|
protocol::{Source, Unparsed},
|
2021-10-28 21:17:59 +00:00
|
|
|
};
|
2021-11-19 17:47:06 +00:00
|
|
|
use chrono::{DateTime, FixedOffset};
|
2021-11-06 17:35:14 +00:00
|
|
|
use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml};
|
2021-10-28 21:17:59 +00:00
|
|
|
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,
|
2021-11-03 16:26:09 +00:00
|
|
|
pub(crate) id: ObjectId<ApubPrivateMessage>,
|
2021-10-28 21:17:59 +00:00
|
|
|
pub(crate) attributed_to: ObjectId<ApubPerson>,
|
|
|
|
pub(crate) to: [ObjectId<ApubPerson>; 1],
|
|
|
|
pub(crate) content: String,
|
|
|
|
pub(crate) media_type: Option<MediaTypeHtml>,
|
|
|
|
pub(crate) source: Option<Source>,
|
|
|
|
pub(crate) published: Option<DateTime<FixedOffset>>,
|
|
|
|
pub(crate) updated: Option<DateTime<FixedOffset>>,
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub(crate) unparsed: Unparsed,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// https://docs.pleroma.social/backend/development/ap_extensions/#chatmessages
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
pub enum ChatMessageType {
|
|
|
|
ChatMessage,
|
|
|
|
}
|