mirror of
https://github.com/coder/coder.git
synced 2026-09-22 21:22:17 +08:00
Implement `GET /api/v2/templatebuilder/modules`, which returns the filtered list of modules available for a given base template. Reads from the bundled catalog via `LoadModules()` and applies OS-compatibility filtering based on the `base` query param. Computed variables (e.g. `agent_id`) are excluded from the API response at the `ToSDK()` conversion boundary since they are wired automatically by the builder. The `Computed` field is removed from the SDK type. Adds `CompatibleWithOS()` to `ModuleManifest` for OS filtering. Returns 400 for unknown base IDs and 404 when the template builder is disabled. Depends on #26116 > [!NOTE] > This PR was authored by Coder Agents on behalf of @jeremyruppel.
2.9 KiB
Generated
2.9 KiB
Generated
TemplateBuilder
List template builder base templates
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/templatebuilder/bases \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/v2/templatebuilder/bases
Example responses
200 Response
{
"bases": [
{
"description": "string",
"icon": "string",
"id": "string",
"name": "string",
"os": "string"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.TemplateBuilderBasesResponse |
To perform this operation, you must be authenticated. Learn more.
List template builder modules
Code samples
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/templatebuilder/modules \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
GET /api/v2/templatebuilder/modules
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
base |
query | string | false | Base template example ID for OS-compatibility filtering |
Example responses
200 Response
{
"modules": [
{
"category": "string",
"compatible_os": [
"string"
],
"conflicts_with": [
"string"
],
"description": "string",
"display_name": "string",
"icon": "string",
"id": "string",
"variables": [
{
"default": [
0
],
"description": "string",
"name": "string",
"required": true,
"sensitive": true,
"type": "string"
}
],
"version": "string"
}
]
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.TemplateBuilderModulesResponse |
To perform this operation, you must be authenticated. Learn more.