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

Who reads the news, as the app knows them. The app's resolver builds it
from the app's own user (`c:Tayori.Resolver.resolve_reader/1`):

    %Tayori.Reader{
      id: "user:#{user.id}",
      segments: ["plan:#{user.plan}", "role:#{user.role}"],
      locale: user.locale,
      since: user.inserted_at
    }

  * `:id` - a stable key of the reader, where Tayori keeps when they
    last saw the news. Nil for a visitor: the news shows, nothing is
    unread.
  * `:segments` - what the reader is, in the words of the app. An entry
    for segments shows to readers in at least one of them.
  * `:locale` - the language to show the news in, when the entry has it.
  * `:since` - entries published before this time are never unread, so
    that a new account does not start with all the news of the past.

# `t`

```elixir
@type t() :: %Tayori.Reader{
  id: String.t() | nil,
  locale: String.t() | nil,
  segments: [String.t()],
  since: DateTime.t() | nil
}
```

# `visitor`

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

A visitor: no id, no segments. They see the entries for everyone.

## Examples

    iex> Tayori.Reader.visitor("pt-PT")
    %Tayori.Reader{id: nil, segments: [], locale: "pt-PT", since: nil}

---

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