View Source Bonfire.Social.Boosts (Bonfire v0.9.10-classic-beta.169)
Mutate, query, and federate boosts (re-sharing an activity or object).
Boosts are implemented on top of the Bonfire.Data.Edges.Edge
schema (see Bonfire.Social.Edges
for shared functions)
Summary
Functions
Publishes a federated activity for a boost action.
Receives and processes a federated boost activity.
Boosts an object for a user.
Checks if a user has boosted an object.
Counts boosts based on filters and options.
Gets the date of the latest boost by a user for an object.
Callback implementation for Bonfire.Federate.ActivityPub.FederationModules.federation_module/0
.
Retrieves a boost edge by subject and object.
Retrieves a boost edge, raising an error if not found.
Lists boosts by a specific user.
Lists boosts by the current user.
Lists boosts of a specific object.
Lists boosts with pagination.
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.
Removes a boost from an object for a user, if one exists
Functions
Publishes a federated activity for a boost action.
Examples
iex> Bonfire.Social.Boosts.ap_publish_activity(subject, :create, boost)
{:ok, _activity}
Receives and processes a federated boost activity.
Examples
iex> Bonfire.Social.Boosts.ap_receive_activity(creator, activity, object)
{:ok, _boost}
Boosts an object for a user.
Examples
iex> Bonfire.Social.Boosts.boost(user, object)
{:ok, %Bonfire.Data.Social.Boost{}}
Checks if a user has boosted an object.
Examples
iex> Bonfire.Social.Boosts.boosted?(user, object)
true
Counts boosts based on filters and options.
Examples
iex> Bonfire.Social.Boosts.count([subject: user_id], [])
5 # user made 5 boosts, across all objects
iex> Bonfire.Social.Boosts.count(user, object)
3 # user boosted object 3 times
iex> Bonfire.Social.Boosts.count(object, [])
10 # object was boosted 5 times, across all users
Gets the date of the latest boost by a user for an object.
Examples
iex> Bonfire.Social.Boosts.date_last_boosted(user, object)
~U[2023-07-29 12:34:56Z]
Callback implementation for Bonfire.Federate.ActivityPub.FederationModules.federation_module/0
.
Retrieves a boost edge by subject and object.
Examples
iex> Bonfire.Social.Boosts.get(subject, object)
{:ok, %Bonfire.Data.Social.Boost{}}
Retrieves a boost edge, raising an error if not found.
Lists boosts by a specific user.
Examples
iex> Bonfire.Social.Boosts.list_by(user_id)
[%Bonfire.Data.Social.Boost{}, ...]
Lists boosts by the current user.
Examples
iex> Bonfire.Social.Boosts.list_my(current_user: me)
[%Bonfire.Data.Social.Boost{}, ...]
Lists boosts of a specific object.
Examples
iex> Bonfire.Social.Boosts.list_of(object_id)
[%Bonfire.Data.Social.Boost{}, ...]
Lists boosts with pagination.
Examples
iex> Bonfire.Social.Boosts.list_paginated([subject: user_id], [limit: 10])
%{edges: [%Bonfire.Data.Social.Boost{}, ...], page_info: %{...}}
Callback implementation for Bonfire.Common.ContextModule.query_module/0
.
Callback implementation for Bonfire.Common.ContextModule.schema_module/0
.
Removes a boost from an object for a user, if one exists
Examples
iex> Bonfire.Social.Boosts.unboost(user, object)
{:ok, _}