pleroma-archive/src/pleroma/activity.rs

148 lines
3.6 KiB
Rust

#![allow(unused)]
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Activities {
#[serde(rename = "@context")]
pub(crate) context: String,
pub(crate) id: String,
#[serde(rename = "type")]
pub(crate) activities_type: String,
pub(crate) ordered_items: Vec<OrderedItem>,
pub(crate) total_items: i64,
}
#[derive(Debug, Clone, Deserialize)]
pub struct OrderedItem {
pub(crate) actor: String,
pub(crate) cc: Vec<String>,
pub(crate) context: String,
pub(crate) context_id: Option<i64>,
#[serde(default, rename = "directMessage")]
pub(crate) direct_message: bool,
pub(crate) id: String,
pub(crate) object: ObjectUnion,
pub(crate) published: String,
pub(crate) to: Vec<String>,
#[serde(rename = "type")]
pub(crate) ordered_item_type: OrderedItemType,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum ObjectUnion {
ObjectClass(Activity),
String(String),
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Activity {
pub(crate) actor: String,
pub(crate) attachment: Vec<Attachment>,
pub(crate) attributed_to: String,
pub(crate) cc: Vec<String>,
pub(crate) content: String,
pub(crate) context: String,
pub(crate) conversation: String,
pub(crate) id: String,
pub(crate) in_reply_to: Option<String>,
pub(crate) in_reply_to_status_id: Option<String>,
pub(crate) published: String,
pub(crate) summary: Option<String>,
pub(crate) tag: Vec<Tag>,
pub(crate) to: Vec<String>,
#[serde(rename = "type")]
pub(crate) object_type: OneOfType,
pub(crate) sensitive: Option<bool>,
pub(crate) replies_count: Option<i64>,
pub(crate) replies: Option<ObjectReplies>,
pub(crate) closed: Option<String>,
pub(crate) one_of: Option<Vec<OneOf>>,
pub(crate) source: Option<SourceUnion>,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Attachment {
pub(crate) media_type: String,
pub(crate) name: String,
#[serde(rename = "type")]
pub(crate) attachment_type: AttachmentType,
pub(crate) url: String,
}
#[derive(Debug, Clone, Deserialize)]
pub enum AttachmentType {
Document,
}
#[derive(Debug, Clone, Deserialize)]
pub enum OneOfType {
Note,
Question,
}
#[derive(Debug, Clone, Deserialize)]
pub struct OneOf {
pub(crate) name: String,
pub(crate) replies: OneOfReplies,
#[serde(rename = "type")]
pub(crate) one_of_type: OneOfType,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OneOfReplies {
pub(crate) total_items: i64,
#[serde(rename = "type")]
pub(crate) replies_type: RepliesType,
}
#[derive(Debug, Clone, Deserialize)]
pub enum RepliesType {
Collection,
}
#[derive(Debug, Clone, Deserialize)]
pub struct ObjectReplies {
pub(crate) items: Vec<String>,
#[serde(rename = "type")]
pub(crate) replies_type: RepliesType,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum SourceUnion {
SourceClass(SourceClass),
String(String),
}
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceClass {
pub(crate) content: String,
pub(crate) media_type: String,
}
#[derive(Debug, Clone, Deserialize)]
pub struct Tag {
pub(crate) href: String,
pub(crate) name: String,
#[serde(rename = "type")]
pub(crate) tag_type: TagType,
}
#[derive(Debug, Clone, Deserialize)]
pub enum TagType {
Hashtag,
Mention,
}
#[derive(Debug, Clone, Deserialize)]
pub enum OrderedItemType {
Announce,
Create,
}