1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
use serde::{Deserialize, Serialize}; use crate::properties::*; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(untagged)] pub enum Object { Brief(String), Full { attachment: Option<Attachment>, #[serde(rename = "attributedTo")] attributed_to: Option<AttributedTo>, audience: Option<Audience>, #[serde(rename = "@context")] context: Option<Context>, #[serde(rename = "type")] kind: Kind, }, } #[derive(Clone, Debug, Serialize, Deserialize)] pub enum Link { Brief(String), Full {}, } #[cfg(test)] mod tests { use super::*; use crate::parse_test; parse_test!( object, r#"{ "@context": "https://www.w3.org/ns/activitystreams", "type": "Object", "id": "http://www.test.example/object/1", "name": "A Simple, non-specific object" }"# ); }