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
205 changes: 205 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ tags:
description: The gift icon's Wishlist - your feature requests and feedback, and what Makerble is building next (Coming soon)
- name: Saved Filters
description: Saved Filters for Contacts, Events and Cases, and adding one to a project's toolbar as a shortcut
- name: Toolkits
description: Toolkits (Collections) are ready-made sets of Surveys, Contact Forms, Impact Frameworks, metrics and tips on Explore Toolkits
- name: Albums
description: Albums (Bundles; being renamed Portfolios on screen) group Projects so their results can be seen together
- name: Age Bands
Expand Down Expand Up @@ -2542,6 +2544,134 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'

/toolkits:
get:
tags: [Toolkits]
summary: List Toolkits
description: |
The Toolkits on Explore Toolkits: ready-made sets of Surveys, Contact Forms, Impact Frameworks,
metrics and tips an organisation can add to its Projects in one go (Collections in the
database). A user with Marketing or Admin system access also sees listed Toolkits still
awaiting approval, as Site Overview › Manage Toolkits shows them.
operationId: listToolkits
security: [{tokenAuth: []}]
parameters:
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PerPage'
- $ref: '#/components/parameters/LastSyncDatetime'
responses:
"200":
description: Paginated list of Toolkits
content:
application/json:
schema:
$ref: '#/components/schemas/ToolkitList'
"401":
$ref: '#/components/responses/Unauthorized'

/toolkits/{id}:
get:
tags: [Toolkits]
summary: Get a Toolkit
description: |
One Toolkit, if the user can see its page: a Toolkit on Explore Toolkits, or one the user can
edit. Any other returns 404.
operationId: getToolkit
security: [{tokenAuth: []}]
parameters:
- $ref: '#/components/parameters/ResourceId'
responses:
"200":
description: The Toolkit
content:
application/json:
schema:
$ref: '#/components/schemas/Toolkit'
"401":
$ref: '#/components/responses/Unauthorized'
"404":
$ref: '#/components/responses/NotFound'

