# `OffBroadway.Splunk.SplunkClient`
[🔗](https://github.com/Intility/off_broadway_splunk/blob/v3.0.1/lib/off_broadway/splunk/splunk_client.ex#L1)

Default Splunk client used by `OffBroadway.Splunk.Producer` to receive data from
Splunk.
This module implements the `OffBroadway.Splunk.Client` and `Broadway.Acknowledger`
behaviours which define callbacks for receiving and acknowledging messages.
Since Splunk does not have any concept of acknowledging consumed messages, we need
to keep track of what messages that are consumed ourselves (more on that later).

The default Splunk client uses the Splunk Web API for receiving messages and is
implemented using the [Tesla](https://hexdocs.pm/tesla/readme.html) library. Tesla
is a HTTP client abstraction library which let's us easily select from a range of
HTTP adapters. Please see the Tesla [documentation](https://hexdocs.pm/tesla/readme.html#adapters)
for more information.

# `client`

```elixir
@spec client(opts :: Keyword.t()) :: Tesla.Client.t()
```

Returns a `Tesla.Client` configured with middleware.

  * `Tesla.Middleware.BaseUrl` middleware configured with `base_url` passed via `opts`.
  * `Tesla.Middleware.BearerAuth` middleware configured with `api_token` passed via `opts`.
  * `Tesla.Middleware.Query` middleware configured with `query` passed via `opts`.
  * `Tesla.Middleware.JSON` middleware configured with `Jason` engine.

---

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