Jido.Chat.FileUpload (Jido Chat v1.0.0)

Copy Markdown View Source

Canonical outbound file upload request used by posting and upload helpers.

Summary

Functions

Builds a file upload from serialized map data.

Creates a file upload request from normalized map input.

Normalizes supported upload inputs into a canonical file upload struct.

Normalizes a list of file upload inputs.

Returns the Zoi schema for FileUpload.

Serializes a file upload into a plain map with type marker.

Types

input()

@type input() :: t() | Jido.Chat.Attachment.input()

t()

@type t() :: %Jido.Chat.FileUpload{
  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

from_map(map)

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

Builds a file upload from serialized map data.

new(file_upload)

Creates a file upload request from normalized map input.

normalize(file_upload)

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

Normalizes supported upload inputs into a canonical file upload struct.

normalize_many(files)

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

Normalizes a list of file upload inputs.

schema()

Returns the Zoi schema for FileUpload.

to_map(file_upload)

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

Serializes a file upload into a plain map with type marker.