Invokes a Supabase Function. See the guide for details on writing Functions.
The name of the function to invoke.
The body to send with the request. T can be any serializable type.
The region where the function is invoked. Defaults to `Functions.Config#defaultRegion`.
The headers to send with the request.
val response = supabase.functions.invoke("function_name")
// Decode the response body to a serializable class
val data = response.body<FunctionResponse>()
supabase.functions.invoke(
function = "function_name",
body = buildJsonObject \{
put("foo", "bar")
\},
headers = Headers.build \{
append(HttpHeaders.ContentType, "application/json")
\}
)
val function = supabase.functions.buildEdgeFunction(
function = "function",
headers = Headers.build \{
/*Default headers*/
//when you are sending a body you may want to add this header:
append(HttpHeaders.ContentType, "application/json")
\}
)
//invoke it:
function()
//invoke it with a body:
function(body)
//invoke it with custom request options:
function(body) \{
header("Header", "Value")
parameter("Key", "Value") //url parameter
\}