Jido.Chat.Attachment (Jido Chat v1.0.0)

Copy Markdown View Source

Normalized outbound attachment used by post payloads and sent-message handles.

Summary

Functions

Creates an attachment struct from normalized map input.

Normalizes supported outbound attachment inputs into a canonical attachment struct.

Normalizes a list of attachment inputs.

Returns the Zoi schema for Attachment.

Types

input()

t()

@type t() :: %Jido.Chat.Attachment{
  data: nil | nil | binary(),
  duration: nil | nil | integer(),
  filename: nil | nil | binary(),
  height: nil | nil | integer(),
  kind: :image | :audio | :video | :file,
  media_type: nil | nil | binary(),
  metadata: map(),
  path: nil | nil | binary(),
  size_bytes: nil | nil | integer(),
  url: nil | nil | binary(),
  width: nil | nil | integer()
}

Functions

new(attachment)

Creates an attachment struct from normalized map input.

normalize(attachment)

@spec normalize(input()) :: t()

Normalizes supported outbound attachment inputs into a canonical attachment struct.

normalize_many(attachments)

@spec normalize_many([input()]) :: [t()]

Normalizes a list of attachment inputs.

schema()

Returns the Zoi schema for Attachment.