File attachment content block for messages.
Represents a generic file attachment (documents, audio, video, etc.).
Fields
url- URL to the file (optional if data is provided)data- Base64-encoded file data (optional if url is provided)media_type- MIME type (e.g., "application/pdf", "audio/mp3")filename- Original filenamesize- File size in bytes (optional)
Examples
File.new("https://example.com/doc.pdf", "document.pdf")
File.new("https://example.com/doc.pdf", "document.pdf", media_type: "application/pdf")
Summary
Functions
Creates a new file content block from base64-encoded data.
Creates a new file content block from a URL.
Returns the Zoi schema for File content
Types
Functions
Creates a new file content block from base64-encoded data.
Parameters
data- Base64-encoded file datafilename- Original filenamemedia_type- MIME typeopts- Additional options (size)
Creates a new file content block from a URL.
Options
:media_type- MIME type of the file:size- File size in bytes
Returns the Zoi schema for File content