Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15103,6 +15103,13 @@ paths:
`suggested`, `leave` (nothing matched, so it is left to set up later) or `none` (nothing to set
up). `charity_id` picks which of your organisations is using it (default: the template's own if
it is yours, else your first).

Installing a Toolkit: pass `toolkit_id`. Any template in a Toolkit you can see can be used,
published or not. Steps that point at the Toolkit's own Surveys, Contact Forms and story Labels
then default to `toolkit` (`default_item_id: toolkit`, with the installed item's name under
`toolkit`): the copies installing the Toolkit added, shown as "Installed with this Toolkit". A
step whose item wasn't installed falls back to its hint as usual. A template that isn't in the
Toolkit, or a Toolkit you can't see, is a 404.
security: [{tokenAuth: []}]
parameters:
- name: id
Expand All @@ -15113,6 +15120,11 @@ paths:
in: query
required: false
schema: {type: integer}
- name: toolkit_id
in: query
required: false
description: Installing this Toolkit, which holds the template
schema: {type: integer}
responses:
"200":
description: The steps and their choices
Expand Down Expand Up @@ -15159,6 +15171,8 @@ paths:
`{step_id, leave: true}` to set it up later. Steps left out take their default. A step left for
later is never set to "Any": it shows as Needs setting up and doesn't tick off until someone
chooses what counts. Returns the new Checklist and the steps that still need setting up.
With `toolkit_id` (installing a Toolkit), `item_id: toolkit` sets a step up with the Toolkit's
installed item; see **Suggested mapping**.
security: [{tokenAuth: []}]
parameters:
- name: id
Expand All @@ -15173,6 +15187,7 @@ paths:
type: object
properties:
charity_id: {type: integer}
toolkit_id: {type: integer, description: Installing this Toolkit, which holds the template}
name: {type: string}
mapping:
type: array
Expand Down
8 changes: 5 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3675,14 +3675,16 @@ function buildDocsPage() {
])}
${endpointCard("GET", "/checklist_templates/{id}/mapping", "Suggested mapping for using a template", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "An ImpactStore template, or one of your own" },
{ name: "charity_id", type: "integer", required: false, desc: "Which of your organisations is using it" }
{ name: "charity_id", type: "integer", required: false, desc: "Which of your organisations is using it" },
{ name: "toolkit_id", type: "integer", required: false, desc: "Installing this Toolkit: steps pointing at its own Surveys, Contact Forms and story Labels default to <code>toolkit</code>, the copies the install added" }
], [
{ code: "200", cls: "response-2xx", desc: "Each step's <code>hint</code>, <code>options</code>, <code>suggested</code> match, <code>original</code> (your own template), <code>can_create</code> and <code>default</code> (<code>original</code>, <code>suggested</code>, <code>leave</code> or <code>none</code>)" },
{ code: "404", cls: "response-4xx", desc: "Another organisation's unpublished template" }
{ code: "200", cls: "response-2xx", desc: "Each step's <code>hint</code>, <code>options</code>, <code>suggested</code> match, <code>original</code> (your own template), <code>toolkit</code> (installing a Toolkit), <code>can_create</code> and <code>default</code> (<code>toolkit</code>, <code>original</code>, <code>suggested</code>, <code>leave</code> or <code>none</code>)" },
{ code: "404", cls: "response-4xx", desc: "Another organisation's unpublished template, or one that isn't in the Toolkit" }
])}
${endpointCard("POST", "/checklist_templates/{id}/use", "Use a template", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "The template's id" },
{ name: "charity_id", in: "body", type: "integer", required: false, desc: "Which of your organisations is using it" },
{ name: "toolkit_id", in: "body", type: "integer", required: false, desc: "Installing this Toolkit; <code>item_id: toolkit</code> then uses its installed item" },
{ name: "name", in: "body", type: "string", required: false, desc: "The new Checklist's name" },
{ name: "mapping", in: "body", type: "array", required: false, desc: "Per step: <code>{step_id, item_id}</code>, <code>{step_id, create}</code> or <code>{step_id, leave: true}</code>. Steps left out take their default" }
], [
Expand Down
Loading