# `Raxol.Gateway.Delivery`
[🔗](https://github.com/DROOdotFOO/raxol/blob/raxol_gateway-v0.2.0/lib/raxol/gateway/delivery.ex#L1)

Sends a rendered outbound message to one of four destinations.

`adapters` is a map of `platform => {adapter_module, conn}`, so a single gateway
delivers across every connected platform. A destination is one of:

  * `{:direct, route}` -- reply to the originating chat.
  * `{:home, route}` -- a configured home channel (cron and background results).
  * `{:cross_platform, route}` -- a different platform's chat.
  * `{:target, "platform:chat_id"}` -- an explicit target string, e.g.
    `"telegram:-1001234567890"`.

All four resolve to a `Raxol.Gateway.Route`; delivery then sends through that
route's platform adapter. A target string's platform must match a connected
adapter (no `String.to_atom/1` on the string).

# `adapters`

```elixir
@type adapters() :: %{required(atom()) =&gt; {module(), term()}}
```

# `destination`

```elixir
@type destination() ::
  {:direct, Raxol.Gateway.Route.t()}
  | {:home, Raxol.Gateway.Route.t()}
  | {:cross_platform, Raxol.Gateway.Route.t()}
  | {:target, String.t()}
```

# `deliver`

```elixir
@spec deliver(adapters(), destination(), term()) :: :ok | {:error, term()}
```

Resolve a destination to a route and send `rendered` through its adapter.

# `resolve`

```elixir
@spec resolve(destination(), adapters()) ::
  {:ok, Raxol.Gateway.Route.t()} | {:error, term()}
```

Resolve a destination to the `Route` it delivers to.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
