Supabase.Storage.Bucket (supabase_storage v0.1.0)

Represents a Bucket on Supabase Storage.

This module defines the structure and operations related to a storage bucket on Supabase.

Structure

A Bucket consists of:

  • id: The unique identifier for the bucket.
  • name: The display name of the bucket.
  • owner: The owner of the bucket.
  • file_size_limit: The maximum file size allowed in the bucket (in bytes). Can be nil for no limit.
  • allowed_mime_types: List of MIME types permitted in this bucket. Can be nil for no restrictions.
  • created_at: Timestamp indicating when the bucket was created.
  • updated_at: Timestamp indicating the last update to the bucket.
  • public: Boolean flag determining if the bucket is publicly accessible or not.

Functions

Examples

Parsing a bucket

bucket_attrs = %{
  id: "bucket_id",
  name: "My Bucket",
  ...
}
Supabase.Storage.Bucket.parse!(bucket_attrs)

Creating a bucket changeset

new_bucket_attrs = %{
  id: "new_bucket_id",
  ...
}
Supabase.Storage.Bucket.create_changeset(new_bucket_attrs)

Updating a bucket

existing_bucket = %Supabase.Storage.Bucket{
  id: "existing_bucket_id",
  ...
}
updated_attrs = %{
  public: true
}
Supabase.Storage.Bucket.update_changeset(existing_bucket, updated_attrs)

Summary

Types

@type t() :: %Supabase.Storage.Bucket{
  allowed_mime_types: [String.t()] | nil,
  created_at: NaiveDateTime.t(),
  file_size_limit: integer() | nil,
  id: String.t(),
  name: String.t(),
  owner: String.t(),
  public: boolean(),
  updated_at: NaiveDateTime.t()
}

Functions

Link to this function

create_changeset(attrs)

@spec create_changeset(map()) :: {:ok, map()} | {:error, Ecto.Changeset.t()}
@spec parse!(map()) :: t()
Link to this function

update_changeset(bucket, attrs)

@spec update_changeset(t(), map()) :: {:ok, map()} | {:error, Ecto.Changeset.t()}