# `OctaStar.Signals`

Datastar signal reading and `datastar-patch-signals` helpers.

# `format_patch`

```elixir
@spec format_patch(
  map(),
  keyword()
) :: String.t()
```

Formats a signal patch without writing to a connection.

# `format_patch_raw`

```elixir
@spec format_patch_raw(
  String.t(),
  keyword()
) :: String.t()
```

Formats a raw JSON signal patch without writing to a connection.

# `format_remove`

```elixir
@spec format_remove(
  String.t() | [String.t()],
  keyword()
) :: String.t()
```

Formats a signal removal without writing to a connection.

# `patch`

```elixir
@spec patch(Plug.Conn.t(), map(), keyword()) :: Plug.Conn.t()
```

Sends a signal patch from a map.

# `patch_raw`

```elixir
@spec patch_raw(Plug.Conn.t(), String.t(), keyword()) :: Plug.Conn.t()
```

Sends a signal patch from a JSON string.

# `read`

```elixir
@spec read(Plug.Conn.t()) :: {:ok, map()} | {:error, term()}
```

Reads Datastar signals from a Plug connection.

`GET` and `DELETE` requests read the `datastar` query parameter. Other
methods read JSON from the request body unless a parser has already populated
`conn.body_params`.

# `read!`

```elixir
@spec read!(Plug.Conn.t()) :: map()
```

Reads Datastar signals and raises on errors.

# `remove_signals`

```elixir
@spec remove_signals(Plug.Conn.t(), String.t() | [String.t()], keyword()) ::
  Plug.Conn.t()
```

Removes one or more signals by setting dot-notated paths to `null`.

---

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