Skip to content

Commit

Permalink
API Plan Snapshots Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythicaeda committed Oct 31, 2023
1 parent 8b23e10 commit 0f35898
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
74 changes: 74 additions & 0 deletions docs/api/examples/planning/snapshots.mdx
Original file line number Diff line number Diff line change
@@ -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
}
}
```
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const sidebars = {
items: [
'api/examples/planning/collaboration',
'api/examples/planning/anchors',
'api/examples/planning/snapshots'
],
},
'api/examples/simulation',
Expand Down

0 comments on commit 0f35898

Please sign in to comment.