bovine_process.common.interactions
interaction_handlers = {None: dict(Announce=announce_handler, Create=reply_handler, Delete=delete_reply_handler, Dislike=like_handler, Like=like_handler, Undo=undo_handler), 'http://litepub.social/ns#EmojiReact': like_handler}
module-attribute
The handlers being called for interactions
InteractionActor
Bases: ABC
Abstract class to illustrate what is needed to process interactions
Source code in bovine_process/bovine_process/common/interactions.py
add_to_interaction(interaction_type, object_id, interaction)
abstractmethod
async
Adds to interaction
Example object for interaction_type = "likes"
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interaction_type |
str
|
One of |
required |
object_id |
str
|
id of the object being interacted with |
required |
interaction |
str
|
The id of the interacting object |
required |
Source code in bovine_process/bovine_process/common/interactions.py
remove_from_interaction(interaction_type, object_id, interaction)
abstractmethod
async
Removes from interaction
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interaction_type |
str
|
One of |
required |
object_id |
str
|
id of the object being interacted with |
required |
interaction |
str
|
The id of the interacting object |
required |
Source code in bovine_process/bovine_process/common/interactions.py
remove_references(object_id)
abstractmethod
async
Removes references to the object. Used in case an object is deleted and it is unknown which object it replies to
announce_handler(item, actor)
async
Adds object to the shares collection of the announced object, if
- object being announced is owner by the receiving actor
Source code in bovine_process/bovine_process/common/interactions.py
delete_reply_handler(item, actor)
async
If a reply is deleted, removes it from the replies collection
Source code in bovine_process/bovine_process/common/interactions.py
like_handler(item, actor)
async
Adds object to the likes collection of the liked object, if
- object being liked is owner by the receiving actor
Source code in bovine_process/bovine_process/common/interactions.py
reply_handler(item, actor)
async
Adds object to the replies collection. Object being replied to
is determined from inReplyTo
. Reply is added if the object
belongs to the receiving actor.
Source code in bovine_process/bovine_process/common/interactions.py
undo_handler(item, actor)
async
For an Undo of a Like, Dislike, Announce , they are removed from the appropriate collection.