# `WardrikChannel.Replies.State`

The state of one room's replies.

Saved between restarts:

  * the cursor past what's posted
  * for each conversation, the run under way, the messages it answers and who asked
  * the arguments of each conversation's calls

Not saved: the channel, the follower, and when each thread's last status was shown.

# `post`

```elixir
@type post() ::
  {:reply, String.t(), [String.t()]}
  | {:status, String.t()}
  | {:waiting, [String.t()], String.t() | nil}
  | {:failed, String.t()}
  | {:stopped, [String.t()]}
  | {:said, String.t()}
  | :none
```

What an event asks to post in its thread. `:none` posts nothing. The rest match
`t:WardrikChannel.Outbound.body/0`, except `{:waiting, interrupt_ids, asked_by}`.

# `run`

```elixir
@type run() :: %{id: String.t(), answering: [String.t()], asked_by: String.t() | nil}
```

# `t`

```elixir
@type t() :: %WardrikChannel.Replies.State{
  calls: %{required(String.t()) =&gt; %{required(String.t()) =&gt; term()}},
  channel: WardrikChannel.Channel.t() | nil,
  cursor: String.t() | nil,
  follower: pid() | nil,
  room: String.t(),
  runs: %{required(String.t()) =&gt; run()},
  senders: %{required(String.t()) =&gt; String.t()},
  shown: %{required(String.t()) =&gt; integer()},
  workspace: String.t()
}
```

# `arguments`

```elixir
@spec arguments(t(), String.t(), String.t() | nil) :: term()
```

Returns the arguments of call `id` in `conversation`, or `nil` if unknown.

# `asked_by`

```elixir
@spec asked_by(t(), String.t()) :: String.t() | nil
```

Returns who asked for the run under way in `conversation`, or `nil` if unknown.

# `dump`

```elixir
@spec dump(t()) :: map()
```

Returns the part of `state` saved between restarts.

# `load`

```elixir
@spec load(map()) :: t()
```

Restores the state from `dump/1`'s result.

# `new`

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

Returns the state of a room no one has posted in yet.

# `take`

```elixir
@spec take(t(), String.t(), Wardrik.Event.t()) :: {post(), t()}
```

Returns what `event` of `conversation` asks to post, and the updated state.

---

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