# `DripDrop.ChannelAdapters`
[🔗](https://github.com/agoodway/dripdrop/blob/v0.1.0/lib/dripdrop/channel_adapters.ex#L1)

Context for creating, updating, and selecting channel adapters.

# `list_filters`

```elixir
@type list_filters() :: %{
  optional(:tenant_key) =&gt; binary() | nil,
  optional(:channel) =&gt; binary(),
  optional(:active) =&gt; boolean()
}
```

# `create_channel_adapter`

```elixir
@spec create_channel_adapter(map()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
```

Creates a channel adapter and atomically promotes it when `is_default` is true.

# `get_active_adapter`

```elixir
@spec get_active_adapter(Ecto.UUID.t() | binary()) :: Ecto.Schema.t() | nil
```

Gets an active channel adapter by id.

# `get_default_adapter`

```elixir
@spec get_default_adapter(binary() | atom(), binary() | nil) :: Ecto.Schema.t() | nil
```

Returns the active default adapter for a channel, preferring the tenant default.

# `list_channel_adapters`

```elixir
@spec list_channel_adapters(list_filters()) :: [Ecto.Schema.t()]
```

Lists channel adapters using optional tenant, channel, and active filters.

# `select`

```elixir
@spec select(term(), term(), term()) ::
  {:ok, Ecto.Schema.t()} | {:error, %{kind: :permanent, reason: :no_adapter}}
```

Selects the adapter for a step using explicit, rotation, sequence, and default fallbacks.

# `select_outbound`

```elixir
@spec select_outbound(term(), term()) ::
  {:ok, Ecto.Schema.t()}
  | {:error, %{kind: :permanent, reason: :no_outbound_pin | :no_adapter}}
```

Selects the pinned outbound adapter, allowing a per-step override.

# `update_channel_adapter`

```elixir
@spec update_channel_adapter(Ecto.Schema.t(), map()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
```

Updates a channel adapter and demotes the previous scoped default when needed.

# `webhook_routes`

```elixir
@spec webhook_routes() :: [DripDrop.Channel.webhook_route()]
```

Returns webhook routes exposed by active provider adapters.

---

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