6 releases
new 0.3.1 | Dec 7, 2024 |
---|---|
0.3.0 |
|
0.2.2 | Jul 15, 2024 |
0.2.1 | Jun 23, 2024 |
0.1.1 | Apr 6, 2024 |
#1155 in Web programming
193 downloads per month
78KB
1.5K
SLoC
apb
traits and types for implementing ActivityPub
apb
implements all ActivityStreams types as traits, so that implementing structs don't need to hold all possible fields, but only implement getters for relevant ones
apb
also provides a Node<T>
enum, which can represent ActivityPub nodes (empty, link, object, array)
read more in this crate's docs
why
upub uses these types to implement its federation, but I wanted to modularize apb types
state
this crate is still work in progress and favors upub's needs, get in touch if you'd like to help or tune apb to your project!
lib.rs
:
apb
traits and types for implementing 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 objectsorm
: enum types are also database-friendly with sea-ormfetch
: [Node] exposes Node::fetch to dereference remote nodes
structure
- [Base] | [BaseMut] | [BaseType]
- BaseType::Link | [Link] | [LinkMut] | [LinkType]
- BaseType::Object | [Object] | [ObjectMut] | [ObjectType]
- ObjectType::Activity | [Activity] | [ActivityMut] | [ActivityType]
- ActivityType::Accept | [Accept] | [AcceptMut] | [AcceptType]
- ActivityType::Add
- ActivityType::Announce
- ActivityType::Create
- ActivityType::Delete
- ActivityType::Dislike
- ActivityType::Flag
- ActivityType::Follow
- ActivityType::IntransitiveActivity | [IntransitiveActivity] | [IntransitiveActivityMut] | [IntransitiveActivityType]
- ActivityType::Ignore | [Ignore] | [IgnoreMut] | [IgnoreType]
- ActivityType::Join
- ActivityType::Leave
- ActivityType::Like
- ActivityType::Listen
- ActivityType::Move
- ActivityType::Offer | [Offer] | [OfferMut] | [OfferType]
- ActivityType::Read
- ActivityType::Reject | [Reject] | [RejectMut] | [RejectType]
- ActivityType::Remove
- ActivityType::Undo
- ActivityType::Update
- ActivityType::View
- ObjectType::Actor | [Actor] | [ActorMut] | [ActorType] *
- ObjectType::Article
- ObjectType::Collection | [Collection] | [CollectionMut] | [CollectionType]
- ObjectType::Document | [Document] | [DocumentMut] | [DocumentType]
- ObjectType::Event
- ObjectType::Note
- ObjectType::Object
- ObjectType::Place
- ObjectType::Profile
- ObjectType::Relationship
- ObjectType::Tombstone
- ObjectType::Activity | [Activity] | [ActivityMut] | [ActivityType]
- [PublicKey] | [PublicKeyMut] **
*: Actor
is technically just an object, not really a "subtype"
**: PublicKey
is introduced in ActivityPub, it's not part of ActivityStream
Dependencies
~2–13MB
~154K SLoC