# `Spectre.Awaitable`
[🔗](https://github.com/elchemista/spectre/blob/0.3.0/lib/spectre/types/awaitable.ex#L1)

Runtime state waiting for user input.

Awaitables are deliberately small. They identify what kind of input is
needed and, when applicable, which effect they are gating.

# `status`

```elixir
@type status() :: :open | :accepted | :rejected | :cancelled | :expired
```

# `t`

```elixir
@type t() :: %Spectre.Awaitable{
  attempts: non_neg_integer(),
  id: term(),
  kind: atom(),
  label: atom() | nil,
  max_attempts: pos_integer() | nil,
  metadata: map(),
  name: term(),
  run_id: String.t() | nil,
  status: status(),
  subject_id: term()
}
```

# `accept`

```elixir
@spec accept(t(), atom()) :: t()
```

Marks an awaitable as accepted with the matched policy label.

# `cancel`

```elixir
@spec cancel(t()) :: t()
```

Marks an awaitable as cancelled.

# `expire`

```elixir
@spec expire(t()) :: t()
```

Marks an awaitable as expired.

# `increment`

```elixir
@spec increment(t()) :: t()
```

Increments the retry attempt counter.

# `open_policy`

```elixir
@spec open_policy(term(), Spectre.Effect.t() | term(), keyword()) :: t()
```

Opens a policy awaitable for an effect.

# `reject`

```elixir
@spec reject(t(), atom()) :: t()
```

Marks an awaitable as rejected with the matched policy label.

---

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