]> Untitled Git - lemmy.git/blob - crates/apub/src/protocol/activities/deletion/delete.rs
Extract Activitypub logic into separate library (#2288)
[lemmy.git] / crates / apub / src / protocol / activities / deletion / delete.rs
1 use crate::{
2   objects::person::ApubPerson,
3   protocol::{objects::tombstone::Tombstone, IdOrNestedObject, Unparsed},
4 };
5 use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
6 use activitystreams_kinds::activity::DeleteType;
7 use serde::{Deserialize, Serialize};
8 use serde_with::skip_serializing_none;
9 use url::Url;
10
11 #[skip_serializing_none]
12 #[derive(Clone, Debug, Deserialize, Serialize)]
13 #[serde(rename_all = "camelCase")]
14 pub struct Delete {
15   pub(crate) actor: ObjectId<ApubPerson>,
16   #[serde(deserialize_with = "deserialize_one_or_many")]
17   pub(crate) to: Vec<Url>,
18   pub(crate) object: IdOrNestedObject<Tombstone>,
19   #[serde(rename = "type")]
20   pub(crate) kind: DeleteType,
21   pub(crate) id: Url,
22
23   #[serde(deserialize_with = "deserialize_one_or_many")]
24   #[serde(default)]
25   #[serde(skip_serializing_if = "Vec::is_empty")]
26   pub(crate) cc: Vec<Url>,
27   /// If summary is present, this is a mod action (Remove in Lemmy terms). Otherwise, its a user
28   /// deleting their own content.
29   pub(crate) summary: Option<String>,
30   #[serde(flatten)]
31   pub(crate) unparsed: Unparsed,
32 }