diff --git a/openapi.yaml b/openapi.yaml index 42ac6dc..de05610 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -9193,6 +9193,39 @@ paths: "422": $ref: '#/components/responses/UnprocessableEntity' + /impact_frameworks/{id}/copy: + post: + tags: [Library] + summary: Copy an Impact Framework + operationId: copyImpactFramework + description: | + Copies an Impact Framework (Template), as **Copy** on the Manage Impact Frameworks page does. + The copy is named `Copy of ` and keeps the original's stages, metrics (Activity and + Attendance trackers, Outcomes and the trackers placed on it), causes, description and colour, + but none of its projects: it is not added to any project. It is yours, private and unapproved, + in the original's organisation if you belong to it, otherwise among your own Impact Frameworks. + + You may copy your own Impact Frameworks, any of an organisation you belong to, the Theory of + Change of a project you edit, and approved ImpactStore frameworks. Any other id answers `404`. + security: [{tokenAuth: []}] + parameters: + - name: id + in: path + required: true + description: The id of the Impact Framework (Template) to copy + schema: + type: integer + example: 7174 + responses: + "201": + $ref: '#/components/responses/LibraryItemCreated' + "401": + $ref: '#/components/responses/Unauthorized' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' + /referral_submissions: post: tags: [Signup Pages] diff --git a/server.js b/server.js index 8e2f8c7..e6d0a11 100644 --- a/server.js +++ b/server.js @@ -2493,6 +2493,14 @@ function buildDocsPage() { { code: "409", cls: "response-4xx", desc: "Nothing created: duplicates lists items you can reuse instead of the new ones, each with its entry" }, { code: "422", cls: "response-4xx", desc: "Invalid input (e.g. an Outcome in an Activity stage); nothing is created and the error names the entry" } ], "An Impact Framework (Template). Reuse trackers and Outcomes by id, and define only what's missing.")} + ${endpointCard("POST", "/impact_frameworks/{id}/copy", "Copy an Impact Framework", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "The Impact Framework (Template) to copy: your own, one of an organisation you belong to, the Theory of Change of a project you edit, or an approved ImpactStore framework" } + ], [ + { code: "201", cls: "response-2xx", desc: "Created: data is the copy, named Copy of <name>, as Get a library item shows it, plus approved (always false)" }, + { code: "401", cls: "response-4xx", desc: "Missing or invalid token" }, + { code: "404", cls: "response-4xx", desc: "No Impact Framework with that id that you may copy" }, + { code: "422", cls: "response-4xx", desc: "The copy could not be saved; the error says why. Nothing is created" } + ], "The same as Copy on the Manage Impact Frameworks page: the stages and metrics are copied, the projects are not.")}