From 0f3589880f1796f3d71f3b47907d3630c57341cd Mon Sep 17 00:00:00 2001 From: Theresa Kamerman Date: Wed, 25 Oct 2023 11:47:18 -0700 Subject: [PATCH] API Plan Snapshots Docs --- docs/api/examples/planning/snapshots.mdx | 74 ++++++++++++++++++++++++ sidebars.js | 1 + 2 files changed, 75 insertions(+) create mode 100644 docs/api/examples/planning/snapshots.mdx diff --git a/docs/api/examples/planning/snapshots.mdx b/docs/api/examples/planning/snapshots.mdx new file mode 100644 index 0000000..c99bcfe --- /dev/null +++ b/docs/api/examples/planning/snapshots.mdx @@ -0,0 +1,74 @@ +# Snapshots + +A snapshot of a plan is a named record of the state of all activities in a plan at a certain time. +Snapshots are useful for recording and returning to known "good" states of a plan. + +## Taking a Snapshot + +```graphql +mutation createSnapshot($planId: Int!, $snapshotName: String!, $description: String) { + create_snapshot(args: { + _plan_id: $planId, + _snapshot_name: $snapshotName, + _description: $description + }) { + snapshot_id + } +} +``` + +Below is an example set of query variables for this function. Note that `description` is optional and may be excluded. + +```json +{ + "planId": 1, + "snapshotName": "Snapshot of My Plan", + "description": "Optional description for this snapshot" +} +``` + +## Tagging a Snapshot + +[Tags](../../tags) can be applied to snapshots. + +### Adding a Tag + +```graphql +mutation AddPlanSnapshotTag($snapshotId:Int!, $tagId: Int!){ + insert_plan_snapshot_tags_one(object: {snapshot_id: $snapshotId, tag_id: $tagId}) { + plan_snapshot { + snapshot_name + description + } + tag { + name + color + owner + } + } +} +``` + +### Removing a Tag + +```graphql +mutation RemovePlanSnapshotTag($snapshotId: Int!, $tagId: Int!) { + delete_plan_snapshot_tags_by_pk(snapshot_id: $snapshotId, tag_id: $tagId) { + plan_snapshot { + snapshot_name + description + } + tag { name } + } +} +``` + +## Restoring a Snapshot + +```graphql +mutation restoreSnapshot($planId: Int!, $snapshotId: Int!) { + restore_from_snapshot(args: {_plan_id: $planId, _snapshot_id: $snapshotId}) { + snapshot_id + } +} +``` diff --git a/sidebars.js b/sidebars.js index 4ed0bd9..507be6c 100644 --- a/sidebars.js +++ b/sidebars.js @@ -22,6 +22,7 @@ const sidebars = { items: [ 'api/examples/planning/collaboration', 'api/examples/planning/anchors', + 'api/examples/planning/snapshots' ], }, 'api/examples/simulation',