Edge functions — serverless, request-driven code that runs close to the user.
Functions support full CRUD and can be invoked synchronously.
Mutating calls send an Idempotency-Key header automatically.
Example
client = Miosa.client(System.fetch_env!("MIOSA_API_KEY"))
{:ok, fn_} = Miosa.Functions.create(client, %{
name: "resize-image",
runtime: "node18",
source: "export default (req) => new Response('ok')"
})
{:ok, result} = Miosa.Functions.invoke(client, fn_["id"], %{
payload: %{url: "https://example.com/logo.png"}
})
Summary
Functions
Create a function.
Delete a function by ID.
Fetch a function by ID.
Invoke a function synchronously.
List functions for the authenticated tenant.
Update a function.
Functions
@spec create(Miosa.Client.t(), map()) :: Miosa.Client.result(map())
Create a function.
Required: :name. Optional: :runtime, :source, :env, :metadata,
:idempotency_key.
@spec delete(Miosa.Client.t(), String.t()) :: Miosa.Client.result(map())
Delete a function by ID.
@spec get(Miosa.Client.t(), String.t()) :: Miosa.Client.result(map())
Fetch a function by ID.
@spec invoke(Miosa.Client.t(), String.t(), keyword() | map()) :: Miosa.Client.result(map())
Invoke a function synchronously.
Optional opts:
:payload— Map to send as the request body.:idempotency_key— Idempotency key for the invocation.
@spec list(Miosa.Client.t(), keyword() | map()) :: Miosa.Client.result(map())
List functions for the authenticated tenant.
Accepts optional filters as a keyword list or map (e.g. :limit, :cursor).
@spec update(Miosa.Client.t(), String.t(), map()) :: Miosa.Client.result(map())
Update a function.
Pass any fields to update; nil values are dropped.