mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2025-02-16 13:35:14 +00:00
Fix typo, improve docs in wrapper crate
This commit is contained in:
parent
5513a77dd3
commit
9011b35792
13 changed files with 26 additions and 115 deletions
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "activitystreams"
|
name = "activitystreams"
|
||||||
description = "Activity Streams in Rust"
|
description = "Activity Streams in Rust"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix.dev@gmail.com>"]
|
authors = ["asonix <asonix.dev@gmail.com>"]
|
||||||
repository = "https://github.com/asonix/activitystreams"
|
repository = "https://github.com/asonix/activitystreams"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "activitystreams-types"
|
name = "activitystreams-types"
|
||||||
description = "Base types from the Activity Streams spec"
|
description = "Base types from the Activity Streams spec"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix.dev@gmail.com>"]
|
authors = ["asonix <asonix.dev@gmail.com>"]
|
||||||
repository = "https://github.com/asonix/activitystreams"
|
repository = "https://github.com/asonix/activitystreams"
|
||||||
|
|
|
@ -23,13 +23,13 @@ use activitystreams_traits::{Actor, Object};
|
||||||
|
|
||||||
use object::properties::ObjectProperties;
|
use object::properties::ObjectProperties;
|
||||||
|
|
||||||
mod kind;
|
pub mod kind;
|
||||||
pub use self::kind::*;
|
use self::kind::*;
|
||||||
|
|
||||||
/// Describes a software application.
|
/// Describes a software application.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Appliation {
|
pub struct Application {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
kind: ApplicationType,
|
kind: ApplicationType,
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ pub struct Appliation {
|
||||||
pub object_props: ObjectProperties,
|
pub object_props: ObjectProperties,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Object for Appliation {}
|
impl Object for Application {}
|
||||||
impl Actor for Appliation {}
|
impl Actor for Application {}
|
||||||
|
|
||||||
/// Represents a formal or informal collective of Actors.
|
/// Represents a formal or informal collective of Actors.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
|
|
@ -28,6 +28,7 @@ pub mod properties;
|
||||||
use self::kind::*;
|
use self::kind::*;
|
||||||
use self::properties::*;
|
use self::properties::*;
|
||||||
|
|
||||||
|
/// The default `Collection` type.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct UnorderedCollection {
|
pub struct UnorderedCollection {
|
||||||
|
|
|
@ -21,9 +21,8 @@
|
||||||
|
|
||||||
use serde::{de::DeserializeOwned, ser::Serialize};
|
use serde::{de::DeserializeOwned, ser::Serialize};
|
||||||
|
|
||||||
use activitystreams_traits::{
|
use activitystreams_traits::{Activity, Actor, Collection, CollectionPage, IntransitiveActivity,
|
||||||
Activity, Actor, Collection, CollectionPage, IntransitiveActivity, Link, Object,
|
Link, Object};
|
||||||
};
|
|
||||||
|
|
||||||
/// A custom type extending Link
|
/// A custom type extending Link
|
||||||
///
|
///
|
||||||
|
|
|
@ -19,18 +19,9 @@
|
||||||
|
|
||||||
//! Activity traits and types
|
//! Activity traits and types
|
||||||
|
|
||||||
/// An Activity is a subtype of `Object` that describes some form of action that may happen, is
|
pub use activitystreams_traits::{Activity, IntransitiveActivity};
|
||||||
/// currently happening, or has already happened.
|
pub use activitystreams_types::activity::{kind, properties, AMove, Accept, Add, Announce, Arrive,
|
||||||
///
|
Block, Create, Delete, Dislike, Flag, Follow, Ignore,
|
||||||
/// The `Activity` type itself serves as an abstract base type for all types of activities. It is
|
Invite, Join, Leave, Like, Listen, Offer, Question,
|
||||||
/// important to note that the `Activity` type itself does not carry any specific semantics about
|
Read, Reject, Remove, TentativeAccept, TentativeReject,
|
||||||
/// the kind of action being taken.
|
Travel, Undo, Update, View};
|
||||||
pub use activitystreams_traits::Activity;
|
|
||||||
|
|
||||||
/// Instances of `IntransitiveActivity` are a subtype of `Activity` representing intransitive
|
|
||||||
/// actions.
|
|
||||||
///
|
|
||||||
/// The `object` property is therefore inappropriate for these activities.
|
|
||||||
pub use activitystreams_traits::IntransitiveActivity;
|
|
||||||
|
|
||||||
pub use activitystreams_types::activity::*;
|
|
||||||
|
|
22
src/actor.rs
22
src/actor.rs
|
@ -19,25 +19,5 @@
|
||||||
|
|
||||||
//! Actor traits and types
|
//! Actor traits and types
|
||||||
|
|
||||||
/// `Actor` types are `Object` types that are capable of performing activities.
|
|
||||||
///
|
|
||||||
/// This specification intentionally defines `Actors` in only the most generalized way, stopping
|
|
||||||
/// short of defining semantically specific properties for each. All Actor objects are
|
|
||||||
/// specializations of `Object` and inherit all of the core properties common to all Objects.
|
|
||||||
/// External vocabularies can be used to express additional detail not covered by the Activity
|
|
||||||
/// Vocabulary. VCard [[vcard-rdf](https://www.w3.org/TR/vcard-rdf/) SHOULD be used to provide
|
|
||||||
/// additional metadata for `Person`, `Group`, and `Organization` instances.
|
|
||||||
///
|
|
||||||
/// While implementations are free to introduce new types of Actors beyond those defined by the
|
|
||||||
/// Activity Vocabulary, interoperability issues can arise when applications rely too much on
|
|
||||||
/// extension types that are not recognized by other implementations. Care should be taken to not
|
|
||||||
/// unduly overlap with or duplicate the existing `Actor` types.
|
|
||||||
///
|
|
||||||
/// When an implementation uses an extension type that overlaps with a core vocabulary type, the
|
|
||||||
/// implementation MUST also specify the core vocabulary type. For instance, some vocabularies
|
|
||||||
/// (e.g. VCard) define their own types for describing people. An implementation that wishes, for
|
|
||||||
/// example, to use a `vcard:Individual` as an `Actor` MUST also identify that `Actor` as a
|
|
||||||
/// `Person`.
|
|
||||||
pub use activitystreams_traits::Actor;
|
pub use activitystreams_traits::Actor;
|
||||||
|
pub use activitystreams_types::actor::{kind, Application, Group, Organization, Person, Service};
|
||||||
pub use activitystreams_types::actor::*;
|
|
||||||
|
|
|
@ -19,27 +19,7 @@
|
||||||
|
|
||||||
//! Collection traits and types
|
//! Collection traits and types
|
||||||
|
|
||||||
/// A Collection is a subtype of `Object` that represents ordered or unordered sets of `Object` or
|
pub use activitystreams_traits::{Collection, CollectionPage};
|
||||||
/// `Link` instances.
|
pub use activitystreams_types::collection::{kind, properties, OrderedCollection,
|
||||||
///
|
OrderedCollectionPage, UnorderedCollection,
|
||||||
/// The items within a Collection can be ordered or unordered. The OrderedCollection type MAY be
|
UnorderedCollectionPage};
|
||||||
/// used to identify a Collection whose items are always ordered. In the JSON serialization, the
|
|
||||||
/// unordered items of a Collection are represented using the items property while ordered items
|
|
||||||
/// are represented using the orderedItems property.
|
|
||||||
///
|
|
||||||
/// `UnorderedCollection` and `OrderedCollection` types are provided by the `activitystreams-types`
|
|
||||||
/// crate.
|
|
||||||
pub use activitystreams_traits::Collection;
|
|
||||||
|
|
||||||
/// Used to represent distinct subsets of items from a Collection.
|
|
||||||
///
|
|
||||||
/// A `Collection` can contain a large number of items. Often, it becomes impractical for an
|
|
||||||
/// implementation to serialize every item contained by a `Collection` using the items (or
|
|
||||||
/// `ordered_items`) property alone. In such cases, the items within a `Collection` can be divided
|
|
||||||
/// into distinct subsets or "pages". A page is identified using the `CollectionPage` type.
|
|
||||||
///
|
|
||||||
/// `UnorderedCollectionPage` and `OrderedCollectionPage` types are provied by the
|
|
||||||
/// `activitystreams-types` crate.
|
|
||||||
pub use activitystreams_traits::CollectionPage;
|
|
||||||
|
|
||||||
pub use activitystreams_types::collection::*;
|
|
||||||
|
|
|
@ -19,8 +19,4 @@
|
||||||
|
|
||||||
//! Error traits and types
|
//! Error traits and types
|
||||||
|
|
||||||
/// The Error type
|
pub use activitystreams_traits::{Error, Result};
|
||||||
pub use activitystreams_traits::Error;
|
|
||||||
|
|
||||||
/// An alias for Result<T, Error>
|
|
||||||
pub use activitystreams_traits::Result;
|
|
||||||
|
|
|
@ -147,7 +147,6 @@ pub mod collection;
|
||||||
mod error;
|
mod error;
|
||||||
pub mod link;
|
pub mod link;
|
||||||
pub mod object;
|
pub mod object;
|
||||||
pub mod properties;
|
|
||||||
|
|
||||||
pub use self::activity::{Activity, IntransitiveActivity};
|
pub use self::activity::{Activity, IntransitiveActivity};
|
||||||
pub use self::actor::Actor;
|
pub use self::actor::Actor;
|
||||||
|
@ -155,4 +154,5 @@ pub use self::collection::{Collection, CollectionPage};
|
||||||
pub use self::error::{Error, Result};
|
pub use self::error::{Error, Result};
|
||||||
pub use self::link::Link;
|
pub use self::link::Link;
|
||||||
pub use self::object::Object;
|
pub use self::object::Object;
|
||||||
|
pub use activitystreams_traits::properties;
|
||||||
pub use activitystreams_types::context;
|
pub use activitystreams_types::context;
|
||||||
|
|
11
src/link.rs
11
src/link.rs
|
@ -19,14 +19,5 @@
|
||||||
|
|
||||||
//! Link traits and types
|
//! Link traits and types
|
||||||
|
|
||||||
/// A Link is an indirect, qualified reference to a resource identified by a URL.
|
|
||||||
///
|
|
||||||
/// The fundamental model for links is established by
|
|
||||||
/// [[RFC5988](https://tools.ietf.org/html/rfc5988)]. Many of the properties defined by the
|
|
||||||
/// Activity Vocabulary allow values that are either instances of Object or Link. When a Link is
|
|
||||||
/// used, it establishes a qualified relation connecting the subject (the containing object) to the
|
|
||||||
/// resource identified by the href. Properties of the Link are properties of the reference as
|
|
||||||
/// opposed to properties of the resource.
|
|
||||||
pub use activitystreams_traits::Link;
|
pub use activitystreams_traits::Link;
|
||||||
|
pub use activitystreams_types::link::{kind, properties, Mention};
|
||||||
pub use activitystreams_types::link::*;
|
|
||||||
|
|
|
@ -19,11 +19,6 @@
|
||||||
|
|
||||||
//! Object traits and types
|
//! Object traits and types
|
||||||
|
|
||||||
/// Describes an object of any kind.
|
|
||||||
///
|
|
||||||
/// The Object type serves as the base type for most of the other kinds of objects defined in the
|
|
||||||
/// Activity Vocabulary, including other Core types such as `Activity`, `IntransitiveActivity`,
|
|
||||||
/// `Collection` and `OrderedCollection`.
|
|
||||||
pub use activitystreams_traits::Object;
|
pub use activitystreams_traits::Object;
|
||||||
|
pub use activitystreams_types::object::{kind, properties, Article, Audio, Document, Event, Image,
|
||||||
pub use activitystreams_types::object::*;
|
Note, Page, Place, Profile, Relationship, Tombstone, Video};
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of ActivityStreams.
|
|
||||||
*
|
|
||||||
* Copyright © 2018 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//! Helpers for translating properties between `serde_json::Value` and concrete types
|
|
||||||
|
|
||||||
pub use activitystreams_traits::properties::*;
|
|
Loading…
Reference in a new issue