A2aEngine.Types.Part (a2a_engine v0.1.0)

Copy Markdown View Source

Discriminated union of TextPart, FilePart, and DataPart.

Dispatches on the kind field when decoding; delegates to the variant's own to_map/1 when encoding. Use decode/1 for decoding arbitrary part maps, and encode/1 to encode any variant struct.

Summary

Functions

Decode a part map to the appropriate variant struct.

Decode a list of part maps; returns {:ok, [part]} or first {:error, _}.

Encode any part variant to wire format.

Types

Functions

decode(m)

@spec decode(map()) :: {:ok, t()} | {:error, term()}

Decode a part map to the appropriate variant struct.

decode_list(list)

@spec decode_list([map()]) :: {:ok, [t()]} | {:error, term()}

Decode a list of part maps; returns {:ok, [part]} or first {:error, _}.

encode(p)

@spec encode(t()) :: map()

Encode any part variant to wire format.