diff --git a/openapi.yaml b/openapi.yaml index ed96eb2..bbe3953 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -15035,6 +15035,11 @@ paths: approval, and is a 422 naming the steps (`missing_hint_step_ids`) while any that needs a hint has none. `share: organisation` stops sharing it; Checklists already made from it don't change. Only Organisation Admins can (403 otherwise). + + In a Toolkit, `toolkit_id` with `toolkit_items` points survey, form and story label steps at + the Toolkit's own Surveys, Contact Forms and story Labels, as Edit Toolkit items does on the + Toolkit's page. You must be able to edit the Toolkit (403), and it must hold this template (404). + An item that isn't one of the Toolkit's is a 422. security: [{tokenAuth: []}] parameters: - name: id @@ -15054,6 +15059,17 @@ paths: journey_part: {type: string, enum: [referral, enrolment, safeguarding, exit_and_alumni]} hints: {type: object, additionalProperties: {type: string}} share: {type: string, enum: [organisation, impact_store]} + toolkit_id: + type: integer + description: A Toolkit holding this template, that you can edit, for toolkit_items + toolkit_items: + type: object + additionalProperties: {type: string} + description: | + The template's step ids mapped to one of the Toolkit's own items: `StoryCategory:` + (a Survey), `BeneficiaryCategory:` (a Contact Form) or `Label:` (a story Label), + or "" for the hint alone. Installing the Toolkit sets those steps up with no mapping. + Each step's `toolkit_item_kind` says which kind it can take (null for none). example: hints: "88": a baseline wellbeing survey diff --git a/server.js b/server.js index 31a4c76..baf0311 100644 --- a/server.js +++ b/server.js @@ -3642,7 +3642,7 @@ function buildDocsPage() { ${endpointCard("GET", "/checklist_templates/{id}", "Get one of My Checklist Templates", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "The template's id" } ], [ - { code: "200", cls: "response-2xx", desc: "The template with its stages and steps, each with its hint and needs_hint" }, + { code: "200", cls: "response-2xx", desc: "The template with its stages and steps, each with its hint, needs_hint, toolkit_item_kind and toolkit_item ({type, id, name} or null)" }, { code: "404", cls: "response-4xx", desc: "Not one of your organisations' templates" } ])} ${endpointCard("POST", "/checklist_templates", "Save a Checklist as a template", true, [ @@ -3661,11 +3661,14 @@ function buildDocsPage() { ${endpointCard("PATCH", "/checklist_templates/{id}", "Change, publish or stop sharing a template", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "The template's id" }, { name: "hints", in: "body", type: "object", required: false, desc: "The template's step ids → hint" }, - { name: "share", in: "body", type: "string", required: false, desc: "impact_store publishes it for Makerble's approval; organisation stops sharing it" } + { name: "share", in: "body", type: "string", required: false, desc: "impact_store publishes it for Makerble's approval; organisation stops sharing it" }, + { name: "toolkit_id", in: "body", type: "integer", required: false, desc: "A Toolkit holding this template, that you can edit, for toolkit_items" }, + { name: "toolkit_items", in: "body", type: "object", required: false, desc: "The template's step ids → one of the Toolkit's own items, as StoryCategory:12 (Survey), BeneficiaryCategory:5 (Contact Form) or Label:7 (story Label), or \"\" for the hint alone. Installing the Toolkit sets those steps up with no mapping" } ], [ { code: "200", cls: "response-2xx", desc: "The changed template" }, - { code: "403", cls: "response-4xx", desc: "Not an Organisation Admin" }, - { code: "422", cls: "response-4xx", desc: "A step that needs a hint has none: missing_hint_step_ids" } + { code: "403", cls: "response-4xx", desc: "Not an Organisation Admin, or you can't edit the Toolkit" }, + { code: "404", cls: "response-4xx", desc: "Not one of your templates, or the Toolkit doesn't hold it" }, + { code: "422", cls: "response-4xx", desc: "A step that needs a hint has none: missing_hint_step_ids; or a step's Toolkit item isn't one of the Toolkit's" } ])} ${endpointCard("DELETE", "/checklist_templates/{id}", "Delete a template", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "The template's id" }