Supabase.Storage.BucketHandler (supabase_storage v0.1.0)
Provides low-level API functions for managing Supabase Storage buckets.
The BucketHandler
module offers a collection of functions that directly interact with the Supabase Storage API for managing buckets. This module works closely with the Supabase.Fetcher
for sending HTTP requests and the Supabase.Storage.Cache
for caching bucket information.
Features
- Bucket Listing: Fetch a list of all the buckets available in the storage.
- Bucket Retrieval: Retrieve detailed information about a specific bucket.
- Bucket Creation: Create a new bucket with specified attributes.
- Bucket Update: Modify the attributes of an existing bucket.
- Bucket Emptying: Empty the contents of a bucket without deleting the bucket itself.
- Bucket Deletion: Permanently remove a bucket and its contents.
Caution
This module provides a low-level interface to Supabase Storage buckets and is designed for internal use by the Supabase.Storage
module. Direct use is discouraged unless you need to perform custom or unsupported actions that are not available through the higher-level API. Incorrect use can lead to unexpected results or data loss.
Implementation Details
All functions within the module expect a base URL, API key, and access token as their initial arguments, followed by any additional arguments required for the specific operation. Responses are usually in the form of {:ok, result}
or {:error, message}
tuples.
Summary
Types
bucket_id()
@type bucket_id() :: String.t()
bucket_name()
@type bucket_name() :: String.t()
create_attrs()
update_attrs()
Functions
create(base_url, api_key, token, attrs)
@spec create( Supabase.Connection.base_url(), Supabase.Connection.api_key(), Supabase.Connection.access_token(), create_attrs() ) :: {:ok, Supabase.Storage.Bucket.t()} | {:error, String.t()}
delete(base_url, api_key, token, id)
@spec delete( Supabase.Connection.base_url(), Supabase.Connection.api_key(), Supabase.Connection.access_token(), bucket_id() ) :: {:ok, String.t()} | {:error, String.t()}
empty(base_url, api_key, token, id)
@spec empty( Supabase.Connection.base_url(), Supabase.Connection.api_key(), Supabase.Connection.access_token(), bucket_id() ) :: {:ok, :successfully_emptied} | {:error, String.t()}
list(base_url, api_key, token)
@spec list( Supabase.Connection.base_url(), Supabase.Connection.api_key(), Supabase.Connection.access_token() ) :: {:ok, [Supabase.Storage.Bucket.t()]} | {:error, String.t()}
retrieve_info(base_url, api_key, token, bucket_id)
@spec retrieve_info( Supabase.Connection.base_url(), Supabase.Connection.api_key(), Supabase.Connection.access_token(), bucket_id() ) :: {:ok, Supabase.Storage.Bucket.t()} | {:error, String.t()}
update(base_url, api_key, token, id, attrs)
@spec update( Supabase.Connection.base_url(), Supabase.Connection.api_key(), Supabase.Connection.access_token(), bucket_id(), update_attrs() ) :: {:ok, Supabase.Storage.Bucket.t()} | {:error, String.t()}