Managed S3-compatible object storage — buckets, objects, presigned URLs.
Object keys are URL-encoded before inclusion in path segments.
Mutating bucket operations send an Idempotency-Key header automatically.
Example
client = Miosa.client(System.fetch_env!("MIOSA_API_KEY"))
{:ok, bucket} = Miosa.Storage.create_bucket(client, %{name: "assets"})
{:ok, result} = Miosa.Storage.presign(client, bucket["id"], %{
key: "uploads/logo.png",
operation: "put",
expires_in_sec: 600
})
IO.puts(result["url"])
Summary
Functions
Create a storage bucket.
Delete a bucket by ID.
Delete an object from a bucket. The key is URL-encoded automatically.
Fetch a bucket by ID.
Download the raw bytes of an object.
List all storage buckets for the authenticated tenant.
List objects in a bucket.
Mint a presigned URL for direct browser upload or download.
Upload bytes to an object key in a bucket.
Functions
@spec create_bucket(Miosa.Client.t(), map()) :: Miosa.Client.result(map())
Create a storage bucket.
Required: :name. Optional: :region, :public, and any other attrs.
Pass :idempotency_key in attrs to supply your own idempotency key.
@spec delete_bucket(Miosa.Client.t(), String.t()) :: Miosa.Client.result(map())
Delete a bucket by ID.
@spec delete_object(Miosa.Client.t(), String.t(), String.t()) :: Miosa.Client.result(map())
Delete an object from a bucket. The key is URL-encoded automatically.
@spec get_bucket(Miosa.Client.t(), String.t()) :: Miosa.Client.result(map())
Fetch a bucket by ID.
@spec get_object(Miosa.Client.t(), String.t(), String.t()) :: Miosa.Client.result(binary())
Download the raw bytes of an object.
The key is URL-encoded before being placed in the path.
@spec list_buckets(Miosa.Client.t()) :: Miosa.Client.result(map())
List all storage buckets for the authenticated tenant.
@spec list_objects(Miosa.Client.t(), String.t(), keyword() | map()) :: Miosa.Client.result(map())
List objects in a bucket.
Options:
:prefix— Filter by key prefix.:limit— Max objects to return.:cursor— Pagination cursor.
@spec presign(Miosa.Client.t(), String.t(), map()) :: Miosa.Client.result(map())
Mint a presigned URL for direct browser upload or download.
Required attrs:
:key— Object key.
Optional attrs:
:operation—"get"(default) or"put".:expires_in_sec— Expiry in seconds. Defaults to300.:content_type— Required for"put"uploads.
@spec put_object(Miosa.Client.t(), String.t(), String.t(), binary(), keyword()) :: Miosa.Client.result(map())
Upload bytes to an object key in a bucket.
content_type defaults to "application/octet-stream".
The key is URL-encoded before being placed in the path.