Functions: serverless JavaScript deployed by Kapso, invoked over the API or from workflows.
Summary
Functions
Creates a draft function (not deployed yet).
Creates a secret, exposed to the function as an environment variable.
Deletes a function, its deployment and its secrets.
Deletes a secret.
Deploys a function in the background (usually 10-60 seconds). Poll get/2 for the status.
Gets a function with its code, deployment status and URLs.
Invokes a deployed function with payload as the request body. Returns
the function's response (JSON decoded when it is JSON).
Lists the project's functions.
Lists recent invocations with captured console logs. Params: status, limit.
Lists secret names (never values).
Updates a function (partial). Attributes: name, slug, description,
code, invoke_response_mode, runtime_config, public_endpoint, and
lock_version for optimistic locking.
Types
@type result() :: {:ok, term()} | {:error, KapsoEx.Error.t()}
Functions
@spec create(KapsoEx.Client.t(), map() | keyword()) :: result()
Creates a draft function (not deployed yet).
Attributes: name, code and function_type ("cloudflare_worker" or
"supabase_function") are required; also slug, description,
public_endpoint, runtime_config.
Creates a secret, exposed to the function as an environment variable.
@spec delete(KapsoEx.Client.t(), String.t()) :: result()
Deletes a function, its deployment and its secrets.
@spec delete_secret(KapsoEx.Client.t(), String.t(), String.t()) :: result()
Deletes a secret.
@spec deploy(KapsoEx.Client.t(), String.t()) :: result()
Deploys a function in the background (usually 10-60 seconds). Poll get/2 for the status.
@spec get(KapsoEx.Client.t(), String.t()) :: result()
Gets a function with its code, deployment status and URLs.
@spec invoke(KapsoEx.Client.t(), String.t(), map() | list()) :: result()
Invokes a deployed function with payload as the request body. Returns
the function's response (JSON decoded when it is JSON).
@spec list(KapsoEx.Client.t()) :: result()
Lists the project's functions.
@spec list_invocations(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Lists recent invocations with captured console logs. Params: status, limit.
@spec list_secrets(KapsoEx.Client.t(), String.t()) :: result()
Lists secret names (never values).
@spec update(KapsoEx.Client.t(), String.t(), map() | keyword()) :: result()
Updates a function (partial). Attributes: name, slug, description,
code, invoke_response_mode, runtime_config, public_endpoint, and
lock_version for optimistic locking.