Programs
A program is a course template in a tenant. slug is unique per tenant.
list_programs
Section titled “list_programs”List programs visible to you (RLS: tenant-scoped). Optionally filter by tenant.
Inputs:
| Arg | Type | Notes |
|---|---|---|
tenant_id? | uuid | Filter to a single tenant. |
limit? | int | Max rows (1–200, default 100). |
Result: { "programs": [ { "id", "tenant_id", "slug", "title_i18n", "created_at" }, … ] }
get_program
Section titled “get_program”Fetch one program with its full nested graph: units → lessons → activities,
ordered by ordinal. RLS-scoped.
Inputs:
| Arg | Type | Notes |
|---|---|---|
program_id | uuid | required |
Result:
{ "program": { "id": "…", "tenant_id": "…", "slug": "intro-kafka", "title_i18n": { "en": "Intro to Kafka" }, "created_at": "…", "units": [ { "id": "…", "ordinal": 0, "title_i18n": { "en": "Basics" }, "lessons": [ { "id": "…", "ordinal": 0, "title_i18n": { "en": "Topics & partitions" }, "activities": [ { "id": "…", "ordinal": 0, "kind": "concept", "spec": {…}, "rubric": {} } ] } ] } ] }}Returns an error if the program is not found or not visible to you.
create_program
Section titled “create_program”Create a new program (template) in a tenant. Author-role only (RLS enforces
author / instructor / tenant_admin / owner on the tenant). slug must be
unique within the tenant.
Inputs:
| Arg | Type | Notes |
|---|---|---|
tenant_id | uuid | Owning tenant (from list_tenants / whoami). |
slug | string | URL-safe, unique within the tenant. |
title_i18n? | string | map | i18n map or a bare string (→ { "en": … }). |
Result: { "success": true, "program": { "id", "tenant_id", "slug", "title_i18n", "created_at" } }
{ "tenant_id": "8f3c…", "slug": "intro-kafka", "title_i18n": { "en": "Intro to Kafka", "pt": "Introdução ao Kafka" } }update_program
Section titled “update_program”Update a program’s slug and/or title_i18n. Author-role only. Only provided
fields change; passing neither returns "Nothing to update.".
Inputs:
| Arg | Type | Notes |
|---|---|---|
program_id | uuid | required |
slug? | string | new unique slug |
title_i18n? | string | map |
Result: { "success": true, "program": {…} }
delete_program
Section titled “delete_program”Delete a program. Cascades to its units, lessons, and activities. Author-role only. Irreversible.
Inputs:
| Arg | Type | Notes |
|---|---|---|
program_id | uuid | required |
Result: { "success": true, "deleted": "<program_id>" }
instantiate_program
Section titled “instantiate_program”Deep-copy an existing program graph (units → lessons → activities) into a
new program in the same tenant under a new slug. Author-role only.
Returns the new program id.
Inputs:
| Arg | Type | Notes |
|---|---|---|
source_program_id | uuid | Program to copy from. |
new_slug | string | Slug for the new program (unique per tenant). |
new_title_i18n? | string | map | Defaults to the source program’s title. |
Result: { "success": true, "new_program_id": "<uuid>" }