# `Tayori.Reactions`
[🔗](https://github.com/hattoriai/tayori/blob/v0.1.0/lib/tayori/reactions.ex#L1)

Readers react to an entry with an emoji, one of the app's (`:reactions`
of `Tayori.Config`), and each reaction counts once per reader. The
`:reactions` feature.

A visitor (a reader with no id) cannot react: a reaction is a reader's,
so that a count is people, not clicks.

# `for_entries`

```elixir
@spec for_entries(Tayori.Reader.t(), [Ecto.UUID.t()]) :: {map(), map()}
```

The counts of each emoji of the entries, `%{entry_id => %{emoji => n}}`,
and the reader's own reactions, `%{entry_id => [emoji]}`.

# `toggle`

```elixir
@spec toggle(Tayori.Reader.t(), Ecto.UUID.t(), String.t()) ::
  {:ok, %{counts: map(), mine: [String.t()]}}
  | {:error, :visitor | :unknown_emoji | :disabled}
```

Turns a reaction of the reader on or off, and returns the entry's counts
and the reader's reactions. An emoji that is not one of the app's is
refused, and so is any reaction while the `:reactions` feature is off.

# `totals`

```elixir
@spec totals([Ecto.UUID.t()]) :: %{required(Ecto.UUID.t()) =&gt; non_neg_integer()}
```

The number of reactions of each entry, for the admin.

---

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