# `Kagi.Client`
[🔗](https://github.com/rubas/kagi_ex/blob/v0.1.0/lib/kagi/client.ex#L1)

Reusable configuration for Kagi requests.

A client stores the configured session token and request options. Building a
client performs no network I/O.

## Fields

  * `:session_token` - Kagi session token string.
  * `:req_options` - keyword list merged into each `Req` request.

# `t`

```elixir
@type t() :: %Kagi.Client{req_options: keyword(), session_token: String.t()}
```

A configured Kagi client.

# `new`

```elixir
@spec new() :: {:ok, t()} | {:error, Kagi.Error.t()}
```

Builds a `%Kagi.Client{}` from application config.

Reads `:session_token` and `:req_options` from `:kagi_ex` config. Returns
`{:error, %Kagi.Error{}}` when the token is missing or `:req_options` is not
a keyword list.

## Examples

    config :kagi_ex, session_token: "abc"
    {:ok, client} = Kagi.Client.new()
    {:error, %Kagi.Error{reason: :missing_session_token}} = Kagi.Client.new()

# `new!`

```elixir
@spec new!() :: t()
```

Builds a `%Kagi.Client{}` or raises `Kagi.Error`.

---

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