Skip to content

Docs

save_snippet

Create or edit a snippet: short reusable text (a closing line, a disclaimer, a hashtag set) people insert into drafts from the editor. Without `snippetId` it creates one (`name` and `body` required); with it, it changes the `name` or `body` you send, and drafts that already use the text keep theirs. Names are unique in the workspace (`name_taken`).

Create or edit a snippet: short reusable text (a closing line, a disclaimer, a hashtag set) people insert into drafts from the editor. Without snippetId it creates one (name and body required); with it, it changes the name or body you send, and drafts that already use the text keep theirs. Names are unique in the workspace (name_taken).

Access and cost

  • Kind: mutation
  • Scope: workspace
  • Actors: member, agent
  • Credits: Free
  • Requires confirmation: false
  • Accepts idempotency key: false

Input schema

{
  "properties": {
    "workspaceId": {
      "format": "uuid",
      "type": "string"
    },
    "snippetId": {
      "format": "uuid",
      "type": "string"
    },
    "name": {
      "maxLength": 80,
      "minLength": 1,
      "type": "string"
    },
    "body": {
      "type": "string"
    }
  },
  "required": [
    "workspaceId"
  ],
  "type": "object"
}

Output schema

{
  "additionalProperties": false,
  "properties": {
    "snippet": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "format": "uuid",
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "body": {
          "type": "string"
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "updatedAt": {
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "body",
        "createdAt",
        "updatedAt"
      ],
      "type": "object"
    },
    "created": {
      "type": "boolean"
    }
  },
  "required": [
    "snippet",
    "created"
  ],
  "type": "object"
}

Errors

[
  "name_taken",
  "limit_reached"
]

Annotations

{
  "destructiveHint": false,
  "idempotentHint": false,
  "openWorldHint": false,
  "readOnlyHint": false,
  "title": "Save a snippet"
}