Crate activitypub[][src]

ActivityPub

This crate defines the base set of types from the ActivityPub specification.

Example Usage

extern crate activitypub;
extern crate failure;
extern crate serde_json;

use activitypub::{context, object::Video};
use failure::Error;

fn run() -> Result<(), Error> {
    let mut video = Video::default();
    video.object_props.set_context_object(context())?;
    video.ap_object_props.set_likes_string("https://my-instance.com/likes".to_owned());

    let video_string = serde_json::to_string(&video)?;

    let video: Video = serde_json::from_str(&video_string)?;

    Ok(())
}

Modules

activity

Activity traits and types

actor

Actor traits and types

collection

Collection traits and types

link

Link traits and types

object

Object traits and types

properties

A module containing helpers for tranlsating common JSON representations to and from concrete types

Structs

ContextObject

Define a simple wrapper around a string for this crate's main Context type

CustomLink

A custom type extending Link

CustomObject

A custom type extending Object

Endpoint

A json object which maps additional (typically server/domain-wide) endpoints which may be useful either for this actor or someone referencing this actor.

Enums

Error

The Error type

Traits

Activity

An Activity is a subtype of Object that describes some form of action that may happen, is currently happening, or has already happened.

Actor

Actor types are Object types that are capable of performing activities.

Collection

A Collection is a subtype of Object that represents ordered or unordered sets of Object or Link instances.

CollectionPage

Used to represent distinct subsets of items from a Collection.

IntransitiveActivity

Instances of IntransitiveActivity are a subtype of Activity representing intransitive actions.

Link

A Link is an indirect, qualified reference to a resource identified by a URL.

Object

Describes an object of any kind.

Functions

context

The context associated with all of the Activity Streams types defined in the crate.

Type Definitions

Result

An alias for Result<T, Error>