Supabase.Functions (supabase_functions v0.1.0)

This module provides integration with the Supabase Edge Functions API, enabling developers to invoke their serverless functions.

Usage

iex> client = Supabase.init_client!("SUPABASE_URL", "SUPABASE_KEY")
iex> Supabase.Functions.invoke(client, "function_name", %{})

Summary

Types

Available options for invoking a function

Types

on_response()

opt()

@type opt() ::
  {:body, Supabase.Fetcher.body()}
  | {:headers, Supabase.Fetcher.headers()}
  | {:method, Supabase.Fetcher.method()}
  | {:region, region()}
  | {:on_response, on_response()}

Available options for invoking a function:

  • body: The body of the request.
  • headers: The additional custom headers of the request.
  • method: The HTTP method of the request.
  • region: The Region to invoke the function in.
  • on_response: The custom response handler for response streaming.

opts()

@type opts() :: Enumerable.t(opt())

region()

@type region() ::
  :any
  | :"us-west-1"
  | :"us-west-2"
  | :"us-east-1"
  | :"eu-west-1"
  | :"eu-west-2"
  | :"eu-west-3"
  | :"ap-south-1"
  | :"ap-southeast-1"
  | :"ap-southeast-2"
  | :"ap-northeast-1"
  | :"ap-northeast-2"
  | :"sa-east-1"
  | :"ca-central-1"
  | :"eu-central-1"

Functions

invoke(client, name, opts \\ [])

Invokes a function

Invoke a Supabase Edge Function.

  • When you pass in a body to your function, we automatically attach the Content-Type header automatically. If it doesn't match any of these types we assume the payload is json, serialize it and attach the Content-Type header as application/json. You can override this behavior by passing in a Content-Type header of your own.
  • Responses are automatically parsed as json depending on the Content-Type header sent by your function. Responses are parsed as text by default.