Vibe.Gateway.Adapter behaviour (vibe v0.2.2)

Copy Markdown View Source

Behaviour implemented by outbound messaging gateway adapters.

Stream consumers and session bridges use this contract instead of calling a platform SDK directly. Telegram can edit messages; future backends can return {:error, :unsupported} from optional callbacks and let the generic gateway fall back to plain sends.

Summary

Types

send_result()

@type send_result() :: {:ok, String.t() | nil} | {:error, term()}

Callbacks

delete(chat_id, message_id, opts)

(optional)
@callback delete(chat_id :: String.t(), message_id :: String.t(), opts :: keyword()) ::
  :ok | {:error, term()}

edit(chat_id, message_id, text, opts)

@callback edit(
  chat_id :: String.t(),
  message_id :: String.t(),
  text :: String.t(),
  opts :: keyword()
) :: send_result()

send(chat_id, text, opts)

@callback send(chat_id :: String.t(), text :: String.t(), opts :: keyword()) ::
  send_result()

typing(chat_id, opts)

(optional)
@callback typing(chat_id :: String.t(), opts :: keyword()) :: :ok | {:error, term()}