patch:
tags: [Toolkits]
summary: Update a Toolkit's number and image settings
description: |
Sets the Toolkit number and whether the thumbnail (on Explore Toolkits) and the cover image (on
the Toolkit's page) are darkened, as the Create/Edit Collection page does. Only the fields sent
change. The user must be able to edit the Toolkit: its owner, an editor of its Organisation, or
a user with Marketing or Admin system access.
operationId: updateToolkit
security: [{tokenAuth: []}]
parameters:
- $ref: '#/components/parameters/ResourceId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ToolkitUpdateRequest'
example:
toolkit_number: "T14"
darken_cover_image: true
responses:
"200":
description: The Toolkit
content:
application/json:
schema:
$ref: '#/components/schemas/Toolkit'
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntity'

/toolkits/{id}/image:
patch:
tags: [Toolkits]
summary: Replace a Toolkit's thumbnail or cover image
description: |
Uploads a new thumbnail (`kind: thumbnail`, shown on Explore Toolkits) or cover image
(`kind: cover`, shown on the Toolkit's page), as Replace does on Site Overview › Manage
Toolkits. Send it as `multipart/form-data`. The image must be a JPEG or PNG. Needs Marketing or
Admin system access.
operationId: replaceToolkitImage
security: [{tokenAuth: []}]
parameters:
- $ref: '#/components/parameters/ResourceId'
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [kind, image]
properties:
kind:
type: string
enum: [thumbnail, cover]
image:
type: string
format: binary
responses:
"200":
description: The Toolkit, with its new image
content:
application/json:
schema:
$ref: '#/components/schemas/Toolkit'
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntity'

/albums:
get:
tags: [Albums]
Expand Down Expand Up @@ -20922,6 +21052,81 @@ components:
type: string
example: "Enrolled"

Toolkit:
type: object
description: A Toolkit (Collection in the database) on Explore Toolkits.
properties:
id:
type: integer
name:
type: string
slug:
type: string
nullable: true
toolkit_number:
type: string
nullable: true
description: The Toolkit's number, e.g. "T14", shown on Site Overview › Manage Toolkits
strapline:
type: string
nullable: true
description:
type: string
nullable: true
approved:
type: boolean
description: Whether Makerble has approved the Toolkit for Explore Toolkits
thumbnail_image_url:
type: string
nullable: true
description: The image on the Toolkit's Explore Toolkits card; when null, the card uses the cover image
cover_image_url:
type: string
nullable: true
description: The image at the top of the Toolkit's page
darken_thumbnail_image:
type: boolean
description: Whether a dark translucent layer covers the thumbnail on Explore Toolkits
darken_cover_image:
type: boolean
description: Whether a dark translucent layer covers the cover image on the Toolkit's page
url:
type: string
description: The Toolkit's page in Makerble
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time

ToolkitList:
type: object
properties:
page:
type: integer
page_size:
type: integer
page_count:
type: integer
total_count:
type: integer
data:
type: array
items:
$ref: '#/components/schemas/Toolkit'

ToolkitUpdateRequest:
type: object
properties:
toolkit_number:
type: string
nullable: true
darken_thumbnail_image:
type: boolean
darken_cover_image:
type: boolean

Album:
type: object
description: An Album (Bundle; Portfolio on screen) groups Projects so their results can be seen together.
Expand Down
50 changes: 50 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ function buildDocsPage() {
<a href="#projects" class="nav-link"><span class="nav-method method-GET">GET</span>Projects</a>
<a href="#saved-filters" class="nav-link"><span class="nav-method method-POST">POST</span>Saved Filters</a>
<a href="#albums" class="nav-link"><span class="nav-method method-GET">GET</span>Albums (Portfolios)</a>
<a href="#toolkits" class="nav-link"><span class="nav-method method-GET">GET</span>Toolkits</a>
<a href="#progress-boards" class="nav-link"><span class="nav-method method-POST">POST</span>Progress Boards</a>
<a href="#signup-pages" class="nav-link"><span class="nav-method method-POST">POST</span>Signup Pages</a>
<a href="#users" class="nav-link"><span class="nav-method method-POST">POST</span>Users</a>
Expand Down Expand Up @@ -1410,6 +1411,55 @@ function buildDocsPage() {
</div>
</section>

<!-- Toolkits -->
<section class="section" id="toolkits">
<div class="section-eyebrow">Core resource</div>
<h2 class="section-title">Toolkits</h2>
<div class="section-desc">
<p>A Toolkit is a ready-made set of Surveys, Contact Forms, Impact Frameworks, metrics and tips on <strong>Explore Toolkits</strong> that an Organisation can add to its Projects in one go. The database calls them Collections; the API uses <code>toolkits</code>. Each has a <strong>Toolkit number</strong> (e.g. <code>T14</code>), a thumbnail for its Explore Toolkits card, a cover image for its page, and a setting for each image that lays a dark translucent layer over it.</p>
</div>
<div class="endpoint-list">
${endpointCard("GET", "/toolkits", "List Toolkits", true, [
{ name: "page", type: "integer", required: false, desc: "Page number (default 1)" },
{ name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" },
{ name: "last_synced_datetime", type: "string", required: false, desc: "ISO 8601 — return only Toolkits updated after this" }
], [
{ code: "200", cls: "response-2xx", desc: "Paginated list of Toolkits" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" }
], "The Toolkits on Explore Toolkits. With Marketing or Admin system access you also see listed Toolkits awaiting approval, as Site Overview › Manage Toolkits shows them.")}
${endpointCard("GET", "/toolkits/{id}", "Get a Toolkit", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Toolkit ID" }
], [
{ code: "200", cls: "response-2xx", desc: "The Toolkit: <code>toolkit_number</code>, <code>thumbnail_image_url</code>, <code>cover_image_url</code>, <code>darken_thumbnail_image</code>, <code>darken_cover_image</code> and its page <code>url</code>" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "404", cls: "response-4xx", desc: "Not found, or a Toolkit you can't see" }
])}
${endpointCard("PATCH", "/toolkits/{id}", "Change a Toolkit's number and image darkening", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Toolkit ID" },
{ name: "toolkit_number", type: "string", required: false, desc: "The Toolkit's number, e.g. <code>T14</code>; <code>null</code> clears it" },
{ name: "darken_thumbnail_image", type: "boolean", required: false, desc: "Darken the thumbnail on Explore Toolkits" },
{ name: "darken_cover_image", type: "boolean", required: false, desc: "Darken the cover image on the Toolkit's page" }
], [
{ code: "200", cls: "response-2xx", desc: "The Toolkit" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "You can see the Toolkit but not edit it" },
{ code: "404", cls: "response-4xx", desc: "Not found, or a Toolkit you can't see" },
{ code: "422", cls: "response-4xx", desc: "<code>{errors: [...]}</code>" }
], "As the <b>Create/Edit Collection</b> page does. Only the fields sent change. You must be able to edit the Toolkit: its owner, an editor of its Organisation, or a user with Marketing or Admin system access.")}
${endpointCard("PATCH", "/toolkits/{id}/image", "Replace a Toolkit's thumbnail or cover image", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Toolkit ID" },
{ name: "kind", type: "string", required: true, desc: "<code>thumbnail</code> (Explore Toolkits card) or <code>cover</code> (top of the Toolkit's page)" },
{ name: "image", type: "file", required: true, desc: "A JPEG or PNG, sent as <code>multipart/form-data</code>" }
], [
{ code: "200", cls: "response-2xx", desc: "The Toolkit, with its new image URL" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "Needs Marketing or Admin system access" },
{ code: "404", cls: "response-4xx", desc: "Not found, or a Toolkit you can't see" },
{ code: "422", cls: "response-4xx", desc: "<code>{errors: [...]}</code>, e.g. an unknown <code>kind</code> or a file that isn't an image" }
], "As <b>Replace</b> does on Site Overview › Manage Toolkits.")}
</div>
</section>

<!-- Albums -->
<section class="section" id="albums">
<div class="section-eyebrow">Core resource</div>
Expand Down
Loading