ravenx v0.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

Functions

available_strategies()
available_strategies :: keyword

Function to get a Keyword list of registered strategies.

dispatch(strategy, payload, options \\ %{})
dispatch(atom, map, map) :: {atom, any}

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, "wadus strategy not defined"}
dispatch_async(strategy, payload, options \\ %{})
dispatch_async(atom, map, map) :: {atom, any}

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, "wadus strategy not defined"}