# `PhoenixKit.Modules.Emails.BrevoClient`
[🔗](https://github.com/BeamLabEU/phoenix_kit_emails/blob/0.4.2/lib/phoenix_kit/modules/emails/brevo_client.ex#L1)

Thin wrapper around the Brevo transactional-email events API
(`GET /v3/smtp/statistics/events`).

Isolated from `BrevoPollingJob` so tests can stub the HTTP layer with
`Req.Test` instead of hitting the real network: pass
`req_options: [plug: {Req.Test, MyStubName}]`.

# `fetch_events`

```elixir
@spec fetch_events(String.t(), keyword(), keyword()) ::
  {:ok, [map()]} | {:error, term()}
```

Fetches one page of events for the given date window.

`params` is merged into the query string as-is — callers pass Brevo's
real query keys (`startDate`, `endDate`, `limit`, `offset`, `sort`, ...).

## Returns

- `{:ok, [event_map]}` — the `events` array from a 200 response (`[]`
  when the response has no `events` key, e.g. an empty page)
- `{:error, :invalid_credentials}` — 401
- `{:error, {:http_status, status}}` — any other non-200 status
- `{:error, reason}` — transport-level failure

---

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