View Source ActivityPub.Federator.Publisher behaviour (Bonfire v0.9.11-social-beta.6)

Defines the contract used by federation implementations to publish messages to their peers.

TODO: why not use APPublisher directly instead?

Summary

Callbacks

Gathers links used by an outgoing federation module for WebFinger output.

Determine whether an activity can be relayed using the federation module.

Relays an activity to all specified peers.

Relays an activity to a specified peer, determined by the parameters. The parameters used are controlled by the federation module.

Callbacks

gather_webfinger_links(t)

@callback gather_webfinger_links(Map.t()) :: list()

Gathers links used by an outgoing federation module for WebFinger output.

is_representable?(t)

@callback is_representable?(Map.t()) :: boolean()

Determine whether an activity can be relayed using the federation module.

publish(t, t)

@callback publish(Map.t(), Map.t()) :: :ok | {:error, any()}

Relays an activity to all specified peers.

publish_one(t)

@callback publish_one(Map.t()) :: {:ok, Map.t()} | {:error, any()}

Relays an activity to a specified peer, determined by the parameters. The parameters used are controlled by the federation module.

Functions

enqueue_one(module, params)

@spec enqueue_one(module(), Map.t()) :: :ok

Enqueue publishing a single activity.

gather_webfinger_links(user)

@spec gather_webfinger_links(Map.t()) :: list()

publish(user, activity)

@spec publish(Map.t(), Map.t()) :: :ok