Object MethodCore Flow

Api.list(prefix?)

Returns a sorted, detached array of API names, optionally filtered by a name prefix.

Documented for app version 1.0.50Updated:

Detailed Explanation

This section explains when to use the API, how to call it, and which structures it works best with in production flow.

How To Call It

Api is a global table: call its functions with a dot (Api.<method>(...)), not a colon. Requires Macro Handler 1.0.51 or later.

When To Use It

Returns a sorted, detached array of API names, optionally filtered by a name prefix.

Parameters and Return

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.

Best Combined With

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.

Example Usage

The snippet below is a starter pattern that can be applied directly in runtime flow.

local names = Api.list("Form.")
for _, name in ipairs(names) do print(name) end

Copyable Progressive Examples

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.

Foundation

Shows the shortest direct way to call the API.

Foundation
local names = Api.list("Form.")
for _, name in ipairs(names) do print(name) end

Simple

Wraps the base call with minimal flow control.

Simple
local stepOk = true
local names = Api.list("Form.")
for _, name in ipairs(names) do print(name) end
if stepOk then
  wait(200)
end

Practical Flow

A practical pattern for real macros with pcall, logging, and guards.

Practical Flow
local ok, err = pcall(function()
  local names = Api.list("Form.")
  for _, name in ipairs(names) do print(name) end
end)

if not ok then
  print("API step failed: Api.list: " .. tostring(err))
  requestStop()
end

Detailed

This level packages the API into a reusable helper with error reporting.

Detailed
-- Api.list(prefix?)
local function run_list_step()
  local names = Api.list("Form.")
  for _, name in ipairs(names) do print(name) end
end

local ok, err = pcall(run_list_step)
if not ok then
  toast("Step failed")
  print(err)
end

Combined

Combines the API with related structures to form a more realistic workflow.

Combined
local names = Api.list("Form.")
for _, name in ipairs(names) do print(name) end