Jido.Chat.EventEnvelope (Jido Chat v1.0.0)

Copy Markdown View Source

Canonical normalized event envelope used by webhook and gateway ingestion.

Summary

Functions

Builds event envelope from serialized data.

Creates a canonical event envelope.

Returns the Zoi schema for EventEnvelope.

Serializes event envelope into a plain map with type marker.

Types

event_type()

@type event_type() ::
  :message
  | :reaction
  | :action
  | :modal_submit
  | :modal_close
  | :slash_command
  | :assistant_thread_started
  | :assistant_context_changed

t()

@type t() :: %Jido.Chat.EventEnvelope{
  adapter_name: nil | nil | atom(),
  channel_id: nil | nil | binary(),
  event_type:
    :message
    | :reaction
    | :action
    | :modal_submit
    | :modal_close
    | :slash_command
    | :assistant_thread_started
    | :assistant_context_changed,
  id: binary(),
  message_id: nil | nil | binary(),
  metadata: map(),
  payload: nil | nil | any(),
  raw: map(),
  thread_id: nil | nil | binary()
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Builds event envelope from serialized data.

new(attrs)

@spec new(map()) :: t()

Creates a canonical event envelope.

schema()

Returns the Zoi schema for EventEnvelope.

to_map(envelope)

@spec to_map(t()) :: map()

Serializes event envelope into a plain map with type marker.