rustpub 0.1.0

An implementation of the Activitypub types
Documentation
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"
        }"#
    );
}