activitystreams_types/activity/delete.rs
1/*
2 * This file is part of ActivityStreams Types.
3 *
4 * Copyright © 2018 Riley Trautman
5 *
6 * ActivityStreams Types is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ActivityStreams Types is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20use activitystreams_derive::Properties;
21use activitystreams_traits::{Activity, Object};
22use serde_derive::{Deserialize, Serialize};
23
24use super::{
25 kind::DeleteType,
26 properties::{ActivityProperties, DeleteProperties},
27 ActivityExt,
28};
29use crate::object::{properties::ObjectProperties, ObjectExt};
30
31/// Indicates that the actor has deleted the object.
32///
33/// If specified, the origin indicates the context from which the object was deleted.
34#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
35#[serde(rename_all = "camelCase")]
36pub struct Delete {
37 #[serde(rename = "type")]
38 #[serde(alias = "objectType")]
39 #[serde(alias = "verb")]
40 pub kind: DeleteType,
41
42 /// Adds all valid delete properties to this struct
43 #[serde(flatten)]
44 pub delete_props: DeleteProperties,
45
46 /// Adds all valid object properties to this struct
47 #[serde(flatten)]
48 pub object_props: ObjectProperties,
49
50 /// Adds all valid activity properties to this struct
51 #[serde(flatten)]
52 pub activity_props: ActivityProperties,
53}
54
55impl Object for Delete {}
56impl ObjectExt for Delete {
57 fn props(&self) -> &ObjectProperties {
58 &self.object_props
59 }
60
61 fn props_mut(&mut self) -> &mut ObjectProperties {
62 &mut self.object_props
63 }
64}
65impl Activity for Delete {}
66impl ActivityExt for Delete {
67 fn props(&self) -> &ActivityProperties {
68 &self.activity_props
69 }
70
71 fn props_mut(&mut self) -> &mut ActivityProperties {
72 &mut self.activity_props
73 }
74}