ravenx v1.1.0 Ravenx
Ravenx main module.
It includes and manages dispatching of messages through registered strategies.
Summary
Functions
Function to get a Keyword list of registered strategies
Dispatch a notification payload to a specified strategy
Dispatch a notification payload to a specified strategy asynchronously
Types
Functions
Function to get a Keyword list of registered strategies.
dispatch(notif_strategy, notif_payload, notif_options) :: notif_result
Dispatch a notification payload to a specified strategy.
Custom options for this call can be passed in options parameter.
Returns a tuple with :ok or :error indicating the final state.
Examples
iex> Ravenx.dispatch(:slack, %{title: "Hello world!", body: "Science is cool"})
{:ok, "ok"}
iex> Ravenx.dispatch(:wadus, %{title: "Hello world!", body: "Science is cool"})
{:error, {:unknown_strategy, :wadus}}
dispatch_async(notif_strategy, notif_payload, notif_options) :: notif_result
Dispatch a notification payload to a specified strategy asynchronously.
Custom options for this call can be passed in options parameter.
Returns a tuple with :ok or :error indicating the task launch result.
If the result was :ok, the Task of the process launched is also returned
Examples
iex> {status, task} = Ravenx.dispatch_async(:slack, %{title: "Hello world!", body: "Science is cool"})
{:ok, %Task{owner: #PID<0.165.0>, pid: #PID<0.183.0>, ref: #Reference<0.0.4.418>}}
iex> Task.await(task)
{:ok, "ok"}
iex> Ravenx.dispatch_async(:wadus, %{title: "Hello world!", body: "Science is cool"})
{:error, {:unknown_strategy, :wadus}}