# `PhoenixGenApi.Structs.StreamHelper`
[🔗](https://github.com/ohhi-vn/phoenix_gen_api/blob/main/lib/phoenix_gen_api/structs/stream_helper.ex#L1)

Helper struct and functions for sending streaming data to a `StreamCall` process.

A `%StreamHelper{}` holds the PID of the stream process and the request ID.
Use the provided functions to send data chunks, completion signals, and errors
to the stream process, which forwards them to the client as `{:stream_response, response}`
messages.

## Usage

    stream = %StreamHelper{stream_pid: pid, request_id: "req_123"}
    StreamHelper.send_result(stream, chunk_data)       # intermediate chunk
    StreamHelper.send_last_result(stream, final_data)   # final chunk
    StreamHelper.send_complete(stream)                   # normal completion
    StreamHelper.send_error(stream, reason)              # error

# `t`

```elixir
@type t() :: %PhoenixGenApi.Structs.StreamHelper{
  request_id: String.t(),
  stream_pid: pid()
}
```

Stream helper struct.

# `send_complete`

Wrap complete & send to stream.

# `send_error`

Wrap error & send to stream.

# `send_last_result`

Wrap last result & send to stream.

# `send_result`

Wrap result & send to stream.

---

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