Wardrik.Operations.Channels (wardrik v0.1.0-rc.1)

Copy Markdown

Passes chat apps' requests to Wardrik's channels.

Summary

Functions

Passes a chat app's request to the channel it names. Returns the channel's response.

Returns the channel name as {module, opts}, or :error if there's none.

Returns the options a channel's callbacks take.

Functions

deliver(scope, input)

@spec deliver(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}

Passes a chat app's request to the channel it names. Returns the channel's response.

fetch(instance, name)

@spec fetch(atom(), String.t()) :: {:ok, {module(), keyword()}} | :error

Returns the channel name as {module, opts}, or :error if there's none.

opts are what the channel's callbacks take. See options/3.

options(wardrik, name, opts)

@spec options(Wardrik.t(), String.t(), keyword()) :: keyword()

Returns the options a channel's callbacks take.

They're the channel's own options, with each {:secret, name} replaced by the deployment's secret, plus:

  • :server - Wardrik, which runs its operations.
  • :wardrik - the instance's name.
  • :events - the event log.
  • :vault - the vault, or nil without :keys.
  • :channel - the channel's name.
  • :store - the store.