# `Layr8.REST`
[🔗](https://github.com/layr8/elixir_sdk/blob/main/lib/layr8/rest.ex#L1)

Internal HTTP client for the Layr8 cloud-node REST API.

Uses `Req` for HTTP requests. Authentication is via `x-api-key` header.

Not intended for direct use; accessed through `Layr8.Credentials` and
`Layr8.Presentations`.

# `t`

```elixir
@type t() :: %Layr8.REST{api_key: String.t(), base_url: String.t()}
```

# `get`

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

Issues a GET request to `path` and returns the decoded response.

Returns `{:ok, map()}` on success or `{:error, term()}` on failure.

# `new`

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

Creates a new REST client.

## Parameters

- `base_url` — HTTP base URL of the cloud-node (e.g. `"https://node.example.com"`)
- `api_key` — API key for authentication

# `post`

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

Issues a JSON POST request to `path` with `body` and returns the decoded response.

Returns `{:ok, map()}` on success or `{:error, term()}` on failure.

---

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