# `Immich.API.Client`

Generic HTTP client for Immich API requests.

# `api_error`

```elixir
@type api_error() ::
  {:authentication, term()}
  | {:authorization, term()}
  | {:transport, term()}
  | {:unexpected_response, non_neg_integer(), term()}
```

# `headers`

```elixir
@type headers() :: [{String.t(), String.t()}]
```

# `request_fun`

```elixir
@type request_fun() :: (keyword() -&gt; {:ok, Req.Response.t()} | {:error, term()})
```

# `t`

```elixir
@type t() :: module()
```

# `get`

```elixir
@spec get(String.t(), headers()) :: {:ok, map() | term()} | {:error, api_error()}
```

Sends a JSON `GET` request and returns the decoded JSON body for 2xx responses.

Non-2xx responses are mapped to typed API error tuples.

# `get`

```elixir
@spec get(String.t(), headers(), request_fun()) ::
  {:ok, map() | term()} | {:error, api_error()}
```

# `ndjson_stream`

```elixir
@spec ndjson_stream(String.t(), map(), headers()) ::
  {:ok, Enumerable.t(map())} | {:error, api_error()}
```

Sends a streaming JSON `POST` request and decodes the response as NDJSON.

Returns a lazy stream of decoded map events for 2xx responses.

# `ndjson_stream`

```elixir
@spec ndjson_stream(String.t(), map(), headers(), request_fun()) ::
  {:ok, Enumerable.t(map())} | {:error, api_error()}
```

# `post`

```elixir
@spec post(String.t(), map(), headers()) ::
  {:ok, map() | term()} | {:error, api_error()}
```

Sends a JSON `POST` request and returns the decoded JSON body for 2xx responses.

Non-2xx responses are mapped to typed API error tuples.

# `post`

```elixir
@spec post(String.t(), map(), headers(), request_fun()) ::
  {:ok, map() | term()} | {:error, api_error()}
```

---

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