How To Call It
Api is a singleton global table: call its functions with a dot (Api.<method>(...)). Requires Macro Handler 1.0.51 or later.
Queries available API names and missing requirements for portable libraries.
Documented for app version 1.0.50Updated:
Api is a singleton global table: call its functions with a dot (Api.<method>(...)). Requires Macro Handler 1.0.51 or later.
Checks a library requirement list, returning ok and a deduplicated missing array.
required is a dense array of up to 2048 API names, each 1–192 characters. missing preserves first-seen order. An empty list is valid; empty names and sparse arrays are errors. API names are case-sensitive, for example Workflow.retry, Agent.run or click. Availability describes published catalog names that are not directly policy-blocked; it is not a permission, saved-asset, approved-plan, network or provider readiness check.
Check requirements at the start of a portable library and provide a clear error or supported fallback when a feature is missing. Catalog checks neither create permissions nor replace runtime error handling.
The snippet below is a starter pattern that can be applied directly in runtime flow.
local capabilities = Api.check({"Form.show", "Workflow.retry", "Module.use"})
if not capabilities.ok then
error("Missing: " .. table.concat(capabilities.missing, ", "))
end
print("Library APIs are available")From foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
local capabilities = Api.check({"Form.show", "Workflow.retry", "Module.use"})
if not capabilities.ok then
error("Missing: " .. table.concat(capabilities.missing, ", "))
end
print("Library APIs are available")local capabilities = Api.check({"Form.show", "Workflow.retry", "Module.use"})
if not capabilities.ok then
error("Missing: " .. table.concat(capabilities.missing, ", "))
end
print("Library APIs are available")
-- Continue with one focused method on the object.local capabilities = Api.check({"Form.show", "Workflow.retry", "Module.use"})
if not capabilities.ok then
error("Missing: " .. table.concat(capabilities.missing, ", "))
end
print("Library APIs are available")
local note = "Api overview loaded"
print(note)-- Api.check(required)
local function run_api_step()
local capabilities = Api.check({"Form.show", "Workflow.retry", "Module.use"})
if not capabilities.ok then
error("Missing: " .. table.concat(capabilities.missing, ", "))
end
print("Library APIs are available")
end
local ok, err = pcall(run_api_step)
if not ok then
toast("Step failed")
print(err)
endlocal capabilities = Api.check({"Form.show", "Workflow.retry", "Module.use"})
if not capabilities.ok then
error("Missing: " .. table.concat(capabilities.missing, ", "))
end
print("Library APIs are available")