Components / Developer tools
API explorer
The endpoints of an API grouped by tag, each opening to show its parameters.
Functions: cui_api_explorer

Usage
static const cui_api_param user_params[] = { { "id", "path", "string", true, "The user's id" } };
static const cui_api_endpoint endpoints[] = {
{ "GET", "/users", "List users", "Users" },
{ "GET", "/users/{id}", "Get a user", "Users", false, user_params, 1 },
};
cui_api_explorer_result r = cui_api_explorer(ui, "api", endpoints, 2);
if (r.try_it >= 0) open_request(&endpoints[r.try_it]);
Endpoints grouped by tag, in the order the tags first appear; a tag's header folds its group. Each endpoint shows its method in its color (GET blue, POST green, PUT amber, PATCH teal, DELETE red), its path with the {parameters} marked, and its summary. A deprecated endpoint is struck through and badged. A click opens an endpoint's parameters (name, required mark, type, where it goes, description) and a Try it button. A field filters by path or summary. Up and Down move, and Enter or Space opens. With height the list scrolls and keeps the selection in view.
Keyboard
- Up and Down move, and Enter or Space opens.
Options of cui_api_explorer
| Option | Type | Default | Description |
|---|---|---|---|
.width | cui_size | Width: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own. | |
.height | float | Height in points; 0 uses the component's own. | |
.selected | int * | the selected endpoint or -1, kept by you; NULL keeps it in the component |
cui_api_endpoint
| Field | Type | Description |
|---|---|---|
method | const char * | "GET" |
path | const char * | "/users/{id}" |
summary | const char * | one line after the path; the filter field searches it |
tag | const char * | groups the list; NULL groups as "Other" |
deprecated | bool | struck through and muted, with a "Deprecated" badge |
params | const cui_api_param * | the parameters listed when the endpoint is opened; may be NULL |
param_count | int | number of params |
cui_api_param
| Field | Type | Description |
|---|---|---|
name | const char * | the parameter's name, in the code font |
in | const char * | where it goes: "path", "query", "header" or "body" |
type | const char * | e.g. "string"; shown before where it goes |
required | bool | a red asterisk after the name |
description | const char * | what the parameter is for, shown after its type and place; may be NULL |
cui_api_explorer_result
| Field | Type | Description |
|---|---|---|
selected | int | the selected endpoint, or -1 |
try_it | int | endpoint, or -1 |
Related
- Feature flags: Flags against environments, edited in place.
- Blame: Source with who last changed each line.
- Coverage: Test coverage as a tree built from the files' paths.
- Time histogram: Event counts over time, stacked by series, as above a log search, with a legend that shows each series' total.