The contract every platform implements to plug into the gateway.
An adapter owns only platform I/O and translation. Routing, sessions, auth, and history live in the gateway, so adding a platform is implementing these five callbacks:
connect/1-- open the platform connection, returning an opaque handle.disconnect/1-- close it.platform/0-- the platform's atom id (:telegram,:discord, ...).normalize_event/1-- map a raw inbound payload to{:ok, route, event}or:ignore.eventis whatever aRaxol.Gateway.Handlerexpects.send_message/3-- deliver a rendered outbound message to a route.
Raxol.Gateway.Adapter.InMemory is a reference implementation.
Stability
Frozen: these five callbacks are the stable contract every platform adapter builds against, including adapters that live outside this repo. Additions must be optional callbacks; existing callbacks do not change shape.
Summary
Types
Callbacks
@callback disconnect(conn()) :: :ok
@callback normalize_event(raw()) :: {:ok, Raxol.Gateway.Route.t(), event()} | :ignore
@callback platform() :: atom()
@callback send_message(conn(), Raxol.Gateway.Route.t(), rendered()) :: :ok | {:error, term()}