Storage

Plugin for interacting with the supabase storage api

To use it you need to install it to the SupabaseClient:

val supabase = createSupabaseClient(supabaseUrl, supabaseKey) {
install(Storage)
}

then you have to interact with the storage api:

val bucket = supabase.storage.from("icons")
val bytes = bucket.downloadAuthenticated("icon.png")

Types

Link copied to clipboard
Link copied to clipboard
data class Config(var transferTimeout: Duration = 120.seconds, resumable: Storage.Config.Resumable = Resumable(), var serializer: SupabaseSerializer? = null) : MainConfig, CustomSerializationConfig

Config for the storage plugin

Properties

Link copied to clipboard
abstract val apiVersion: Int
Link copied to clipboard
abstract val config: Storage.Config
Link copied to clipboard
abstract val pluginKey: String
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open suspend fun close()
Link copied to clipboard
abstract suspend fun createBucket(id: String, builder: BucketBuilder.() -> Unit = {})

Creates a new bucket in the storage

Link copied to clipboard
abstract suspend fun deleteBucket(bucketId: String)

Deletes a bucket by its bucketId

Link copied to clipboard
abstract suspend fun emptyBucket(bucketId: String)

Empties a bucket by its bucketId

Link copied to clipboard
open fun from(bucketId: String): BucketApi

Builder function for interacting with a bucket with the given bucketId

Link copied to clipboard
abstract operator fun get(bucketId: String): BucketApi

Builder function for interacting with a bucket with the given bucketId

Link copied to clipboard
open fun init()
Link copied to clipboard
abstract suspend fun parseErrorResponse(response: HttpResponse): RestException
Link copied to clipboard
open fun resolveUrl(path: String): String
Link copied to clipboard
abstract suspend fun retrieveBucketById(bucketId: String): Bucket?

Retrieves a bucket by its bucketId

Link copied to clipboard
abstract suspend fun retrieveBuckets(): List<Bucket>

Returns all buckets in the storage

Link copied to clipboard
abstract suspend fun updateBucket(id: String, builder: BucketBuilder.() -> Unit = {})

Updates a bucket in the storage