Jido.Chat.WebhookResponse (Jido Chat v1.0.0)

Copy Markdown View Source

Typed webhook response envelope.

Summary

Functions

Returns a default accepted response.

Returns an error response envelope.

Builds webhook response from serialized data.

Creates a typed webhook response envelope.

Returns the Zoi schema for WebhookResponse.

Serializes webhook response into plain map with type marker.

Types

t()

@type t() :: %Jido.Chat.WebhookResponse{
  body: nil | nil | any(),
  headers: map(),
  metadata: map(),
  status: integer()
}

Functions

accepted(body \\ nil)

@spec accepted(map() | nil) :: t()

Returns a default accepted response.

error(status, body \\ nil)

@spec error(integer(), map() | String.t() | nil) :: t()

Returns an error response envelope.

from_map(map)

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

Builds webhook response from serialized data.

new(attrs)

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

Creates a typed webhook response envelope.

schema()

Returns the Zoi schema for WebhookResponse.

to_map(response)

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

Serializes webhook response into plain map with type marker.