# `Chatto.Connect`
[🔗](https://github.com/xtian/elixir-chatto/blob/v0.1.0/lib/chatto/connect.ex#L1)

Unary [Connect protocol](https://connectrpc.com/docs/protocol) client for Chatto's API.

Service modules in `lib/chatto/generated` call `call/4` with a client from `new/3`:

    client = Chatto.Connect.new(server_url, token)
    Chatto.Discovery.V1.ServerDiscoveryService.get_server(client, %Chatto.Discovery.V1.GetServerRequest{})

# `call`

```elixir
@spec call(Req.Request.t(), String.t(), struct(), module()) ::
  {:ok, struct()} | {:error, Chatto.Connect.Error.t()}
```

# `new`

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

Builds a client for Chatto's Connect API authenticated with `token`.

`opts` are merged into the request as `Req` options. Pass `request:` to build on an existing
`Req.Request`, such as one with tracing steps attached.

---

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