Add ActivityStreams 1.0 aliases for AS 2 fields

This commit is contained in:
asonix 2019-01-28 12:57:03 -06:00
parent 6e5cfa3043
commit d50ac62d18
34 changed files with 104 additions and 0 deletions

View file

@ -34,6 +34,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Accept {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: AcceptType,
/// Adds all valid accept properties to this struct

View file

@ -35,6 +35,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Add {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: AddType,
/// Adds all valid add properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct AMove {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: MoveType,
/// Adds all valid move properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Announce {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: AnnounceType,
/// Adds all valid announce properties to this struct

View file

@ -34,6 +34,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Arrive {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: ArriveType,
/// Adds all valid arrive properties to this struct

View file

@ -35,6 +35,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Block {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: BlockType,
/// Adds all valid block properties to this struct

View file

@ -31,6 +31,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Create {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: CreateType,
/// Adds all valid create properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Delete {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: DeleteType,
/// Adds all valid delete properties to this struct

View file

@ -31,6 +31,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Dislike {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: DislikeType,
/// Adds all valid dislike properties to this struct

View file

@ -34,6 +34,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Flag {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: FlagType,
/// Adds all valid flag properties to this struct

View file

@ -35,6 +35,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Follow {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: FollowType,
/// Adds all valid follow properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Ignore {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: IgnoreType,
/// Adds all valid ignore properties to this struct

View file

@ -32,6 +32,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Invite {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: InviteType,
/// Adds all valid invite properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Join {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: JoinType,
/// Adds all valid join properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Leave {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: LeaveType,
/// Adds all valid leave properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Like {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: LikeType,
/// Adds all valid like properties to this struct

View file

@ -31,6 +31,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Listen {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
kind: ListenType,
/// Adds all valid listen properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Offer {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: OfferType,
/// Adds all valid object properties to this struct

View file

@ -38,6 +38,8 @@
//! #[serde(rename_all = "camelCase")]
//! pub struct MyActivity {
//! #[serde(rename = "type")]
//! #[serde(alias = "objectType")]
//! #[serde(alias = "verb")]
//! pub kind: String,
//!
//! /// Define a require property for the MyActivity type

View file

@ -38,6 +38,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Question {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: QuestionType,
/// Adds all valid question properties to this struct

View file

@ -31,6 +31,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Read {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: ReadType,
/// Adds all valid read properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Reject {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: RejectType,
/// Adds all valid reject properties to this struct

View file

@ -33,6 +33,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Remove {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: RemoveType,
/// Adds all valid remove properties to this struct

View file

@ -31,6 +31,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct TentativeAccept {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: TentativeAcceptType,
/// Adds all valid tentative_accept properties to this struct

View file

@ -31,6 +31,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct TentativeReject {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: TentativeRejectType,
/// Adds all valid tentative_reject properties to this struct

View file

@ -34,6 +34,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Travel {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: TravelType,
/// Adds all valid travel properties to this struct

View file

@ -37,6 +37,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Undo {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: UndoType,
/// Adds all valid undo properties to this struct

View file

@ -36,6 +36,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct Update {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: UpdateType,
/// Adds all valid update properties to this struct

View file

@ -31,6 +31,8 @@ use object::{properties::ObjectProperties, ObjectExt};
#[serde(rename_all = "camelCase")]
pub struct View {
#[serde(rename = "type")]
#[serde(alias = "objectType")]
#[serde(alias = "verb")]
pub kind: ViewType,
/// Adds all valid view properties to this struct

View file

@ -31,6 +31,8 @@ use self::kind::*;
#[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
@ -55,6 +57,8 @@ impl Actor for Application {}
#[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
@ -79,6 +83,8 @@ impl Actor for Group {}
#[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
@ -103,6 +109,8 @@ impl Actor for Organization {}
#[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
@ -127,6 +135,8 @@ impl Actor for Person {}
#[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

View file

@ -49,6 +49,8 @@ pub trait CollectionPageExt: CollectionPage {
#[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
@ -87,6 +89,8 @@ impl CollectionExt for UnorderedCollection {
#[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
@ -124,6 +128,8 @@ impl CollectionExt for OrderedCollection {
#[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
@ -175,6 +181,8 @@ impl CollectionPageExt for UnorderedCollectionPage {
#[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

View file

@ -39,6 +39,8 @@ pub trait LinkExt: Link {
#[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

View file

@ -39,6 +39,8 @@ pub trait ObjectExt: Object {
#[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
@ -62,6 +64,8 @@ impl ObjectExt for Article {
#[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
@ -85,6 +89,8 @@ impl ObjectExt for Audio {
#[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
@ -108,6 +114,8 @@ impl ObjectExt for Document {
#[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
@ -131,6 +139,8 @@ impl ObjectExt for Event {
#[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
@ -154,6 +164,8 @@ impl ObjectExt for Image {
#[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
@ -177,6 +189,8 @@ impl ObjectExt for Note {
#[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
@ -217,6 +231,8 @@ impl ObjectExt for Page {
#[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
@ -247,6 +263,8 @@ impl ObjectExt for Place {
#[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
@ -287,6 +305,8 @@ impl ObjectExt for Profile {
#[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
@ -317,6 +337,8 @@ impl ObjectExt for Relationship {
#[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
@ -344,6 +366,8 @@ impl ObjectExt for Tombstone {
#[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

View file

@ -83,6 +83,7 @@ pub struct ObjectProperties {
/// - Range: `anyUri`
/// - Functional: true
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(alias = "@id")]
#[activitystreams(concrete(String), functional)]
pub id: Option<serde_json::Value>,
@ -153,6 +154,7 @@ pub struct ObjectProperties {
/// - Range: `xsd:string` | `rdf:langString`
/// - Functional: false
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(alias = "displayName")]
#[activitystreams(concrete(String))]
pub name: Option<serde_json::Value>,