1
0
Fork 0
forked from alemi/upub
upub/apb/src/lib.rs

128 lines
4.8 KiB
Rust
Raw Normal View History

2024-04-06 19:16:15 +02:00
//! # apb
//! > traits and types for implementing [ActivityPub](https://www.w3.org/TR/activitypub/)
//!
//! The main type this crate exposes is the [Node], which can be:
//! - [Node::Empty]: not present in object
//! - [Node::Link]: contains just link to object
//! - [Node::Object]: contains embedded object
//! - [Node::Array]: contains array of embedded objects
//!
//! Nodes contain AP objects, which implement one or more traits (such as [Object] or [Actor])
//!
//! ## features
//! * `unstructured`: all traits are implemented for [serde_json::Value], so that it's possible to manipulate free-form json maps as valid AP objects
//! * `orm`: enum types are also database-friendly with sea-orm
//! * `fetch`: [Node] exposes [Node::fetch] to dereference remote nodes
//!
//! ## structure
//! - **[Base]** | **[BaseMut]** | [BaseType]
//! - [BaseType::Link] | **[Link]** | **[LinkMut]** | [LinkType]
//! - [LinkType::Mention]
//! - [LinkType::Link]
//! - [BaseType::Object] | **[Object]** | **[ObjectMut]** | [ObjectType]
//! - [ObjectType::Activity] | **[Activity]** | **[ActivityMut]** | [ActivityType]
//! - [ActivityType::Accept] | **[Accept]** | **[AcceptMut]** | [AcceptType]
//! - [AcceptType::TentativeAccept]
//! - [ActivityType::Add]
//! - [ActivityType::Announce]
//! - [ActivityType::Create]
//! - [ActivityType::Delete]
//! - [ActivityType::Dislike]
//! - [ActivityType::Flag]
//! - [ActivityType::Follow]
//! - [ActivityType::IntransitiveActivity] | **[IntransitiveActivity]** | **[IntransitiveActivityMut]** | [IntransitiveActivityType]
//! - [IntransitiveActivityType::IntransitiveActivity]
//! - [IntransitiveActivityType::Arrive]
//! - [IntransitiveActivityType::Question]
//! - [IntransitiveActivityType::Travel]
//! - [ActivityType::Ignore] | **[Ignore]** | **[IgnoreMut]** | [IgnoreType]
//! - [IgnoreType::Ignore]
//! - [IgnoreType::Block]
//! - [ActivityType::Join]
//! - [ActivityType::Leave]
//! - [ActivityType::Like]
//! - [ActivityType::Listen]
//! - [ActivityType::Move]
//! - [ActivityType::Offer] | **[Offer]** | **[OfferMut]** | [OfferType]
//! - [OfferType::Offer]
//! - [OfferType::Invite]
//! - [ActivityType::Read]
//! - [ActivityType::Reject] | **[Reject]** | **[RejectMut]** | [RejectType]
//! - [RejectType::Reject]
//! - [RejectType::TentativeReject]
//! - [ActivityType::Remove]
//! - [ActivityType::Undo]
//! - [ActivityType::Update]
//! - [ActivityType::View]
//! - [ObjectType::Actor] | **[Actor]** | **[ActorMut]** | [ActorType] *
//! - [ActorType::Application]
//! - [ActorType::Group]
//! - [ActorType::Organization]
//! - [ActorType::Person]
//! - [ObjectType::Article]
//! - [ObjectType::Collection] | **[Collection]** | **[CollectionMut]** | [CollectionType]
//! - [CollectionType::Collection]
//! - [CollectionType::CollectionPage]
//! - [CollectionType::OrderedCollection]
//! - [CollectionType::OrderedCollectionPage]
//! - [ObjectType::Document] | **[Document]** | **[DocumentMut]** | [DocumentType]
//! - [DocumentType::Document]
//! - [DocumentType::Audio]
//! - [DocumentType::Image]
//! - [DocumentType::Page]
//! - [DocumentType::Video]
//! - [ObjectType::Event]
//! - [ObjectType::Note]
//! - [ObjectType::Object]
//! - [ObjectType::Place]
//! - [ObjectType::Profile]
//! - [ObjectType::Relationship]
//! - [ObjectType::Tombstone]
//! - **[PublicKey]** | **[PublicKeyMut]** \*\*
//!
//! *: `Actor` is technically just an object, not really a "subtype"
//!
//! **: `PublicKey` is introduced in ActivityPub, it's not part of ActivityStream
//!
mod macros;
2024-04-06 18:34:15 +02:00
pub(crate) use macros::{strenum, getter, setter};
mod node;
pub use node::Node;
pub mod server;
pub mod target;
2024-04-06 18:34:15 +02:00
mod key;
pub use key::{PublicKey, PublicKeyMut};
mod types;
pub use types::{
base::{Base, BaseMut, BaseType},
link::{Link, LinkMut, LinkType},
object::{
Object, ObjectMut, ObjectType,
activity::{
Activity, ActivityMut, ActivityType,
accept::{Accept, AcceptMut, AcceptType},
ignore::{Ignore, IgnoreMut, IgnoreType},
intransitive::{IntransitiveActivity, IntransitiveActivityMut, IntransitiveActivityType},
offer::{Offer, OfferMut, OfferType},
reject::{Reject, RejectMut, RejectType},
},
actor::{Actor, ActorMut, ActorType},
collection::{
Collection, CollectionMut, CollectionType,
page::{CollectionPage, CollectionPageMut}
},
document::{Document, DocumentMut, DocumentType},
place::{Place, PlaceMut},
// profile::Profile,
relationship::{Relationship, RelationshipMut},
tombstone::{Tombstone, TombstoneMut},
},
};