Table of Contents

Class StorageBucketApi

Namespace
Supabase.Storage
Assembly
Supabase.Storage.dll
public class StorageBucketApi : IStorageBucketApi<Bucket>, IGettableHeaders
Inheritance
StorageBucketApi
Implements
IGettableHeaders
Derived
Inherited Members

Constructors

StorageBucketApi(string, ClientOptions?, Dictionary<string, string>?)

protected StorageBucketApi(string url, ClientOptions? options, Dictionary<string, string>? headers = null)

Parameters

url string
options ClientOptions
headers Dictionary<string, string>

StorageBucketApi(string, Dictionary<string, string>?)

protected StorageBucketApi(string url, Dictionary<string, string>? headers = null)

Parameters

url string
headers Dictionary<string, string>

Properties

GetHeaders

Function that can be set to return dynamic headers.

Headers specified in the constructor will ALWAYS take precendece over headers returned by this function.

public Func<Dictionary<string, string>>? GetHeaders { get; set; }

Property Value

Func<Dictionary<string, string>>

Headers

public Dictionary<string, string> Headers { get; set; }

Property Value

Dictionary<string, string>

Options

public ClientOptions Options { get; protected set; }

Property Value

ClientOptions

Url

protected string Url { get; set; }

Property Value

string

Methods

CreateBucket(string, BucketUpsertOptions?)

Creates a new Storage bucket

public Task<string> CreateBucket(string id, BucketUpsertOptions? options = null)

Parameters

id string
options BucketUpsertOptions

Returns

Task<string>

Bucket Id

DeleteBucket(string)

Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first EmptyBucket(string)

public Task<GenericResponse?> DeleteBucket(string id)

Parameters

id string

Returns

Task<GenericResponse>

EmptyBucket(string)

Removes all objects inside a single bucket.

public Task<GenericResponse?> EmptyBucket(string id)

Parameters

id string

Returns

Task<GenericResponse>

GetBucket(string)

Retrieves the details of an existing Storage bucket.

public Task<Bucket?> GetBucket(string id)

Parameters

id string

Returns

Task<Bucket>

ListBuckets()

Retrieves the details of all Storage buckets within an existing product.

public Task<List<Bucket>?> ListBuckets()

Returns

Task<List<Bucket>>

PurgeBucketCache(string, PurgeCacheOptions?, CancellationToken)

Purges the CDN cache for every object in a bucket. Requires a service-role key.

public Task<GenericResponse?> PurgeBucketCache(string id, PurgeCacheOptions? options = null, CancellationToken cancellationToken = default)

Parameters

id string

The bucket whose cached objects should be purged.

options PurgeCacheOptions

When Transformations is true, only the transformed variants are purged; otherwise every cached version is purged.

cancellationToken CancellationToken

Token used to cancel the request.

Returns

Task<GenericResponse>

The service acknowledgement of the purge.

Examples

await storage.PurgeBucketCache("avatars", new PurgeCacheOptions { Transformations = true });

UpdateBucket(string, BucketUpsertOptions?)

Updates a Storage bucket

public Task<Bucket?> UpdateBucket(string id, BucketUpsertOptions? options = null)

Parameters

id string
options BucketUpsertOptions

Returns

Task<Bucket>