mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-24 21:01:00 +00:00
Flatten ActivityPub
This commit is contained in:
parent
1e3c40951d
commit
9a8fd738f7
55 changed files with 2345 additions and 680 deletions
|
@ -1,4 +1,4 @@
|
|||
use activitystreams::object::Video;
|
||||
use activitystreams::object::streams::Video;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut v = Video::default();
|
||||
|
|
771
src/activity/apub.rs
Normal file
771
src/activity/apub.rs
Normal file
|
@ -0,0 +1,771 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
//! Activity traits and types
|
||||
|
||||
use crate::{
|
||||
activity::{kind::*, properties::*, Activity, IntransitiveActivity},
|
||||
object::{
|
||||
properties::{ApObjectProperties, ObjectProperties},
|
||||
Object,
|
||||
},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor accepts the object.
|
||||
///
|
||||
/// The target property can be used in certain circumstances to indicate the context into which the
|
||||
/// object has been accepted.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Accept {
|
||||
#[serde(rename = "type")]
|
||||
kind: AcceptType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub accept_props: AcceptProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has added the object to the target.
|
||||
///
|
||||
/// If the target property is not explicitly specified, the target would need to be determined
|
||||
/// implicitly by context. The origin can be used to identify the context from which the object
|
||||
/// originated.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Add {
|
||||
#[serde(rename = "type")]
|
||||
kind: AddType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub add_props: AddProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has moved object from origin to target.
|
||||
///
|
||||
/// If the origin or target are not specified, either can be determined by context.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AMove {
|
||||
#[serde(rename = "type")]
|
||||
kind: MoveType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub move_props: MoveProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is calling the target's attention the object.
|
||||
///
|
||||
/// The origin typically has no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Announce {
|
||||
#[serde(rename = "type")]
|
||||
kind: AnnounceType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub announce_props: AnnounceProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// An IntransitiveActivity that indicates that the actor has arrived at the location.
|
||||
///
|
||||
/// The origin can be used to identify the context from which the actor originated. The target
|
||||
/// typically has no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Arrive {
|
||||
#[serde(rename = "type")]
|
||||
kind: ArriveType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub arrive_props: ArriveProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
impl IntransitiveActivity for Arrive {}
|
||||
|
||||
/// Indicates that the actor is blocking the object.
|
||||
///
|
||||
/// Blocking is a stronger form of Ignore. The typical use is to support social systems that allow
|
||||
/// one user to block activities or content of other users. The target and origin typically have no
|
||||
/// defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Block {
|
||||
#[serde(rename = "type")]
|
||||
kind: BlockType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub block_props: BlockProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has created the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Create {
|
||||
#[serde(rename = "type")]
|
||||
kind: CreateType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub create_props: CreateProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has deleted the object.
|
||||
///
|
||||
/// If specified, the origin indicates the context from which the object was deleted.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Delete {
|
||||
#[serde(rename = "type")]
|
||||
kind: DeleteType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub delete_props: DeleteProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor dislikes the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Dislike {
|
||||
#[serde(rename = "type")]
|
||||
kind: DislikeType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub dislike_props: DislikeProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is "flagging" the object.
|
||||
///
|
||||
/// Flagging is defined in the sense common to many social platforms as reporting content as being
|
||||
/// inappropriate for any number of reasons.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Flag {
|
||||
#[serde(rename = "type")]
|
||||
kind: FlagType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub flag_props: FlagProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is "following" the object.
|
||||
///
|
||||
/// Following is defined in the sense typically used within Social systems in which the actor is
|
||||
/// interested in any activity performed by or on the object. The target and origin typically have
|
||||
/// no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Follow {
|
||||
#[serde(rename = "type")]
|
||||
kind: FollowType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub follow_props: FollowProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is ignoring the object.
|
||||
///
|
||||
/// The target and origin typically have no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Ignore {
|
||||
#[serde(rename = "type")]
|
||||
kind: IgnoreType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ignore_props: IgnoreProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// A specialization of Offer in which the actor is extending an invitation for the object to the
|
||||
/// target.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Invite {
|
||||
#[serde(rename = "type")]
|
||||
kind: InviteType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub invite_props: InviteProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has joined the object.
|
||||
///
|
||||
/// The target and origin typically have no defined meaning
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Join {
|
||||
#[serde(rename = "type")]
|
||||
kind: JoinType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub join_props: JoinProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has left the object.
|
||||
///
|
||||
/// The target and origin typically have no meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Leave {
|
||||
#[serde(rename = "type")]
|
||||
kind: LeaveType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub leave_props: LeaveProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor likes, recommends or endorses the object.
|
||||
///
|
||||
/// The target and origin typically have no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Like {
|
||||
#[serde(rename = "type")]
|
||||
kind: LikeType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub like_props: LikeProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has listened to the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Listen {
|
||||
#[serde(rename = "type")]
|
||||
kind: ListenType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub listen_props: ListenProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is offering the object.
|
||||
///
|
||||
/// If specified, the target indicates the entity to which the object is being offered.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Offer {
|
||||
#[serde(rename = "type")]
|
||||
kind: OfferType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub offer_props: OfferProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Represents a question being asked.
|
||||
///
|
||||
/// Question objects are an extension of IntransitiveActivity. That is, the Question object is an
|
||||
/// Activity, but the direct object is the question itself and therefore it would not contain an
|
||||
/// object property.
|
||||
///
|
||||
/// Either of the anyOf and oneOf properties MAY be used to express possible answers, but a
|
||||
/// Question object MUST NOT have both properties.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Question {
|
||||
#[serde(rename = "type")]
|
||||
kind: QuestionType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub question_props: QuestionProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
impl IntransitiveActivity for Question {}
|
||||
|
||||
/// Indicates that the actor has read the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Read {
|
||||
#[serde(rename = "type")]
|
||||
kind: ReadType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub read_props: ReadProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is rejecting the object.
|
||||
///
|
||||
/// The target and origin typically have no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Reject {
|
||||
#[serde(rename = "type")]
|
||||
kind: RejectType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub reject_props: RejectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is removing the object.
|
||||
///
|
||||
/// If specified, the origin indicates the context from which the object is being removed.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Remove {
|
||||
#[serde(rename = "type")]
|
||||
kind: RemoveType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub remove_props: RemoveProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// A specialization of Accept indicating that the acceptance is tentative.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct TentativeAccept {
|
||||
#[serde(rename = "type")]
|
||||
kind: TentativeAcceptType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub tentative_accept_props: TentativeAcceptProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// A specialization of Reject in which the rejection is considered tentative.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct TentativeReject {
|
||||
#[serde(rename = "type")]
|
||||
kind: TentativeRejectType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub tentative_reject_props: TentativeRejectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor is traveling to target from origin.
|
||||
///
|
||||
/// Travel is an IntransitiveObject whose actor specifies the direct object. If the target or
|
||||
/// origin are not specified, either can be determined by context.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Travel {
|
||||
#[serde(rename = "type")]
|
||||
kind: TravelType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub travel_props: TravelProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
impl IntransitiveActivity for Travel {}
|
||||
|
||||
/// Indicates that the actor is undoing the object.
|
||||
///
|
||||
/// In most cases, the object will be an Activity describing some previously performed action (for
|
||||
/// instance, a person may have previously "liked" an article but, for whatever reason, might
|
||||
/// choose to undo that like at some later point in time).
|
||||
///
|
||||
/// The target and origin typically have no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Undo {
|
||||
#[serde(rename = "type")]
|
||||
kind: UndoType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub undo_props: UndoProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has updated the object.
|
||||
///
|
||||
/// Note, however, that this vocabulary does not define a mechanism for describing the actual set
|
||||
/// of modifications made to object.
|
||||
///
|
||||
/// The target and origin typically have no defined meaning.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Update {
|
||||
#[serde(rename = "type")]
|
||||
kind: UpdateType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub update_props: UpdateProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
||||
|
||||
/// Indicates that the actor has viewed the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct View {
|
||||
#[serde(rename = "type")]
|
||||
kind: ViewType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub view_props: ViewProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Activity)]
|
||||
pub activity_props: ActivityProperties,
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
//! Namespace for Unit Structs that serialize to strings
|
||||
|
||||
use activitystreams_derive::UnitString;
|
||||
use crate::UnitString;
|
||||
|
||||
#[derive(Clone, Debug, Default, UnitString)]
|
||||
#[activitystreams(Accept)]
|
||||
|
|
|
@ -18,76 +18,13 @@
|
|||
*/
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
mod accept;
|
||||
#[cfg(feature = "types")]
|
||||
mod add;
|
||||
#[cfg(feature = "types")]
|
||||
mod amove;
|
||||
#[cfg(feature = "types")]
|
||||
mod announce;
|
||||
#[cfg(feature = "types")]
|
||||
mod arrive;
|
||||
#[cfg(feature = "types")]
|
||||
mod block;
|
||||
#[cfg(feature = "types")]
|
||||
mod create;
|
||||
#[cfg(feature = "types")]
|
||||
mod delete;
|
||||
#[cfg(feature = "types")]
|
||||
mod dislike;
|
||||
#[cfg(feature = "types")]
|
||||
mod flag;
|
||||
#[cfg(feature = "types")]
|
||||
mod follow;
|
||||
#[cfg(feature = "types")]
|
||||
mod ignore;
|
||||
#[cfg(feature = "types")]
|
||||
mod invite;
|
||||
#[cfg(feature = "types")]
|
||||
mod join;
|
||||
#[cfg(feature = "types")]
|
||||
mod leave;
|
||||
#[cfg(feature = "types")]
|
||||
mod like;
|
||||
#[cfg(feature = "types")]
|
||||
mod listen;
|
||||
#[cfg(feature = "types")]
|
||||
mod offer;
|
||||
pub mod apub;
|
||||
#[cfg(feature = "kinds")]
|
||||
pub mod kind;
|
||||
#[cfg(feature = "types")]
|
||||
pub mod properties;
|
||||
#[cfg(feature = "types")]
|
||||
mod question;
|
||||
#[cfg(feature = "types")]
|
||||
mod read;
|
||||
#[cfg(feature = "types")]
|
||||
mod reject;
|
||||
#[cfg(feature = "types")]
|
||||
mod remove;
|
||||
#[cfg(feature = "types")]
|
||||
mod tentative_accept;
|
||||
#[cfg(feature = "types")]
|
||||
mod tentative_reject;
|
||||
#[cfg(feature = "types")]
|
||||
mod travel;
|
||||
#[cfg(feature = "types")]
|
||||
mod undo;
|
||||
#[cfg(feature = "types")]
|
||||
mod update;
|
||||
#[cfg(feature = "types")]
|
||||
mod view;
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
pub use self::{
|
||||
accept::Accept, add::Add, amove::AMove, announce::Announce, arrive::Arrive, block::Block,
|
||||
create::Create, delete::Delete, dislike::Dislike, flag::Flag, follow::Follow, ignore::Ignore,
|
||||
invite::Invite, join::Join, leave::Leave, like::Like, listen::Listen, offer::Offer,
|
||||
question::Question, read::Read, reject::Reject, remove::Remove,
|
||||
tentative_accept::TentativeAccept, tentative_reject::TentativeReject, travel::Travel,
|
||||
undo::Undo, update::Update, view::View,
|
||||
};
|
||||
|
||||
#[cfg(feature = "kinds")]
|
||||
pub mod kind;
|
||||
pub mod streams;
|
||||
|
||||
use crate::object::Object;
|
||||
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
//! # fn main() {}
|
||||
//! ```
|
||||
|
||||
use crate::{link::LinkBox, object::ObjectBox, primitives::*};
|
||||
use activitystreams_derive::properties;
|
||||
use crate::{link::LinkBox, object::ObjectBox, primitives::*, properties};
|
||||
|
||||
properties! {
|
||||
Activity {
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::AcceptType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor accepts the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::AddType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has added the object to the target.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::MoveType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has moved object from origin to target.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::AnnounceType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is calling the target's attention the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::ArriveType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity, IntransitiveActivity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// An IntransitiveActivity that indicates that the actor has arrived at the location.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::BlockType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is blocking the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::CreateType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has created the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::DeleteType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has deleted the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::DislikeType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor dislikes the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::FlagType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is "flagging" the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::FollowType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is "following" the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::IgnoreType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is ignoring the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::InviteType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A specialization of Offer in which the actor is extending an invitation for the object to the
|
||||
/// target.
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::JoinType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has joined the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::LeaveType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has left the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::LikeType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor likes, recommends or endorses the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::ListenType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has listened to the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
56
src/activity/streams/mod.rs
Normal file
56
src/activity/streams/mod.rs
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
mod accept;
|
||||
mod add;
|
||||
mod amove;
|
||||
mod announce;
|
||||
mod arrive;
|
||||
mod block;
|
||||
mod create;
|
||||
mod delete;
|
||||
mod dislike;
|
||||
mod flag;
|
||||
mod follow;
|
||||
mod ignore;
|
||||
mod invite;
|
||||
mod join;
|
||||
mod leave;
|
||||
mod like;
|
||||
mod listen;
|
||||
mod offer;
|
||||
mod question;
|
||||
mod read;
|
||||
mod reject;
|
||||
mod remove;
|
||||
mod tentative_accept;
|
||||
mod tentative_reject;
|
||||
mod travel;
|
||||
mod undo;
|
||||
mod update;
|
||||
mod view;
|
||||
|
||||
pub use self::{
|
||||
accept::Accept, add::Add, amove::AMove, announce::Announce, arrive::Arrive, block::Block,
|
||||
create::Create, delete::Delete, dislike::Dislike, flag::Flag, follow::Follow, ignore::Ignore,
|
||||
invite::Invite, join::Join, leave::Leave, like::Like, listen::Listen, offer::Offer,
|
||||
question::Question, read::Read, reject::Reject, remove::Remove,
|
||||
tentative_accept::TentativeAccept, tentative_reject::TentativeReject, travel::Travel,
|
||||
undo::Undo, update::Update, view::View,
|
||||
};
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::OfferType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is offering the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::QuestionType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity, IntransitiveActivity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Represents a question being asked.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::ReadType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has read the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::RejectType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is rejecting the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::RemoveType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is removing the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::TentativeAcceptType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A specialization of Accept indicating that the acceptance is tentative.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::TentativeRejectType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A specialization of Reject in which the rejection is considered tentative.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::TravelType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity, IntransitiveActivity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is traveling to target from origin.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::UndoType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor is undoing the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::UpdateType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has updated the object.
|
||||
///
|
|
@ -17,9 +17,6 @@
|
|||
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use activitystreams_derive::PropRefs;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
activity::{
|
||||
kind::ViewType,
|
||||
|
@ -27,7 +24,9 @@ use crate::{
|
|||
Activity,
|
||||
},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Indicates that the actor has viewed the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
143
src/actor/apub.rs
Normal file
143
src/actor/apub.rs
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
actor::{kind::*, properties::*, Actor},
|
||||
object::{
|
||||
properties::{ApObjectProperties, ObjectProperties},
|
||||
Object,
|
||||
},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Describes a software application.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Application {
|
||||
#[serde(rename = "type")]
|
||||
kind: ApplicationType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub actor properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Actor)]
|
||||
pub ap_actor_props: ApActorProperties,
|
||||
}
|
||||
|
||||
/// Represents a formal or informal collective of Actors.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Group {
|
||||
#[serde(rename = "type")]
|
||||
kind: GroupType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub actor properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Actor)]
|
||||
pub ap_actor_props: ApActorProperties,
|
||||
}
|
||||
|
||||
/// Represents an organization.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Organization {
|
||||
#[serde(rename = "type")]
|
||||
kind: OrganizationType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub actor properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Actor)]
|
||||
pub ap_actor_props: ApActorProperties,
|
||||
}
|
||||
|
||||
/// Represents an individual person.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Person {
|
||||
#[serde(rename = "type")]
|
||||
kind: PersonType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub actor properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Actor)]
|
||||
pub ap_actor_props: ApActorProperties,
|
||||
}
|
||||
|
||||
/// Represents a service of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Service {
|
||||
#[serde(rename = "type")]
|
||||
kind: ServiceType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid activitypub actor properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Actor)]
|
||||
pub ap_actor_props: ApActorProperties,
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
//! Namespace for Unit Structs that serialize to strings
|
||||
use activitystreams_derive::UnitString;
|
||||
use crate::UnitString;
|
||||
|
||||
#[derive(Clone, Debug, Default, UnitString)]
|
||||
#[activitystreams(Application)]
|
||||
|
|
106
src/actor/mod.rs
106
src/actor/mod.rs
|
@ -20,16 +20,13 @@
|
|||
//! Namespace for Actor types
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
use crate::object::properties::ObjectProperties;
|
||||
#[cfg(feature = "types")]
|
||||
use activitystreams_derive::PropRefs;
|
||||
#[cfg(feature = "types")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod apub;
|
||||
#[cfg(feature = "kinds")]
|
||||
pub mod kind;
|
||||
#[cfg(feature = "types")]
|
||||
use self::kind::*;
|
||||
pub mod properties;
|
||||
#[cfg(feature = "types")]
|
||||
pub mod streams;
|
||||
|
||||
use crate::object::Object;
|
||||
|
||||
|
@ -53,98 +50,3 @@ use crate::object::Object;
|
|||
/// example, to use a `vcard:Individual` as an `Actor` MUST also identify that `Actor` as a
|
||||
/// `Person`.
|
||||
pub trait Actor: Object {}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Describes a software application.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Application {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ApplicationType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl Actor for Application {}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents a formal or informal collective of Actors.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Group {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: GroupType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl Actor for Group {}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents an organization.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Organization {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: OrganizationType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl Actor for Organization {}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents an individual person.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Person {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: PersonType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl Actor for Person {}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents a service of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Service {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ServiceType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl Actor for Service {}
|
||||
|
|
163
src/actor/properties.rs
Normal file
163
src/actor/properties.rs
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* 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,
|
||||
//! object::properties::{ApObjectProperties, ObjectProperties},
|
||||
//! Actor, Object, PropRefs
|
||||
//! };
|
||||
//! use serde::{Deserialize, Serialize};
|
||||
//!
|
||||
//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)]
|
||||
//! #[serde(rename_all = "camelCase")]
|
||||
//! pub struct MyActor {
|
||||
//! #[serde(rename = "type")]
|
||||
//! pub kind: String,
|
||||
//!
|
||||
//! /// Define a require property for the MyActor type
|
||||
//! pub my_property: String,
|
||||
//!
|
||||
//! #[serde(flatten)]
|
||||
//! #[activitystreams(Object)]
|
||||
//! pub object_props: ObjectProperties,
|
||||
//!
|
||||
//! #[serde(flatten)]
|
||||
//! #[activitystreams(None)]
|
||||
//! pub ap_object_props: ApObjectProperties,
|
||||
//!
|
||||
//! #[serde(flatten)]
|
||||
//! #[activitystreams(Actor)]
|
||||
//! pub actor_props: ApActorProperties,
|
||||
//! }
|
||||
//! #
|
||||
//! # fn main() {}
|
||||
//! ```
|
||||
|
||||
use crate::{endpoint::EndpointProperties, primitives::XsdAnyUri, 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: `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: `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: `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: `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: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
streams {
|
||||
docs [
|
||||
"A list of supplementary Collections which may be of interest.",
|
||||
"",
|
||||
"- Range: `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: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
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,
|
||||
},
|
||||
}
|
||||
}
|
110
src/actor/streams.rs
Normal file
110
src/actor/streams.rs
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
actor::{kind::*, Actor},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Describes a software application.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Application {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ApplicationType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
impl Actor for Application {}
|
||||
|
||||
/// Represents a formal or informal collective of Actors.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Group {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: GroupType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
impl Actor for Group {}
|
||||
|
||||
/// Represents an organization.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Organization {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: OrganizationType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
impl Actor for Organization {}
|
||||
|
||||
/// Represents an individual person.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Person {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: PersonType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
impl Actor for Person {}
|
||||
|
||||
/// Represents a service of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Service {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ServiceType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
impl Actor for Service {}
|
138
src/collection/apub.rs
Normal file
138
src/collection/apub.rs
Normal file
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
//! Collection traits and types
|
||||
|
||||
use crate::{
|
||||
collection::{kind::*, properties::*, Collection, CollectionPage},
|
||||
object::{
|
||||
properties::{ApObjectProperties, ObjectProperties},
|
||||
Object,
|
||||
},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The default `Collection` type.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UnorderedCollection {
|
||||
#[serde(rename = "type")]
|
||||
kind: CollectionType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid ap object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
}
|
||||
|
||||
/// Used to represent distinct subsets of items from a `Collection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UnorderedCollectionPage {
|
||||
#[serde(rename = "type")]
|
||||
kind: CollectionPageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid ap object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
|
||||
/// Adds all valid collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(CollectionPage)]
|
||||
pub collection_page_props: CollectionPageProperties,
|
||||
}
|
||||
|
||||
/// A subtype of `Collection` in which members of the logical collection are assumed to always be
|
||||
/// strictly ordered.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OrderedCollection {
|
||||
#[serde(rename = "type")]
|
||||
kind: OrderedCollectionType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid ap object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
}
|
||||
|
||||
/// Used to represent ordered subsets of items from an `OrderedCollection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OrderedCollectionPage {
|
||||
#[serde(rename = "type")]
|
||||
kind: OrderedCollectionPageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid ap object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
|
||||
/// Adds all valid collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(CollectionPage)]
|
||||
pub collection_page_props: CollectionPageProperties,
|
||||
|
||||
/// Adds all valid ordered collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ordered_collection_page_props: OrderedCollectionPageProperties,
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
//! Namespace for Unit Structs that serialize to strings
|
||||
use activitystreams_derive::UnitString;
|
||||
use crate::UnitString;
|
||||
|
||||
#[derive(Clone, Debug, Default, UnitString)]
|
||||
#[activitystreams(Collection)]
|
||||
|
|
|
@ -20,20 +20,13 @@
|
|||
//! Namespace for Collection types
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
use crate::object::properties::ObjectProperties;
|
||||
#[cfg(feature = "types")]
|
||||
use activitystreams_derive::PropRefs;
|
||||
#[cfg(feature = "types")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod apub;
|
||||
#[cfg(feature = "kinds")]
|
||||
pub mod kind;
|
||||
#[cfg(feature = "types")]
|
||||
pub mod properties;
|
||||
#[cfg(feature = "types")]
|
||||
use self::kind::*;
|
||||
#[cfg(feature = "types")]
|
||||
use self::properties::*;
|
||||
pub mod streams;
|
||||
|
||||
use crate::object::Object;
|
||||
|
||||
|
@ -61,115 +54,15 @@ pub trait Collection: Object {}
|
|||
pub trait CollectionPage: Collection {}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct CollectionBox(pub Box<dyn Object>);
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct CollectionPageBox(pub Box<dyn Object>);
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// The default `Collection` type.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UnorderedCollection {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: CollectionType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// A subtype of `Collection` in which members of the logical collection are assumed to always be
|
||||
/// strictly ordered.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OrderedCollection {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: OrderedCollectionType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Used to represent distinct subsets of items from a `Collection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UnorderedCollectionPage {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: CollectionPageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
|
||||
/// Adds all valid collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(CollectionPage)]
|
||||
pub collection_page_props: CollectionPageProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Used to represent ordered subsets of items from an `OrderedCollection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OrderedCollectionPage {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: OrderedCollectionPageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
|
||||
/// Adds all valid collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(CollectionPage)]
|
||||
pub collection_page_props: CollectionPageProperties,
|
||||
|
||||
/// Adds all valid ordered collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ordered_collection_page_props: OrderedCollectionPageProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl CollectionBox {
|
||||
pub fn is<T>(&self) -> bool
|
||||
|
|
|
@ -58,8 +58,8 @@ use crate::{
|
|||
link::LinkBox,
|
||||
object::ObjectBox,
|
||||
primitives::*,
|
||||
properties,
|
||||
};
|
||||
use activitystreams_derive::properties;
|
||||
|
||||
properties! {
|
||||
Collection {
|
||||
|
|
123
src/collection/streams.rs
Normal file
123
src/collection/streams.rs
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* 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 Collection types
|
||||
|
||||
use crate::{
|
||||
collection::{kind::*, properties::*, Collection, CollectionPage},
|
||||
object::{properties::ObjectProperties, Object},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The default `Collection` type.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UnorderedCollection {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: CollectionType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
}
|
||||
|
||||
/// A subtype of `Collection` in which members of the logical collection are assumed to always be
|
||||
/// strictly ordered.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OrderedCollection {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: OrderedCollectionType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
}
|
||||
|
||||
/// Used to represent distinct subsets of items from a `Collection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UnorderedCollectionPage {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: CollectionPageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
|
||||
/// Adds all valid collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(CollectionPage)]
|
||||
pub collection_page_props: CollectionPageProperties,
|
||||
}
|
||||
|
||||
/// Used to represent ordered subsets of items from an `OrderedCollection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OrderedCollectionPage {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: OrderedCollectionPageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid collection properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Collection)]
|
||||
pub collection_props: CollectionProperties,
|
||||
|
||||
/// Adds all valid collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(CollectionPage)]
|
||||
pub collection_page_props: CollectionPageProperties,
|
||||
|
||||
/// Adds all valid ordered collection page properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ordered_collection_page_props: OrderedCollectionPageProperties,
|
||||
}
|
121
src/endpoint.rs
Normal file
121
src/endpoint.rs
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
//! Endpoint traits and types
|
||||
|
||||
use crate::{primitives::XsdAnyUri, properties};
|
||||
|
||||
properties! {
|
||||
Endpoint {
|
||||
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.",
|
||||
],
|
||||
|
||||
proxy_url {
|
||||
docs [
|
||||
"Endpoint URI so this actor's clients may access remote ActivityStreams objects which",
|
||||
"require authentication to access.",
|
||||
"",
|
||||
"To use this endpoint, the client posts an x-www-form-urlencoded id parameter with the value",
|
||||
"being the id of the requested ActivityStreams object.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
oauth_authorization_endpoint {
|
||||
docs [
|
||||
"If OAuth 2.0 bearer tokens [[RFC6749](https://tools.ietf.org/html/rfc6749)]",
|
||||
"[[RFC6750](https://tools.ietf.org/html/rfc6750)] are being used for authenticating client",
|
||||
"to server interactions, this endpoint specifies a URI at which a browser-authenticated user",
|
||||
"may obtain a new authorization grant.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
oauth_token_endpoint {
|
||||
docs [
|
||||
"If OAuth 2.0 bearer tokens [[RFC6749](https://tools.ietf.org/html/rfc6749)]",
|
||||
"[[RFC6750](https://tools.ietf.org/html/rfc6750)] are being used for authenticating client",
|
||||
"to server interactions, this endpoint specifies a URI at which a client may acquire an",
|
||||
"access token.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
provide_client_key {
|
||||
docs [
|
||||
"If Linked Data Signatures and HTTP Signatures are being used for authentication and",
|
||||
"authorization, this endpoint specifies a URI at which browser-authenticated users may",
|
||||
"authorize a client's public key for client to server interactions.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
sign_client_key {
|
||||
docs [
|
||||
"If Linked Data Signatures and HTTP Signatures are being used for authentication and",
|
||||
"authorization, this endpoint specifies a URI at which a client key may be signed by the",
|
||||
"actor's key for a time window to act on behalf of the actor in interacting with foreign",
|
||||
"servers.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
shared_inbox {
|
||||
docs [
|
||||
"An optional endpoint used for wide delivery of publicly addressed activities and activities",
|
||||
"sent to followers.",
|
||||
"",
|
||||
"`shared_inbox`endpoints SHOULD also be publicly readable `OrderedCollection` objects",
|
||||
"containing objects addressed to the Public special collection. Reading from the",
|
||||
"`shared_inbox` endpoint MUST NOT present objects which are not addressed to the Public",
|
||||
"endpoint.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This file is part of ActivityStreams.
|
||||
*
|
||||
* Copyright © 2018 Riley Trautman
|
||||
* 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
|
||||
|
@ -33,7 +33,7 @@
|
|||
//! ObjectProperties,
|
||||
//! ProfileProperties
|
||||
//! },
|
||||
//! Profile,
|
||||
//! streams::Profile,
|
||||
//! },
|
||||
//! primitives::XsdAnyUri,
|
||||
//! Actor,
|
||||
|
@ -167,6 +167,8 @@
|
|||
pub mod activity;
|
||||
pub mod actor;
|
||||
pub mod collection;
|
||||
#[cfg(feature = "types")]
|
||||
pub mod endpoint;
|
||||
pub mod link;
|
||||
pub mod object;
|
||||
#[cfg(feature = "primitives")]
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
//! Namespace for Unit Structs that serialize to strings
|
||||
use activitystreams_derive::UnitString;
|
||||
use crate::UnitString;
|
||||
|
||||
/// A Unit Struct that represents the string "Mention"
|
||||
#[derive(Clone, Debug, Default, UnitString)]
|
||||
|
|
|
@ -19,19 +19,15 @@
|
|||
|
||||
//! Namespace for Link types
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
use activitystreams_derive::PropRefs;
|
||||
#[cfg(feature = "types")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "kinds")]
|
||||
pub mod kind;
|
||||
#[cfg(feature = "types")]
|
||||
pub mod properties;
|
||||
#[cfg(feature = "types")]
|
||||
use self::kind::*;
|
||||
mod types;
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
use self::properties::*;
|
||||
pub use self::types::Mention;
|
||||
|
||||
use std::any::Any;
|
||||
|
||||
|
@ -53,26 +49,10 @@ pub trait Link: std::fmt::Debug {
|
|||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct LinkBox(pub Box<dyn Link>);
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// A specialized Link that represents an @mention.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Mention {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: MentionType,
|
||||
|
||||
/// Adds all valid link properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Link)]
|
||||
pub link_props: LinkProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl LinkBox {
|
||||
pub fn is<T>(&self) -> bool
|
||||
|
|
|
@ -47,9 +47,7 @@
|
|||
//! # fn main() {}
|
||||
//! ```
|
||||
|
||||
use activitystreams_derive::properties;
|
||||
|
||||
use crate::{link::LinkBox, object::ObjectBox, primitives::*};
|
||||
use crate::{link::LinkBox, object::ObjectBox, primitives::*, properties};
|
||||
|
||||
properties! {
|
||||
Link {
|
||||
|
|
40
src/link/types.rs
Normal file
40
src/link/types.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
link::{kind::*, properties::*, Link},
|
||||
PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// A specialized Link that represents an @mention.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Mention {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: MentionType,
|
||||
|
||||
/// Adds all valid link properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Link)]
|
||||
pub link_props: LinkProperties,
|
||||
}
|
236
src/object/apub.rs
Normal file
236
src/object/apub.rs
Normal file
|
@ -0,0 +1,236 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
object::{kind::*, properties::*},
|
||||
Object, PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct ApImageBox(pub Box<Image>);
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Article {
|
||||
#[serde(rename = "type")]
|
||||
kind: ArticleType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Audio {
|
||||
#[serde(rename = "type")]
|
||||
kind: AudioType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Document {
|
||||
#[serde(rename = "type")]
|
||||
kind: DocumentType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Event {
|
||||
#[serde(rename = "type")]
|
||||
kind: EventType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Image {
|
||||
#[serde(rename = "type")]
|
||||
kind: ImageType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Note {
|
||||
#[serde(rename = "type")]
|
||||
kind: NoteType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Page {
|
||||
#[serde(rename = "type")]
|
||||
kind: PageType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Place {
|
||||
#[serde(rename = "type")]
|
||||
kind: PlaceType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub place_props: PlaceProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Profile {
|
||||
#[serde(rename = "type")]
|
||||
kind: ProfileType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub profile_props: ProfileProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Relationship {
|
||||
#[serde(rename = "type")]
|
||||
kind: RelationshipType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub relationship_props: RelationshipProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Tombstone {
|
||||
#[serde(rename = "type")]
|
||||
kind: TombstoneType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub tombstone_props: TombstoneProperties,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Video {
|
||||
#[serde(rename = "type")]
|
||||
kind: VideoType,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub ap_object_props: ApObjectProperties,
|
||||
}
|
||||
|
||||
impl From<Image> for ApImageBox {
|
||||
fn from(i: Image) -> Self {
|
||||
ApImageBox(Box::new(i))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ApImageBox> for Image {
|
||||
fn from(i: ApImageBox) -> Self {
|
||||
*i.0
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
//! Namespace for Unit Structs that serialize to strings
|
||||
use activitystreams_derive::UnitString;
|
||||
use crate::UnitString;
|
||||
|
||||
/// A Unit Struct that represents the string "Article"
|
||||
#[derive(Clone, Debug, Default, UnitString)]
|
||||
|
|
|
@ -20,18 +20,13 @@
|
|||
//! Namespace for Object types
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
use activitystreams_derive::PropRefs;
|
||||
#[cfg(feature = "types")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod apub;
|
||||
#[cfg(feature = "kinds")]
|
||||
pub mod kind;
|
||||
#[cfg(feature = "types")]
|
||||
pub mod properties;
|
||||
#[cfg(feature = "types")]
|
||||
use self::kind::*;
|
||||
#[cfg(feature = "types")]
|
||||
use self::properties::*;
|
||||
pub mod streams;
|
||||
|
||||
use std::any::Any;
|
||||
|
||||
|
@ -59,263 +54,10 @@ pub trait Object: std::fmt::Debug {
|
|||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct ImageBox(pub Box<Image>);
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct ObjectBox(pub Box<dyn Object>);
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents any kind of multi-paragraph written work.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Article {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ArticleType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents an audio document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Audio {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: AudioType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents a document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Document {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: DocumentType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents any kind of event.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Event {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: EventType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// An image document of any kind
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Image {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ImageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents a short written work typically less than a single paragraph in length.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Note {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: NoteType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents a Web Page.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Page {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: PageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents a logical or physical location.
|
||||
///
|
||||
/// The Place object is used to represent both physical and logical locations. While numerous
|
||||
/// existing vocabularies exist for describing locations in a variety of ways, inconsistencies and
|
||||
/// incompatibilities between those vocabularies make it difficult to achieve appropriate
|
||||
/// interoperability between implementations. The Place object is included within the Activity
|
||||
/// vocabulary to provide a minimal, interoperable starting point for describing locations
|
||||
/// consistently across Activity Streams 2.0 implementations.
|
||||
///
|
||||
/// The Place object is intentionally flexible. It can, for instance, be used to identify a location
|
||||
/// simply by name, or by longitude and latitude.
|
||||
///
|
||||
/// The Place object can also describe an area around a given point using the radius property, the
|
||||
/// altitude of the location, and a degree of accuracy.
|
||||
///
|
||||
/// While publishers are not required to use these specific properties and MAY make use of other
|
||||
/// mechanisms for describing locations, consuming implementations that support the Place object
|
||||
/// MUST support the use of these properties.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Place {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: PlaceType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid place properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub place: PlaceProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// A Profile is a content object that describes another `Object`, typically used to describe
|
||||
/// `Actor` Type objects.
|
||||
///
|
||||
/// The `describes` property is used to reference the object being described by the profile.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Profile {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ProfileType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid profile properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub profile: ProfileProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Describes a relationship between two individuals.
|
||||
///
|
||||
/// The subject and object properties are used to identify the connected individuals.
|
||||
///
|
||||
/// The `Relationship` object is used to represent relationships between individuals. It can be
|
||||
/// used, for instance, to describe that one person is a friend of another, or that one person is a
|
||||
/// member of a particular organization. The intent of modeling Relationship in this way is to allow
|
||||
/// descriptions of activities that operate on the relationships in general, and to allow
|
||||
/// representation of Collections of relationships.
|
||||
///
|
||||
/// For instance, many social systems have a notion of a "friends list". These are the collection of
|
||||
/// individuals that are directly connected within a person's social graph. Suppose we have a user,
|
||||
/// Sally, with direct relationships to users Joe and Jane. Sally follows Joe's updates while Sally
|
||||
/// and Jane have a mutual relationship.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Relationship {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: RelationshipType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid relationship properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub relationship: RelationshipProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// A Tombstone represents a content object that has been deleted.
|
||||
///
|
||||
/// It can be used in Collections to signify that there used to be an object at this position, but
|
||||
/// it has been deleted.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Tombstone {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: TombstoneType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid tombstone properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub tombstone_props: TombstoneProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
/// Represents a video document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Video {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: VideoType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl ObjectBox {
|
||||
pub fn is<T>(&self) -> bool
|
||||
|
@ -340,20 +82,6 @@ impl ObjectBox {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl From<Image> for ImageBox {
|
||||
fn from(i: Image) -> Self {
|
||||
ImageBox(Box::new(i))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl From<ImageBox> for Image {
|
||||
fn from(i: ImageBox) -> Self {
|
||||
*i.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "types")]
|
||||
impl Clone for ObjectBox {
|
||||
fn clone(&self) -> Self {
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
//! # fn main() {}
|
||||
//! ```
|
||||
|
||||
use activitystreams_derive::properties;
|
||||
|
||||
use crate::{
|
||||
link::LinkBox,
|
||||
object::{ImageBox, ObjectBox},
|
||||
object::{apub::ApImageBox, streams::ImageBox, ObjectBox},
|
||||
primitives::*,
|
||||
properties,
|
||||
};
|
||||
|
||||
properties! {
|
||||
Object {
|
||||
docs [
|
||||
|
@ -233,6 +233,7 @@ properties! {
|
|||
types [
|
||||
XsdAnyUri,
|
||||
ImageBox,
|
||||
ApImageBox,
|
||||
LinkBox,
|
||||
],
|
||||
},
|
||||
|
@ -249,6 +250,7 @@ properties! {
|
|||
types [
|
||||
XsdAnyUri,
|
||||
ImageBox,
|
||||
ApImageBox,
|
||||
LinkBox,
|
||||
],
|
||||
},
|
||||
|
@ -691,3 +693,78 @@ properties! {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
properties! {
|
||||
ApObject {
|
||||
docs [
|
||||
"Define activitypub properties for the Object type as described by the Activity Pub vocabulary.",
|
||||
],
|
||||
|
||||
shares {
|
||||
docs [
|
||||
"This is a list of all Announce activities with this object as the object property, added as",
|
||||
"a side effect.",
|
||||
"",
|
||||
"The shares collection MUST be either an OrderedCollection or a Collection and MAY be",
|
||||
"filtered on privileges of an authenticated user or as appropriate when no authentication is",
|
||||
"given.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
likes {
|
||||
docs [
|
||||
"This is a list of all Like activities with this object as the object property, added as a",
|
||||
"side effect.",
|
||||
"",
|
||||
"The likes collection MUST be either an OrderedCollection or a Collection and MAY be",
|
||||
"filtered on privileges of an authenticated user or as appropriate when no authentication is",
|
||||
"given.",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
functional,
|
||||
},
|
||||
|
||||
source {
|
||||
docs [
|
||||
"The source property is intended to convey some sort of source from which the content markup",
|
||||
"was derived, as a form of provenance, or to support future editing by clients.",
|
||||
"",
|
||||
"In general, clients do the conversion from source to content, not the other way around.",
|
||||
"",
|
||||
"The value of source is itself an object which uses its own content and mediaType fields to",
|
||||
"supply source information.",
|
||||
"",
|
||||
"- Range: `Object`",
|
||||
"- Functional: true",
|
||||
],
|
||||
types [
|
||||
XsdAnyUri,
|
||||
ObjectBox,
|
||||
],
|
||||
functional,
|
||||
},
|
||||
|
||||
upload_media {
|
||||
docs [
|
||||
"Servers MAY support uploading document types to be referenced in activites, such as images,",
|
||||
"video or other binary data, but the precise mechanism is out of scope for this version of",
|
||||
"`ActivityPub`.",
|
||||
"",
|
||||
"The Social Web Community Group is refining the protocol in the",
|
||||
"[`ActivityPub` Media Upload report](https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload).",
|
||||
"",
|
||||
"- Range: `anyUri`",
|
||||
"- Functional: false",
|
||||
],
|
||||
types [ XsdAnyUri ],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
276
src/object/streams.rs
Normal file
276
src/object/streams.rs
Normal file
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
object::{kind::*, properties::*},
|
||||
Object, PropRefs,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct ImageBox(pub Box<Image>);
|
||||
|
||||
/// Represents any kind of multi-paragraph written work.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Article {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ArticleType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
/// Represents an audio document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Audio {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: AudioType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
/// Represents a document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Document {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: DocumentType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
/// Represents any kind of event.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Event {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: EventType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
/// An image document of any kind
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Image {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ImageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
/// Represents a short written work typically less than a single paragraph in length.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Note {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: NoteType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
/// Represents a Web Page.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Page {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: PageType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
/// Represents a logical or physical location.
|
||||
///
|
||||
/// The Place object is used to represent both physical and logical locations. While numerous
|
||||
/// existing vocabularies exist for describing locations in a variety of ways, inconsistencies and
|
||||
/// incompatibilities between those vocabularies make it difficult to achieve appropriate
|
||||
/// interoperability between implementations. The Place object is included within the Activity
|
||||
/// vocabulary to provide a minimal, interoperable starting point for describing locations
|
||||
/// consistently across Activity Streams 2.0 implementations.
|
||||
///
|
||||
/// The Place object is intentionally flexible. It can, for instance, be used to identify a location
|
||||
/// simply by name, or by longitude and latitude.
|
||||
///
|
||||
/// The Place object can also describe an area around a given point using the radius property, the
|
||||
/// altitude of the location, and a degree of accuracy.
|
||||
///
|
||||
/// While publishers are not required to use these specific properties and MAY make use of other
|
||||
/// mechanisms for describing locations, consuming implementations that support the Place object
|
||||
/// MUST support the use of these properties.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Place {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: PlaceType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid place properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub place: PlaceProperties,
|
||||
}
|
||||
|
||||
/// A Profile is a content object that describes another `Object`, typically used to describe
|
||||
/// `Actor` Type objects.
|
||||
///
|
||||
/// The `describes` property is used to reference the object being described by the profile.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Profile {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: ProfileType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid profile properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub profile: ProfileProperties,
|
||||
}
|
||||
|
||||
/// Describes a relationship between two individuals.
|
||||
///
|
||||
/// The subject and object properties are used to identify the connected individuals.
|
||||
///
|
||||
/// The `Relationship` object is used to represent relationships between individuals. It can be
|
||||
/// used, for instance, to describe that one person is a friend of another, or that one person is a
|
||||
/// member of a particular organization. The intent of modeling Relationship in this way is to allow
|
||||
/// descriptions of activities that operate on the relationships in general, and to allow
|
||||
/// representation of Collections of relationships.
|
||||
///
|
||||
/// For instance, many social systems have a notion of a "friends list". These are the collection of
|
||||
/// individuals that are directly connected within a person's social graph. Suppose we have a user,
|
||||
/// Sally, with direct relationships to users Joe and Jane. Sally follows Joe's updates while Sally
|
||||
/// and Jane have a mutual relationship.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Relationship {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: RelationshipType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid relationship properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub relationship: RelationshipProperties,
|
||||
}
|
||||
|
||||
/// A Tombstone represents a content object that has been deleted.
|
||||
///
|
||||
/// It can be used in Collections to signify that there used to be an object at this position, but
|
||||
/// it has been deleted.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Tombstone {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: TombstoneType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
|
||||
/// Adds all valid tombstone properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(None)]
|
||||
pub tombstone_props: TombstoneProperties,
|
||||
}
|
||||
|
||||
/// Represents a video document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, PropRefs, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Video {
|
||||
#[serde(rename = "type")]
|
||||
#[serde(alias = "objectType")]
|
||||
#[serde(alias = "verb")]
|
||||
kind: VideoType,
|
||||
|
||||
/// Adds all valid object properties to this struct
|
||||
#[serde(flatten)]
|
||||
#[activitystreams(Object)]
|
||||
pub object_props: ObjectProperties,
|
||||
}
|
||||
|
||||
impl From<Image> for ImageBox {
|
||||
fn from(i: Image) -> Self {
|
||||
ImageBox(Box::new(i))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ImageBox> for Image {
|
||||
fn from(i: ImageBox) -> Self {
|
||||
*i.0
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue