From 677c8670ec0a8a27f311299d0aaef08411d13e55 Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 18 May 2018 19:38:14 -0500 Subject: [PATCH] Move activity props into properties module --- Cargo.toml | 4 +- README.md | 2 +- activitystreams-types/Cargo.toml | 2 +- activitystreams-types/README.md | 2 +- activitystreams-types/src/activity/accept.rs | 30 +- activitystreams-types/src/activity/add.rs | 30 +- activitystreams-types/src/activity/amove.rs | 55 +-- .../src/activity/announce.rs | 43 +- activitystreams-types/src/activity/arrive.rs | 31 +- activitystreams-types/src/activity/block.rs | 30 +- activitystreams-types/src/activity/create.rs | 30 +- activitystreams-types/src/activity/delete.rs | 42 +- activitystreams-types/src/activity/dislike.rs | 30 +- activitystreams-types/src/activity/flag.rs | 30 +- activitystreams-types/src/activity/follow.rs | 30 +- activitystreams-types/src/activity/ignore.rs | 30 +- activitystreams-types/src/activity/invite.rs | 42 +- activitystreams-types/src/activity/join.rs | 30 +- activitystreams-types/src/activity/leave.rs | 30 +- activitystreams-types/src/activity/like.rs | 30 +- activitystreams-types/src/activity/listen.rs | 30 +- activitystreams-types/src/activity/offer.rs | 43 +- .../src/activity/properties.rs | 368 ++++++++++++++++++ .../src/activity/question.rs | 31 +- activitystreams-types/src/activity/read.rs | 30 +- activitystreams-types/src/activity/reject.rs | 30 +- activitystreams-types/src/activity/remove.rs | 55 +-- .../src/activity/tentative_accept.rs | 30 +- .../src/activity/tentative_reject.rs | 30 +- activitystreams-types/src/activity/travel.rs | 45 +-- activitystreams-types/src/activity/undo.rs | 30 +- activitystreams-types/src/activity/update.rs | 30 +- activitystreams-types/src/activity/view.rs | 30 +- 33 files changed, 569 insertions(+), 766 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9641fa9..8976540 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "activitystreams" description = "Activity Streams in Rust" -version = "0.1.1" +version = "0.2.0" license = "GPL-3.0" authors = ["asonix "] repository = "https://github.com/asonix/activitystreams" @@ -10,7 +10,7 @@ keywords = ["activitystreams", "activitypub"] [dependencies] activitystreams-traits = { version = "0.1", path = "activitystreams-traits" } -activitystreams-types = { version = "0.1", path = "activitystreams-types" } +activitystreams-types = { version = "0.2", path = "activitystreams-types" } [dev-dependencies] failure = "0.1" diff --git a/README.md b/README.md index 1296763..bca9895 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ For basic use, add the following to your Cargo.toml ```toml # Cargo.toml -activitystreams = "0.1" +activitystreams = "0.2" ``` And then use it in your project diff --git a/activitystreams-types/Cargo.toml b/activitystreams-types/Cargo.toml index a54f311..be6a54c 100644 --- a/activitystreams-types/Cargo.toml +++ b/activitystreams-types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "activitystreams-types" description = "Base types from the Activity Streams spec" -version = "0.1.1" +version = "0.2.0" license = "GPL-3.0" authors = ["asonix "] repository = "https://github.com/asonix/activitystreams" diff --git a/activitystreams-types/README.md b/activitystreams-types/README.md index 36d527f..2cdc705 100644 --- a/activitystreams-types/README.md +++ b/activitystreams-types/README.md @@ -6,7 +6,7 @@ First, add the crate to your cargo.toml ```toml # Cargo.toml -activitystreams-types = "0.1" +activitystreams-types = "0.2" ``` Then use it in your project! diff --git a/activitystreams-types/src/activity/accept.rs b/activitystreams-types/src/activity/accept.rs index 5bcf48f..4218e8c 100644 --- a/activitystreams-types/src/activity/accept.rs +++ b/activitystreams-types/src/activity/accept.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::AcceptType, properties::ActivityProperties}; +use super::{ + kind::AcceptType, properties::{AcceptProperties, ActivityProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor accepts the object. @@ -33,26 +34,9 @@ pub struct Accept { #[serde(rename = "type")] pub kind: AcceptType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid accept properties to this struct + #[serde(flatten)] + pub accept_props: AcceptProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/add.rs b/activitystreams-types/src/activity/add.rs index 8dd37b8..e590a44 100644 --- a/activitystreams-types/src/activity/add.rs +++ b/activitystreams-types/src/activity/add.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::AddType, properties::ActivityProperties}; +use super::{ + kind::AddType, properties::{ActivityProperties, AddProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has added the object to the target. @@ -34,26 +35,9 @@ pub struct Add { #[serde(rename = "type")] pub kind: AddType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid add properties to this struct + #[serde(flatten)] + pub add_props: AddProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/amove.rs b/activitystreams-types/src/activity/amove.rs index 84b6d62..3992f93 100644 --- a/activitystreams-types/src/activity/amove.rs +++ b/activitystreams-types/src/activity/amove.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::MoveType, properties::ActivityProperties}; +use super::{ + kind::MoveType, properties::{ActivityProperties, MoveProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has moved object from origin to target. @@ -32,51 +33,9 @@ pub struct AMove { #[serde(rename = "type")] pub kind: MoveType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, - - /// Describes an indirect object of the activity from which the activity is directed. - /// - /// The precise meaning of the origin is the object of the English preposition "from". For - /// instance, in the activity "John moved an item to List B from List A", the origin of the - /// activity is "List A". - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub origin: Option, - - /// Describes the indirect object, or target, of the activity. - /// - /// The precise meaning of the target is largely dependent on the type of action being - /// described but will often be the object of the English preposition "to". For instance, in - /// the activity "John added a movie to his wishlist", the target of the activity is John's - /// wishlist. An activity can have more than one target - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub target: Option, + /// Adds all valid move properties to this struct + #[serde(flatten)] + pub move_props: MoveProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/announce.rs b/activitystreams-types/src/activity/announce.rs index 61d1226..d98decf 100644 --- a/activitystreams-types/src/activity/announce.rs +++ b/activitystreams-types/src/activity/announce.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::AnnounceType, properties::ActivityProperties}; +use super::{ + kind::AnnounceType, properties::{ActivityProperties, AnnounceProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is calling the target's attention the object. @@ -32,39 +33,9 @@ pub struct Announce { #[serde(rename = "type")] pub kind: AnnounceType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, - - /// Describes the indirect object, or target, of the activity. - /// - /// The precise meaning of the target is largely dependent on the type of action being - /// described but will often be the object of the English preposition "to". For instance, in - /// the activity "John added a movie to his wishlist", the target of the activity is John's - /// wishlist. An activity can have more than one target - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub target: Option, + /// Adds all valid announce properties to this struct + #[serde(flatten)] + pub announce_props: AnnounceProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/arrive.rs b/activitystreams-types/src/activity/arrive.rs index 1f20add..ec84f6c 100644 --- a/activitystreams-types/src/activity/arrive.rs +++ b/activitystreams-types/src/activity/arrive.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, IntransitiveActivity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, IntransitiveActivity, Object}; -use super::{kind::ArriveType, properties::ActivityProperties}; +use super::{ + kind::ArriveType, properties::{ActivityProperties, ArriveProperties}, +}; use object::properties::ObjectProperties; /// An IntransitiveActivity that indicates that the actor has arrived at the location. @@ -33,27 +34,9 @@ pub struct Arrive { #[serde(rename = "type")] pub kind: ArriveType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// Describes an indirect object of the activity from which the activity is directed. - /// - /// The precise meaning of the origin is the object of the English preposition "from". For - /// instance, in the activity "John moved an item to List B from List A", the origin of the - /// activity is "List A". - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub origin: serde_json::Value, + /// Adds all valid arrive properties to this struct + #[serde(flatten)] + pub arrive_props: ArriveProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/block.rs b/activitystreams-types/src/activity/block.rs index 32b9194..30364b2 100644 --- a/activitystreams-types/src/activity/block.rs +++ b/activitystreams-types/src/activity/block.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::BlockType, properties::ActivityProperties}; +use super::{ + kind::BlockType, properties::{ActivityProperties, BlockProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is blocking the object. @@ -34,26 +35,9 @@ pub struct Block { #[serde(rename = "type")] pub kind: BlockType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid block properties to this struct + #[serde(flatten)] + pub block_props: BlockProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/create.rs b/activitystreams-types/src/activity/create.rs index 01dd66d..814cbd2 100644 --- a/activitystreams-types/src/activity/create.rs +++ b/activitystreams-types/src/activity/create.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::CreateType, properties::ActivityProperties}; +use super::{ + kind::CreateType, properties::{ActivityProperties, CreateProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has created the object. @@ -30,26 +31,9 @@ pub struct Create { #[serde(rename = "type")] pub kind: CreateType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid create properties to this struct + #[serde(flatten)] + pub create_props: CreateProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/delete.rs b/activitystreams-types/src/activity/delete.rs index c9949ee..162c780 100644 --- a/activitystreams-types/src/activity/delete.rs +++ b/activitystreams-types/src/activity/delete.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::DeleteType, properties::ActivityProperties}; +use super::{ + kind::DeleteType, properties::{ActivityProperties, DeleteProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has deleted the object. @@ -32,38 +33,9 @@ pub struct Delete { #[serde(rename = "type")] pub kind: DeleteType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, - - /// Describes an indirect object of the activity from which the activity is directed. - /// - /// The precise meaning of the origin is the object of the English preposition "from". For - /// instance, in the activity "John moved an item to List B from List A", the origin of the - /// activity is "List A". - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub origin: Option, + /// Adds all valid delete properties to this struct + #[serde(flatten)] + pub delete_props: DeleteProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/dislike.rs b/activitystreams-types/src/activity/dislike.rs index 164bd6f..3323d91 100644 --- a/activitystreams-types/src/activity/dislike.rs +++ b/activitystreams-types/src/activity/dislike.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::DislikeType, properties::ActivityProperties}; +use super::{ + kind::DislikeType, properties::{ActivityProperties, DislikeProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor dislikes the object. @@ -30,26 +31,9 @@ pub struct Dislike { #[serde(rename = "type")] pub kind: DislikeType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid dislike properties to this struct + #[serde(flatten)] + pub dislike_props: DislikeProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/flag.rs b/activitystreams-types/src/activity/flag.rs index 4c7cbcd..e037ef7 100644 --- a/activitystreams-types/src/activity/flag.rs +++ b/activitystreams-types/src/activity/flag.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::FlagType, properties::ActivityProperties}; +use super::{ + kind::FlagType, properties::{ActivityProperties, FlagProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is "flagging" the object. @@ -33,26 +34,9 @@ pub struct Flag { #[serde(rename = "type")] pub kind: FlagType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid flag properties to this struct + #[serde(flatten)] + pub flag_props: FlagProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/follow.rs b/activitystreams-types/src/activity/follow.rs index 20ab215..e7e5075 100644 --- a/activitystreams-types/src/activity/follow.rs +++ b/activitystreams-types/src/activity/follow.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::FollowType, properties::ActivityProperties}; +use super::{ + kind::FollowType, properties::{ActivityProperties, FollowProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is "following" the object. @@ -34,26 +35,9 @@ pub struct Follow { #[serde(rename = "type")] pub kind: FollowType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid follow properties to this struct + #[serde(flatten)] + pub follow_props: FollowProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/ignore.rs b/activitystreams-types/src/activity/ignore.rs index ca7689b..496c8ac 100644 --- a/activitystreams-types/src/activity/ignore.rs +++ b/activitystreams-types/src/activity/ignore.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::IgnoreType, properties::ActivityProperties}; +use super::{ + kind::IgnoreType, properties::{ActivityProperties, IgnoreProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is ignoring the object. @@ -32,26 +33,9 @@ pub struct Ignore { #[serde(rename = "type")] pub kind: IgnoreType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid ignore properties to this struct + #[serde(flatten)] + pub ignore_props: IgnoreProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/invite.rs b/activitystreams-types/src/activity/invite.rs index 3d79011..7bbd88a 100644 --- a/activitystreams-types/src/activity/invite.rs +++ b/activitystreams-types/src/activity/invite.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::InviteType, properties::ActivityProperties}; +use super::{ + kind::InviteType, properties::{ActivityProperties, InviteProperties}, +}; use object::properties::ObjectProperties; /// A specialization of Offer in which the actor is extending an invitation for the object to the @@ -31,38 +32,9 @@ pub struct Invite { #[serde(rename = "type")] pub kind: InviteType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, - - /// Describes the indirect object, or target, of the activity. - /// - /// The precise meaning of the target is largely dependent on the type of action being - /// described but will often be the object of the English preposition "to". For instance, in - /// the activity "John added a movie to his wishlist", the target of the activity is John's - /// wishlist. An activity can have more than one target - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub target: serde_json::Value, + /// Adds all valid invite properties to this struct + #[serde(flatten)] + pub invite_props: InviteProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/join.rs b/activitystreams-types/src/activity/join.rs index 81ad73a..6e929cd 100644 --- a/activitystreams-types/src/activity/join.rs +++ b/activitystreams-types/src/activity/join.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::JoinType, properties::ActivityProperties}; +use super::{ + kind::JoinType, properties::{ActivityProperties, JoinProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has joined the object. @@ -32,26 +33,9 @@ pub struct Join { #[serde(rename = "type")] pub kind: JoinType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid join properties to this struct + #[serde(flatten)] + pub join_props: JoinProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/leave.rs b/activitystreams-types/src/activity/leave.rs index 6de1281..2e54dd4 100644 --- a/activitystreams-types/src/activity/leave.rs +++ b/activitystreams-types/src/activity/leave.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::LeaveType, properties::ActivityProperties}; +use super::{ + kind::LeaveType, properties::{ActivityProperties, LeaveProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has left the object. @@ -32,26 +33,9 @@ pub struct Leave { #[serde(rename = "type")] pub kind: LeaveType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid leave properties to this struct + #[serde(flatten)] + pub leave_props: LeaveProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/like.rs b/activitystreams-types/src/activity/like.rs index ea3090e..57b3284 100644 --- a/activitystreams-types/src/activity/like.rs +++ b/activitystreams-types/src/activity/like.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::LikeType, properties::ActivityProperties}; +use super::{ + kind::LikeType, properties::{ActivityProperties, LikeProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor likes, recommends or endorses the object. @@ -32,26 +33,9 @@ pub struct Like { #[serde(rename = "type")] pub kind: LikeType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid like properties to this struct + #[serde(flatten)] + pub like_props: LikeProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/listen.rs b/activitystreams-types/src/activity/listen.rs index efb5034..28c2d3a 100644 --- a/activitystreams-types/src/activity/listen.rs +++ b/activitystreams-types/src/activity/listen.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::ListenType, properties::ActivityProperties}; +use super::{ + kind::ListenType, properties::{ActivityProperties, ListenProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has listened to the object. @@ -30,26 +31,9 @@ pub struct Listen { #[serde(rename = "type")] kind: ListenType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - object: serde_json::Value, + /// Adds all valid listen properties to this struct + #[serde(flatten)] + pub listen_props: ListenProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/offer.rs b/activitystreams-types/src/activity/offer.rs index 0c89b09..4284b2b 100644 --- a/activitystreams-types/src/activity/offer.rs +++ b/activitystreams-types/src/activity/offer.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::OfferType, properties::ActivityProperties}; +use super::{ + kind::OfferType, properties::{ActivityProperties, OfferProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is offering the object. @@ -32,39 +33,9 @@ pub struct Offer { #[serde(rename = "type")] pub kind: OfferType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, - - /// Describes the indirect object, or target, of the activity. - /// - /// The precise meaning of the target is largely dependent on the type of action being - /// described but will often be the object of the English preposition "to". For instance, in - /// the activity "John added a movie to his wishlist", the target of the activity is John's - /// wishlist. An activity can have more than one target - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub target: Option, + /// Adds all valid object properties to this struct + #[serde(flatten)] + pub offer_props: OfferProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/properties.rs b/activitystreams-types/src/activity/properties.rs index b69eb3e..6e8216b 100644 --- a/activitystreams-types/src/activity/properties.rs +++ b/activitystreams-types/src/activity/properties.rs @@ -84,3 +84,371 @@ pub struct ActivityProperties { #[activitystreams(ab(Object, Link))] pub instrument: Option, } + +/// Struct with `actor` and optional `origin` and `target` properties +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct ActorOptOriginAndTarget { + /// Describes one or more entities that either performed or are expected to perform the + /// activity. + /// + /// Any single activity can have multiple actors. The actor MAY be specified using an indirect + /// Link. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub actor: serde_json::Value, + + /// Describes an indirect object of the activity from which the activity is directed. + /// + /// The precise meaning of the origin is the object of the English preposition "from". For + /// instance, in the activity "John moved an item to List B from List A", the origin of the + /// activity is "List A". + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub origin: Option, + + /// Describes the indirect object, or target, of the activity. + /// + /// The precise meaning of the target is largely dependent on the type of action being + /// described but will often be the object of the English preposition "to". For instance, in + /// the activity "John added a movie to his wishlist", the target of the activity is John's + /// wishlist. An activity can have more than one target + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub target: Option, +} + +/// Struct with `actor` and `object` properties +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct ActorAndObject { + /// Describes one or more entities that either performed or are expected to perform the + /// activity. + /// + /// Any single activity can have multiple actors. The actor MAY be specified using an indirect + /// Link. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub actor: serde_json::Value, + + /// When used within an Activity, describes the direct object of the activity. + /// + /// For instance, in the activity "John added a movie to his wishlist", the object of the + /// activity is the movie added. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub object: serde_json::Value, +} + +/// Struct with `actor`, `object`, and `target` properties +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct ActorObjectAndTarget { + /// Describes one or more entities that either performed or are expected to perform the + /// activity. + /// + /// Any single activity can have multiple actors. The actor MAY be specified using an indirect + /// Link. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub actor: serde_json::Value, + + /// When used within an Activity, describes the direct object of the activity. + /// + /// For instance, in the activity "John added a movie to his wishlist", the object of the + /// activity is the movie added. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub object: serde_json::Value, + + /// Describes the indirect object, or target, of the activity. + /// + /// The precise meaning of the target is largely dependent on the type of action being + /// described but will often be the object of the English preposition "to". For instance, in + /// the activity "John added a movie to his wishlist", the target of the activity is John's + /// wishlist. An activity can have more than one target + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub target: serde_json::Value, +} + +/// Struct with `actor`, `object`, and optional `target` properties +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct ActorAndObjectOptTarget { + /// Describes one or more entities that either performed or are expected to perform the + /// activity. + /// + /// Any single activity can have multiple actors. The actor MAY be specified using an indirect + /// Link. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub actor: serde_json::Value, + + /// When used within an Activity, describes the direct object of the activity. + /// + /// For instance, in the activity "John added a movie to his wishlist", the object of the + /// activity is the movie added. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub object: serde_json::Value, + + /// Describes the indirect object, or target, of the activity. + /// + /// The precise meaning of the target is largely dependent on the type of action being + /// described but will often be the object of the English preposition "to". For instance, in + /// the activity "John added a movie to his wishlist", the target of the activity is John's + /// wishlist. An activity can have more than one target + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub target: Option, +} + +/// Struct with `actor`, `object`, and optional `origin` properties +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct ActorAndObjectOptOrigin { + /// Describes one or more entities that either performed or are expected to perform the + /// activity. + /// + /// Any single activity can have multiple actors. The actor MAY be specified using an indirect + /// Link. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub actor: serde_json::Value, + + /// When used within an Activity, describes the direct object of the activity. + /// + /// For instance, in the activity "John added a movie to his wishlist", the object of the + /// activity is the movie added. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub object: serde_json::Value, + + /// Describes an indirect object of the activity from which the activity is directed. + /// + /// The precise meaning of the origin is the object of the English preposition "from". For + /// instance, in the activity "John moved an item to List B from List A", the origin of the + /// activity is "List A". + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub origin: Option, +} + +/// Struct with `actor`, `object`, and optional `origin` and `target` properties +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct ActorAndObjectOptOthers { + /// Describes one or more entities that either performed or are expected to perform the + /// activity. + /// + /// Any single activity can have multiple actors. The actor MAY be specified using an indirect + /// Link. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub actor: serde_json::Value, + + /// When used within an Activity, describes the direct object of the activity. + /// + /// For instance, in the activity "John added a movie to his wishlist", the object of the + /// activity is the movie added. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub object: serde_json::Value, + + /// Describes an indirect object of the activity from which the activity is directed. + /// + /// The precise meaning of the origin is the object of the English preposition "from". For + /// instance, in the activity "John moved an item to List B from List A", the origin of the + /// activity is "List A". + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub origin: Option, + + /// Describes the indirect object, or target, of the activity. + /// + /// The precise meaning of the target is largely dependent on the type of action being + /// described but will often be the object of the English preposition "to". For instance, in + /// the activity "John added a movie to his wishlist", the target of the activity is John's + /// wishlist. An activity can have more than one target + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub target: Option, +} + +/// Struct with `actor` and `origin` properties +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct ActorAndOrigin { + /// Describes one or more entities that either performed or are expected to perform the + /// activity. + /// + /// Any single activity can have multiple actors. The actor MAY be specified using an indirect + /// Link. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub actor: serde_json::Value, + + /// Describes an indirect object of the activity from which the activity is directed. + /// + /// The precise meaning of the origin is the object of the English preposition "from". For + /// instance, in the activity "John moved an item to List B from List A", the origin of the + /// activity is "List A". + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[activitystreams(ab(Object, Link))] + pub origin: serde_json::Value, +} + +/// Properties for the Accept activity +pub type AcceptProperties = ActorAndObject; + +/// Properties for the Add activity +pub type AddProperties = ActorAndObject; + +/// Properties for the Move activity +pub type MoveProperties = ActorAndObjectOptOthers; + +/// Properties for the Announce activity +pub type AnnounceProperties = ActorAndObjectOptTarget; + +/// Properties for the Arrive activity +pub type ArriveProperties = ActorAndOrigin; + +/// Properties for the Block activity +pub type BlockProperties = ActorAndObject; + +/// Properties for the Create activity +pub type CreateProperties = ActorAndObject; + +/// Properties for the Delete activity +pub type DeleteProperties = ActorAndObjectOptOrigin; + +/// Properties for the Dislike activity +pub type DislikeProperties = ActorAndObject; + +/// Properties for the Flag activity +pub type FlagProperties = ActorAndObject; + +/// Properties for the Follow activity +pub type FollowProperties = ActorAndObject; + +/// Properties for the Ignore activity +pub type IgnoreProperties = ActorAndObject; + +/// Properties for the Invite activity +pub type InviteProperties = ActorObjectAndTarget; + +/// Properties for the Join activity +pub type JoinProperties = ActorAndObject; + +/// Properties for the Leave activity +pub type LeaveProperties = ActorAndObject; + +/// Properties for the Like activity +pub type LikeProperties = ActorAndObject; + +/// Properties for the Listen activity +pub type ListenProperties = ActorAndObject; + +/// Properties for the Offer activity +pub type OfferProperties = ActorAndObjectOptTarget; + +/// Properties for the Question activity +#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] +#[serde(rename_all = "camelCase")] +pub struct QuestionProperties { + /// Identifies an exclusive option for a Question. + /// + /// Use of `one_of` implies that the Question can have only a single answer. To indicate that a + /// `Question` can have multiple answers, use `any_of`. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub one_of: Option, + + /// Identifies an inclusive option for a Question. + /// + /// Use of `any_of` implies that the Question can have multiple answers. To indicate that a + /// `Question` can have only one answer, use `one_of`. + /// + /// - Range: `Object` | `Link` + /// - Functional: false + #[serde(skip_serializing_if = "Option::is_none")] + #[activitystreams(ab(Object, Link))] + pub any_of: Option, +} + +/// Properties for the Read activity +pub type ReadProperties = ActorAndObject; + +/// Properties for the Reject activity +pub type RejectProperties = ActorAndObject; + +/// Properties for the Remove activity +pub type RemoveProperties = ActorAndObjectOptOthers; + +/// Properties for the TentativeAccept activity +pub type TentativeAcceptProperties = ActorAndObject; + +/// Properties for the TentativeReject activity +pub type TentativeRejectProperties = ActorAndObject; + +/// Properties for the Travel activity +pub type TravelProperties = ActorOptOriginAndTarget; + +/// Properties for the Undo activity +pub type UndoProperties = ActorAndObject; + +/// Properties for the Update activity +pub type UpdateProperties = ActorAndObject; + +/// Properties for the View activity +pub type ViewProperties = ActorAndObject; diff --git a/activitystreams-types/src/activity/question.rs b/activitystreams-types/src/activity/question.rs index 7858fb2..16bfbfd 100644 --- a/activitystreams-types/src/activity/question.rs +++ b/activitystreams-types/src/activity/question.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, IntransitiveActivity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, IntransitiveActivity, Object}; -use super::{kind::QuestionType, properties::ActivityProperties}; +use super::{ + kind::QuestionType, properties::{ActivityProperties, QuestionProperties}, +}; use object::properties::ObjectProperties; /// Represents a question being asked. @@ -37,27 +38,9 @@ pub struct Question { #[serde(rename = "type")] pub kind: QuestionType, - /// Identifies an exclusive option for a Question. - /// - /// Use of `one_of` implies that the Question can have only a single answer. To indicate that a - /// `Question` can have multiple answers, use `any_of`. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub one_of: Option, - - /// Identifies an inclusive option for a Question. - /// - /// Use of `any_of` implies that the Question can have multiple answers. To indicate that a - /// `Question` can have only one answer, use `one_of`. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub any_of: Option, + /// Adds all valid question properties to this struct + #[serde(flatten)] + pub question_props: QuestionProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/read.rs b/activitystreams-types/src/activity/read.rs index b7a0001..eb01f55 100644 --- a/activitystreams-types/src/activity/read.rs +++ b/activitystreams-types/src/activity/read.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::ReadType, properties::ActivityProperties}; +use super::{ + kind::ReadType, properties::{ActivityProperties, ReadProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has read the object. @@ -30,26 +31,9 @@ pub struct Read { #[serde(rename = "type")] pub kind: ReadType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid read properties to this struct + #[serde(flatten)] + pub read_props: ReadProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/reject.rs b/activitystreams-types/src/activity/reject.rs index f5fa9bd..d9291c1 100644 --- a/activitystreams-types/src/activity/reject.rs +++ b/activitystreams-types/src/activity/reject.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::RejectType, properties::ActivityProperties}; +use super::{ + kind::RejectType, properties::{ActivityProperties, RejectProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is rejecting the object. @@ -32,26 +33,9 @@ pub struct Reject { #[serde(rename = "type")] pub kind: RejectType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid reject properties to this struct + #[serde(flatten)] + pub reject_props: RejectProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/remove.rs b/activitystreams-types/src/activity/remove.rs index b64b9e3..f0b4cfe 100644 --- a/activitystreams-types/src/activity/remove.rs +++ b/activitystreams-types/src/activity/remove.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::RemoveType, properties::ActivityProperties}; +use super::{ + kind::RemoveType, properties::{ActivityProperties, RemoveProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is removing the object. @@ -32,51 +33,9 @@ pub struct Remove { #[serde(rename = "type")] pub kind: RemoveType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, - - /// Describes an indirect object of the activity from which the activity is directed. - /// - /// The precise meaning of the origin is the object of the English preposition "from". For - /// instance, in the activity "John moved an item to List B from List A", the origin of the - /// activity is "List A". - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub origin: Option, - - /// Describes the indirect object, or target, of the activity. - /// - /// The precise meaning of the target is largely dependent on the type of action being - /// described but will often be the object of the English preposition "to". For instance, in - /// the activity "John added a movie to his wishlist", the target of the activity is John's - /// wishlist. An activity can have more than one target - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub target: Option, + /// Adds all valid remove properties to this struct + #[serde(flatten)] + pub remove_props: RemoveProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/tentative_accept.rs b/activitystreams-types/src/activity/tentative_accept.rs index 566735d..ee8de8c 100644 --- a/activitystreams-types/src/activity/tentative_accept.rs +++ b/activitystreams-types/src/activity/tentative_accept.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::TentativeAcceptType, properties::ActivityProperties}; +use super::{ + kind::TentativeAcceptType, properties::{ActivityProperties, TentativeAcceptProperties}, +}; use object::properties::ObjectProperties; /// A specialization of Accept indicating that the acceptance is tentative. @@ -30,26 +31,9 @@ pub struct TentativeAccept { #[serde(rename = "type")] pub kind: TentativeAcceptType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid tentative_accept properties to this struct + #[serde(flatten)] + pub tentative_accept_props: TentativeAcceptProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/tentative_reject.rs b/activitystreams-types/src/activity/tentative_reject.rs index baedc75..eaa7acf 100644 --- a/activitystreams-types/src/activity/tentative_reject.rs +++ b/activitystreams-types/src/activity/tentative_reject.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::TentativeRejectType, properties::ActivityProperties}; +use super::{ + kind::TentativeRejectType, properties::{ActivityProperties, TentativeRejectProperties}, +}; use object::properties::ObjectProperties; /// A specialization of Reject in which the rejection is considered tentative. @@ -30,26 +31,9 @@ pub struct TentativeReject { #[serde(rename = "type")] pub kind: TentativeRejectType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid tentative_reject properties to this struct + #[serde(flatten)] + pub tentative_reject_props: TentativeRejectProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/travel.rs b/activitystreams-types/src/activity/travel.rs index fa72479..5b5fa4a 100644 --- a/activitystreams-types/src/activity/travel.rs +++ b/activitystreams-types/src/activity/travel.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, IntransitiveActivity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, IntransitiveActivity, Object}; -use super::{kind::TravelType, properties::ActivityProperties}; +use super::{ + kind::TravelType, properties::{ActivityProperties, TravelProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is traveling to target from origin. @@ -33,41 +34,9 @@ pub struct Travel { #[serde(rename = "type")] pub kind: TravelType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// Describes an indirect object of the activity from which the activity is directed. - /// - /// The precise meaning of the origin is the object of the English preposition "from". For - /// instance, in the activity "John moved an item to List B from List A", the origin of the - /// activity is "List A". - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub origin: Option, - - /// Describes the indirect object, or target, of the activity. - /// - /// The precise meaning of the target is largely dependent on the type of action being - /// described but will often be the object of the English preposition "to". For instance, in - /// the activity "John added a movie to his wishlist", the target of the activity is John's - /// wishlist. An activity can have more than one target - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[serde(skip_serializing_if = "Option::is_none")] - #[activitystreams(ab(Object, Link))] - pub target: Option, + /// Adds all valid travel properties to this struct + #[serde(flatten)] + pub travel_props: TravelProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/undo.rs b/activitystreams-types/src/activity/undo.rs index b3ea6b8..df1a1ce 100644 --- a/activitystreams-types/src/activity/undo.rs +++ b/activitystreams-types/src/activity/undo.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::UndoType, properties::ActivityProperties}; +use super::{ + kind::UndoType, properties::{ActivityProperties, UndoProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor is undoing the object. @@ -36,26 +37,9 @@ pub struct Undo { #[serde(rename = "type")] pub kind: UndoType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid undo properties to this struct + #[serde(flatten)] + pub undo_props: UndoProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/update.rs b/activitystreams-types/src/activity/update.rs index 48770fd..6bc9068 100644 --- a/activitystreams-types/src/activity/update.rs +++ b/activitystreams-types/src/activity/update.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::UpdateType, properties::ActivityProperties}; +use super::{ + kind::UpdateType, properties::{ActivityProperties, UpdateProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has updated the object. @@ -35,26 +36,9 @@ pub struct Update { #[serde(rename = "type")] pub kind: UpdateType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid update properties to this struct + #[serde(flatten)] + pub update_props: UpdateProperties, /// Adds all valid object properties to this struct #[serde(flatten)] diff --git a/activitystreams-types/src/activity/view.rs b/activitystreams-types/src/activity/view.rs index bc879db..7455681 100644 --- a/activitystreams-types/src/activity/view.rs +++ b/activitystreams-types/src/activity/view.rs @@ -17,10 +17,11 @@ * along with ActivityStreams Types. If not, see . */ -use activitystreams_traits::{Activity, Link, Object}; -use serde_json; +use activitystreams_traits::{Activity, Object}; -use super::{kind::ViewType, properties::ActivityProperties}; +use super::{ + kind::ViewType, properties::{ActivityProperties, ViewProperties}, +}; use object::properties::ObjectProperties; /// Indicates that the actor has viewed the object. @@ -30,26 +31,9 @@ pub struct View { #[serde(rename = "type")] pub kind: ViewType, - /// Describes one or more entities that either performed or are expected to perform the - /// activity. - /// - /// Any single activity can have multiple actors. The actor MAY be specified using an indirect - /// Link. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub actor: serde_json::Value, - - /// When used within an Activity, describes the direct object of the activity. - /// - /// For instance, in the activity "John added a movie to his wishlist", the object of the - /// activity is the movie added. - /// - /// - Range: `Object` | `Link` - /// - Functional: false - #[activitystreams(ab(Object, Link))] - pub object: serde_json::Value, + /// Adds all valid view properties to this struct + #[serde(flatten)] + pub view_props: ViewProperties, /// Adds all valid object properties to this struct #[serde(flatten)]