Parses raw Anthropic SSE event maps into typed event structs.
Each event arriving over the stream is a JSON-decoded map with a "type"
key. parse/1 dispatches on that key and returns the corresponding struct
from the Anthropic.Event.* namespace, or :skip for events that carry
no useful data (e.g. ping).
Summary
Functions
Parses a raw SSE event map into a typed struct.
Types
@type parsed_event() :: Anthropic.Event.MessageStart.t() | Anthropic.Event.ContentBlockStart.t() | Anthropic.Event.ContentBlockDelta.t() | Anthropic.Event.ContentBlockStop.t() | Anthropic.Event.MessageDelta.t() | Anthropic.Event.MessageStop.t()
Functions
@spec parse(map()) :: parsed_event() | :skip
Parses a raw SSE event map into a typed struct.
Returns :skip for ping events and any unrecognised event types.