# `Wardrik.Channels`

Installs Wardrik's chat apps into people's workspaces, from your app's own pages.

    # 1. Send the person to the chat app
    {:ok, url} = Wardrik.Channels.install_url(MyApp.AgentRuntime, "slack", "acme", return_to: "/settings")

    # 2. When the chat app sends them back
    {:ok, installation, next} = Wardrik.Channels.installed(MyApp.AgentRuntime, "slack", "acme", params)

    # 3. To remove it
    :ok = Wardrik.Channels.uninstall(MyApp.AgentRuntime, "slack", installation.workspace)

The channel's adapter, such as `WardrikSlack`, does the work. Returns an error if the adapter
doesn't support it.

# `install_url`

```elixir
@spec install_url(atom(), String.t(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, String.t()}
```

Returns the URL where someone acting for `owner` installs the channel `name`'s chat app.

## Options

  * `:return_to` - where they're sent once it's installed.

# `installed`

```elixir
@spec installed(atom(), String.t(), String.t(), map()) ::
  {:ok, Wardrik.Channel.Installation.t(), String.t() | nil}
  | {:error, String.t()}
```

Completes an install from the chat app's callback `query`.

Returns the installation and where to send the person next.

# `uninstall`

```elixir
@spec uninstall(atom(), String.t(), String.t()) :: :ok | {:error, String.t()}
```

Uninstalls the channel `name`'s chat app from `workspace`, and forgets the workspace.

---

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