Inttegro.Files.Media (inttegro v0.2.0)

Copy Markdown View Source

Represents Media data in the Files API.

Inttegro decodes API responses into this struct. Required fields are always present; optional fields are nil when they do not apply or were not returned. Follow the linked types in t/0 for nested domain values.

Uploads files, reads their metadata, and delivers their original bytes.

Inttegro stores file metadata separately from binary contents. Uploads move through processing and safety checks before becoming available. create/3 accepts bytes, lookup/3 returns metadata, and contents/3 returns a %Inttegro.Files.Download{} without exposing storage provider credentials or object keys.

Upload and download

upload = %Inttegro.Files.CreateRequest{
  file_name: "receipt.pdf",
  bytes: File.read!("receipt.pdf"),
  purpose: "order_document"
}

{:ok, file} = Inttegro.Files.create(client, upload,
  idempotency_key: "receipt-order-123"
)

request = Inttegro.Files.ContentsRequest.new!(file_id: file.id)
{:ok, download} = Inttegro.Files.contents(client, request)
File.write!("downloaded-receipt.pdf", download.bytes)

See the Files guide for lifecycle, delivery, and deletion behavior.

Summary

Types

t()

The decoded media value.

Functions

Builds a Inttegro.Files.Media and raises KeyError when a required field is missing.

Types

t()

@type t() :: %Inttegro.Files.Media{
  aspect_ratio: String.t() | nil,
  codec: String.t() | nil,
  color_space: String.t() | nil,
  duration_ms: integer() | nil,
  frame_count: integer() | nil,
  has_alpha: boolean() | nil,
  height: integer() | nil,
  kind: String.t() | nil,
  page_count: integer() | nil,
  width: integer() | nil
}

The decoded media value.

Functions

new!(attrs \\ %{})

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

Builds a Inttegro.Files.Media and raises KeyError when a required field is missing.