# `WardrikChannel.Workspace`

A channel in one place it's added to, such as one Slack workspace.

Adapters get one for each request with `WardrikChannel.workspace/2`.

People in the workspace act in Wardrik as themselves:

  * Everyone may read and message the installation owner's agents.
  * Approvers may also decide what those agents wait on. The adapter is asked whether someone
    is an approver only when they decide.

The workspace offers the owner's agents whose definitions list the channel in `channels`.

# `t`

```elixir
@type t() :: %WardrikChannel.Workspace{
  channel: WardrikChannel.Channel.t(),
  installation: Wardrik.Channel.Installation.t()
}
```

# `approver?`

```elixir
@spec approver?(t(), WardrikChannel.Member.t()) :: boolean()
```

Returns whether `member` is one of the installation's approvers.

# `conversation`

```elixir
@spec conversation(t(), String.t(), String.t(), String.t()) :: String.t()
```

Returns the ID of the conversation `agent` holds for `thread` of `room`, as
`acme/triage/slack.T0123.C024BE91L.1696.1234`.

# `deciding_scope`

```elixir
@spec deciding_scope(t(), WardrikChannel.Member.t(), String.t(), String.t() | nil) ::
  Wardrik.Scope.t()
```

Returns the scope `member` decides calls in.

  * An approver may decide what any of the owner's agents wait on.
  * Whoever `asked_by` names may decide what `conversation` waits on.
  * Anyone else gets `member_scope/2`, and may decide nothing.

# `logs`

```elixir
@spec logs(t(), String.t()) :: String.t()
```

Returns a pattern matching the logs of every conversation in `room`, for any agent.

# `member_scope`

```elixir
@spec member_scope(t(), WardrikChannel.Member.t()) :: Wardrik.Scope.t()
```

Returns `member`'s scope. They may read and message the owner's agents.

# `new`

```elixir
@spec new(WardrikChannel.Channel.t(), String.t()) :: {:ok, t()} | :error
```

Returns the channel in workspace `id`, or `:error` if it isn't added there.

# `offered`

```elixir
@spec offered(t()) :: [WardrikChannel.Offer.t()]
```

Returns the agents that may answer in the workspace's rooms, sorted by ID.

# `principal`

```elixir
@spec principal(t(), WardrikChannel.Member.t()) :: WardrikCore.Principal.t()
```

Returns who `member` is to Wardrik, as `slack:T0123/U024BE7LH`.

# `scope`

```elixir
@spec scope(t()) :: Wardrik.Scope.t()
```

Returns the channel's own scope. It may read the owner's agents.

# `thread`

```elixir
@spec thread(t(), String.t(), String.t()) :: String.t()
```

Returns the thread of `room` that `conversation` holds.

---

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