# `Wardrik.Channel.Installations`

A behaviour for storing the workspaces a channel is added to, each with its token.

Pass an implementation to a channel as `installations: {module, config}`. The host then keeps
workspaces with its own records. A channel given `token:` instead serves only the workspace that
token reaches.

Tokens are secrets. Store them as you store your others.

# `delete`

```elixir
@callback delete(config :: term(), channel :: String.t(), workspace :: String.t()) :: :ok
```

Deletes the channel's installation in `workspace`. Returns `:ok` if there is none.

# `fetch`

```elixir
@callback fetch(config :: term(), channel :: String.t(), workspace :: String.t()) ::
  {:ok, Wardrik.Channel.Installation.t()} | :error
```

Fetches the channel's installation in `workspace`, as the chat app names it.

# `owned`

```elixir
@callback owned(config :: term(), channel :: String.t(), owner :: String.t()) :: [
  Wardrik.Channel.Installation.t()
]
```

Returns the channel's installations owned by `owner`, as `acme` or `acme/@jon`.

# `put`

```elixir
@callback put(config :: term(), Wardrik.Channel.Installation.t()) ::
  :ok | {:error, String.t()}
```

Stores `installation`, replacing any with the same channel and workspace.

---

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