Kotlin: Invokes a Supabase Edge Function.

Invokes a Supabase Function. See the guide for details on writing Functions.

Examples

Basic invocation

supabase.functions.invoke("function_name")

Basic invocation with body

supabase.functions.invoke(
  function = "function_name",
  body = buildJsonObject \{
      put("foo", "bar")
  \},
  headers = Headers.build \{
      append(HttpHeaders.ContentType, "application/json")
  \}
)

Reuse function by saving it to a variable

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
\}