Functions

Plugin to interact with the supabase Edge Functions API

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

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

then you can use it like this:

val response = supabase.functions("myFunction")
//or store it in a variable
val function = supabase.functions.buildEdgeFunction("myFunction")
val response = function()

Constructors

Link copied to clipboard
constructor(config: Functions.Config, supabaseClient: SupabaseClient)

Types

Link copied to clipboard

The config for the Functions plugin

Properties

Link copied to clipboard
open override val apiVersion: Int
Link copied to clipboard
open override val config: Functions.Config
Link copied to clipboard
open override val pluginKey: String
Link copied to clipboard
open override val serializer: SupabaseSerializer
Link copied to clipboard
open override val supabaseClient: SupabaseClient

Functions

Link copied to clipboard
fun buildEdgeFunction(function: String, region: FunctionRegion = config.defaultRegion, headers: Headers = Headers.Empty): EdgeFunction

Builds an EdgeFunction which can be invoked multiple times

Link copied to clipboard
open suspend fun close()
Link copied to clipboard
open fun init()
Link copied to clipboard
inline suspend operator fun invoke(function: String, region: FunctionRegion = config.defaultRegion, headers: Headers = Headers.Empty): HttpResponse
inline suspend operator fun invoke(function: String, region: FunctionRegion = config.defaultRegion, crossinline builder: HttpRequestBuilder.() -> Unit): HttpResponse

Invokes a remote edge function. The authorization token is automatically added to the request.

inline suspend operator fun <T : Any> invoke(function: String, body: T, region: FunctionRegion = config.defaultRegion, headers: Headers = Headers.Empty): HttpResponse

Invokes a remote edge function. The authorization token is automatically added to the request. Note, if you want to serialize body to json, you need to add the HttpHeaders.ContentType header yourself.

Link copied to clipboard
open suspend override fun parseErrorResponse(response: HttpResponse): RestException
Link copied to clipboard
open fun resolveUrl(path: String): String