Skip to main content

actpub_activitystreams/
kind.rs

1//! String type constants for every name defined in the Activity Streams 2.0
2//! vocabulary and the `ActivityPub` extension types.
3//!
4//! These constants are used to populate and match the `type` property on
5//! Activity Streams [`Object`](crate::Object) and [`Link`](crate::Link)
6//! values. Matching against a constant avoids typo-prone string literals
7//! throughout downstream code.
8
9/// Core Activity Streams 2.0 types, from the
10/// [Core specification](https://www.w3.org/TR/activitystreams-core/).
11pub mod core {
12    /// Base type for all AS 2.0 objects.
13    pub const OBJECT: &str = "Object";
14    /// Base type for link references.
15    pub const LINK: &str = "Link";
16    /// Base type for all activities.
17    pub const ACTIVITY: &str = "Activity";
18    /// Activity subtype without an `object` property.
19    pub const INTRANSITIVE_ACTIVITY: &str = "IntransitiveActivity";
20    /// Unordered collection of items.
21    pub const COLLECTION: &str = "Collection";
22    /// Ordered collection of items.
23    pub const ORDERED_COLLECTION: &str = "OrderedCollection";
24    /// A paged view of a [`COLLECTION`].
25    pub const COLLECTION_PAGE: &str = "CollectionPage";
26    /// A paged view of an [`ORDERED_COLLECTION`].
27    pub const ORDERED_COLLECTION_PAGE: &str = "OrderedCollectionPage";
28}
29
30/// Actor types — `ActivityPub` actors, from the
31/// [ActivityPub](https://www.w3.org/TR/activitypub/#actors) specification.
32pub mod actor {
33    /// A software application.
34    pub const APPLICATION: &str = "Application";
35    /// A formal or informal collective of actors.
36    pub const GROUP: &str = "Group";
37    /// An organization.
38    pub const ORGANIZATION: &str = "Organization";
39    /// An individual person.
40    pub const PERSON: &str = "Person";
41    /// A service provided by some entity.
42    pub const SERVICE: &str = "Service";
43}
44
45/// Activity vocabulary — the 28 standard activity verbs from
46/// [Activity Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/#activity-types).
47pub mod activity {
48    /// Accept the `object` activity.
49    pub const ACCEPT: &str = "Accept";
50    /// Add `object` to `target`.
51    pub const ADD: &str = "Add";
52    /// Share / boost the `object`.
53    pub const ANNOUNCE: &str = "Announce";
54    /// Arrive at `location`.
55    pub const ARRIVE: &str = "Arrive";
56    /// Block the `object` actor.
57    pub const BLOCK: &str = "Block";
58    /// Create a new `object`.
59    pub const CREATE: &str = "Create";
60    /// Delete the `object`.
61    pub const DELETE: &str = "Delete";
62    /// Dislike the `object`.
63    pub const DISLIKE: &str = "Dislike";
64    /// Flag the `object` for moderation.
65    pub const FLAG: &str = "Flag";
66    /// Follow the `object` actor.
67    pub const FOLLOW: &str = "Follow";
68    /// Ignore the `object`.
69    pub const IGNORE: &str = "Ignore";
70    /// Invite the `object` to a `target`.
71    pub const INVITE: &str = "Invite";
72    /// Join the `object`.
73    pub const JOIN: &str = "Join";
74    /// Leave the `object`.
75    pub const LEAVE: &str = "Leave";
76    /// Like the `object`.
77    pub const LIKE: &str = "Like";
78    /// Listen to the `object`.
79    pub const LISTEN: &str = "Listen";
80    /// Move `object` from `origin` to `target`.
81    pub const MOVE: &str = "Move";
82    /// Offer `object` to `target`.
83    pub const OFFER: &str = "Offer";
84    /// A poll or multiple-choice question.
85    pub const QUESTION: &str = "Question";
86    /// Reject the `object` activity.
87    pub const REJECT: &str = "Reject";
88    /// Mark the `object` as read.
89    pub const READ: &str = "Read";
90    /// Remove `object` from `target`.
91    pub const REMOVE: &str = "Remove";
92    /// Tentatively accept `object`.
93    pub const TENTATIVE_ACCEPT: &str = "TentativeAccept";
94    /// Tentatively reject `object`.
95    pub const TENTATIVE_REJECT: &str = "TentativeReject";
96    /// Travel to `target`.
97    pub const TRAVEL: &str = "Travel";
98    /// Undo a prior activity.
99    pub const UNDO: &str = "Undo";
100    /// Update the `object`.
101    pub const UPDATE: &str = "Update";
102    /// Observe the `object`.
103    pub const VIEW: &str = "View";
104}
105
106/// Concrete object subtypes — the 12 standard extended object types from
107/// [Activity Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/#object-types).
108pub mod object {
109    /// Article content (blog post, news piece).
110    pub const ARTICLE: &str = "Article";
111    /// Audio media.
112    pub const AUDIO: &str = "Audio";
113    /// Generic document.
114    pub const DOCUMENT: &str = "Document";
115    /// An event.
116    pub const EVENT: &str = "Event";
117    /// Image media.
118    pub const IMAGE: &str = "Image";
119    /// A short note — the de-facto microblog post type.
120    pub const NOTE: &str = "Note";
121    /// A web page.
122    pub const PAGE: &str = "Page";
123    /// A physical or virtual location.
124    pub const PLACE: &str = "Place";
125    /// A user profile.
126    pub const PROFILE: &str = "Profile";
127    /// A relationship between two objects.
128    pub const RELATIONSHIP: &str = "Relationship";
129    /// A placeholder for a deleted object.
130    pub const TOMBSTONE: &str = "Tombstone";
131    /// Video media.
132    pub const VIDEO: &str = "Video";
133}
134
135/// Link subtypes from
136/// [Activity Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/#link-types)
137/// and community extensions (FEP / SWICG).
138pub mod link {
139    /// A reference to a specific actor in a message (`@username`).
140    pub const MENTION: &str = "Mention";
141    /// A tagging reference used for categorisation (`#tag`). Defined in
142    /// [ActivityPub Miscellaneous Terms](https://swicg.github.io/miscellany/).
143    pub const HASHTAG: &str = "Hashtag";
144    /// Custom inline emoji reference used by Mastodon and compatibles.
145    pub const EMOJI: &str = "Emoji";
146}