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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use std::collections::HashMap;

use rustpub_macro::complex_property;

use crate::simple::core;

pub trait ActivitypubProperty {
    fn is_none(&self) -> bool;
    fn is_some(&self) -> bool;
}

pub fn context() -> Context {
    Context::Link(Box::new(
        core::LinkBuilder::default()
            .href(Href::String("https://www.w3.org/ns/activitystreams".into()))
            .build()
            .unwrap(),
    ))
}

complex_property! {functional Id { string: String }}
complex_property! {functional Kind { string: String }}
complex_property! {Actor { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Attachment { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {AttributedTo { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Audience { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {BCC { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {BTo { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {CC { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Context { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {functional Current { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {functional First { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Generator { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Icon { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Image { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {InReplyTo { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Instrument { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {functional Last { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Location { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Items { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {OneOf { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {AnyOf { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Closed { object: Box<core::Object>, link: Box<core::Link>, datetime: chrono::NaiveDateTime, bool: bool }}
complex_property! {Origin { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {functional Next { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Object { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {functional Prev { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Preview { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Result { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {functional Replies { object: Box<core::Object> }}
complex_property! {Tag { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Target { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {To { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Url { string: String, link: Box<core::Link> }}
complex_property! {functional Accuracy { float: f32 }}
complex_property! {functional Altitude { float: f32 }}
complex_property! {functional Content { string: String, strings: Vec<String>, map: HashMap<String, String> }}
complex_property! {functional Name { string: String, strings: Vec<String>, map: HashMap<String, String> }}
complex_property! {functional Duration { string: String }} // chrono::Duration doesn't impl serde
complex_property! {functional Height { integer: u32 }}
complex_property! {functional Href { string: String }}
complex_property! {functional HrefLang { string: String }}
complex_property! {functional PartOf { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {functional Latitude { float: f32 }}
complex_property! {functional Longitude { float: f32 }}
complex_property! {functional MediaType { string: String }}
complex_property! {functional EndTime { datetime: chrono::NaiveDateTime }}
complex_property! {functional Published { datetime: chrono::NaiveDateTime }}
complex_property! {functional StartTime { datetime: chrono::NaiveDateTime }}
complex_property! {functional Radius { float: f32 }}
complex_property! {Rel { string: String }}
complex_property! {functional StartIndex { integer: u32 }}
complex_property! {functional Summary { string: String, strings: Vec<String>, map: HashMap<String, String> }}
complex_property! {functional TotalItems { integer: u32 }}
complex_property! {functional Units { string: String }}
complex_property! {functional Updated { datetime: chrono::NaiveDateTime }}
complex_property! {functional Width { integer: u32 }}
complex_property! {functional Subject { object: Box<core::Object>, link: Box<core::Link> }}
complex_property! {Relationship { object: Box<core::Object> }}
complex_property! {functional Describes { object: Box<core::Object> }}
complex_property! {FormerType { object: Box<core::Object> }}
complex_property! {functional Deleted { datetime: chrono::NaiveDateTime }}

// extensions
complex_property! {functional PublicKey { object: Box<core::Object> }}
complex_property! {functional PublicKeyPem { string: String }}
complex_property! {functional PreferredUsername { string: String }}
complex_property! {functional Owner { string: String }}
complex_property! {functional Inbox { string: String }}
complex_property! {functional Outbox { string: String }}
complex_property! {functional Followers { string: String }}
complex_property! {functional Following { string: String }}