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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
 * This file is part of ActivityStreams.
 *
 * Copyright © 2020 Riley Trautman
 *
 * ActivityStreams is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ActivityStreams is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ActivityStreams.  If not, see <http://www.gnu.org/licenses/>.
 */

//! Namespace for properties of standard Actor types
//!
//! To use these properties in your own types, you can flatten them into your struct with serde:
//!
//! ```rust
//! use activitystreams::{
//!     actor::{
//!         properties::ApActorProperties,
//!         Actor, ActorBox,
//!     },
//!     object::{
//!         properties::{ApObjectProperties, ObjectProperties},
//!         Object, ObjectBox,
//!     },
//!     PropRefs,
//! };
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)]
//! #[serde(rename_all = "camelCase")]
//! #[prop_refs(Object)]
//! #[prop_refs(Actor)]
//! pub struct MyActor {
//!     #[serde(rename = "type")]
//!     pub kind: String,
//!
//!     /// Define a require property for the MyActor type
//!     pub my_property: String,
//!
//!     #[serde(flatten)]
//!     #[prop_refs]
//!     pub object_props: ObjectProperties,
//!
//!     #[serde(flatten)]
//!     #[prop_refs]
//!     pub ap_object_props: ApObjectProperties,
//!
//!     #[serde(flatten)]
//!     #[prop_refs]
//!     pub actor_props: ApActorProperties,
//! }
//! #
//! # fn main() {}
//! ```

use crate::{
    endpoint::EndpointProperties,
    primitives::{XsdAnyUri, XsdString},
    properties,
};

properties! {
    ApActor {
        docs [
            "Define activitypub properties for the Actor type as described by the Activity Pub vocabulary."
        ],

        inbox {
            docs [
                "A reference to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)]",
                "OrderedCollection comprised of all the messages received by the actor.",
                "",
                "- Range: `xsd:anyUri`",
                "- Functional: true",
            ],
            types [ XsdAnyUri ],
            functional,
            required,
        },

        outbox {
            docs [
                "An [ActivityStreams](https://www.w3.org/ns/activitystreams)] OrderedCollection comprised of",
                "all the messages produced by the actor.",
                "",
                "- Range: `xsd:anyUri`",
                "- Functional: true",
            ],
            types [ XsdAnyUri ],
            functional,
            required,
        },

        following {
            docs [
                "A link to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)] collection of the",
                "actors that this actor is following.",
                "",
                "- Range: `xsd:anyUri`",
                "- Functional: true",
            ],
            types [ XsdAnyUri ],
            functional,
        },

        followers {
            docs [
                "A link to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)] collection of the",
                "actors that follow this actor.",
                "",
                "- Range: `xsd:anyUri`",
                "- Functional: true",
            ],
            types [ XsdAnyUri ],
            functional,
        },

        liked {
            docs [
                "A link to an [[ActivityStreams](https://www.w3.org/ns/activitystreams)] collection of",
                "objects this actor has liked.",
                "",
                "- Range: `xsd:anyUri`",
                "- Functional: true",
            ],
            types [ XsdAnyUri ],
            functional,
        },

        streams {
            docs [
                "A list of supplementary Collections which may be of interest.",
                "",
                "- Range: `xsd:anyUri`",
                "- Functional: false",
            ],
            types [ XsdAnyUri ],
        },

        preferred_username {
            docs [
                "A short username which may be used to refer to the actor, with no uniqueness guarantees.",
                "",
                "- Range: `xsd:string`",
                "- Functional: true",
            ],
            types [ XsdString ],
            functional,
        },

        endpoints {
            docs [
                "A json object which maps additional (typically server/domain-wide) endpoints which may be",
                "useful either for this actor or someone referencing this actor.",
                "",
                "This mapping may be nested inside the actor document as the value or may be a link to a",
                "JSON-LD document with these properties.",
                "",
                "- Range: `Endpoint`",
                "- Functional: true",
            ],
            types [ EndpointProperties ],
            functional,
        },
    }
}