Jido.Chat.ModalResponse (Jido Chat v1.0.0)

Copy Markdown View Source

Canonical modal lifecycle response used by submit and close handlers.

Summary

Functions

Builds a close response.

Builds a validation-error response.

Builds a modal response from serialized data.

Creates a canonical modal response.

Builds a push response with a new modal.

Returns the schema for modal responses.

Returns a plain adapter-facing response map.

Serializes the response into a plain map with a type marker.

Builds an update response with a replacement modal.

Types

t()

@type t() :: %Jido.Chat.ModalResponse{
  action: :close | :errors | :update | :push,
  errors: map(),
  metadata: map(),
  modal: nil | nil | any()
}

Functions

close(opts \\ [])

@spec close(keyword() | map()) :: t()

Builds a close response.

errors(errors, opts \\ [])

@spec errors(map(), keyword() | map()) :: t()

Builds a validation-error response.

from_map(map)

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

Builds a modal response from serialized data.

new(response)

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

Creates a canonical modal response.

push(modal, opts \\ [])

@spec push(Jido.Chat.Modal.t() | map(), keyword() | map()) :: t()

Builds a push response with a new modal.

schema()

Returns the schema for modal responses.

to_adapter_payload(response)

@spec to_adapter_payload(t()) :: map()

Returns a plain adapter-facing response map.

to_map(response)

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

Serializes the response into a plain map with a type marker.

update(modal, opts \\ [])

@spec update(Jido.Chat.Modal.t() | map(), keyword() | map()) :: t()

Builds an update response with a replacement modal.