comAtprotoRepoApplyWrites top-level constant

Map<String, dynamic> const comAtprotoRepoApplyWrites

com.atproto.repo.applyWrites

Implementation

const comAtprotoRepoApplyWrites = <String, dynamic>{
  "lexicon": 1,
  "id": "com.atproto.repo.applyWrites",
  "defs": {
    "main": {
      "type": "procedure",
      "description":
          "Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.",
      "input": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": ["repo", "writes"],
          "properties": {
            "repo": {
              "type": "string",
              "format": "at-identifier",
              "description":
                  "The handle or DID of the repo (aka, current account)."
            },
            "validate": {
              "type": "boolean",
              "description":
                  "Can be set to 'false' to skip Lexicon schema validation of record data, for all operations.",
              "default": true
            },
            "writes": {
              "type": "array",
              "items": {
                "type": "union",
                "refs": ["#create", "#update", "#delete"],
                "closed": true
              }
            },
            "swapCommit": {
              "type": "string",
              "format": "cid",
              "description":
                  "If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations."
            }
          }
        }
      },
      "errors": [
        {
          "name": "InvalidSwap",
          "description":
              "Indicates that the 'swapCommit' parameter did not match current commit."
        }
      ]
    },
    "create": {
      "type": "object",
      "description": "Operation which creates a new record.",
      "required": ["collection", "value"],
      "properties": {
        "collection": {"type": "string", "format": "nsid"},
        "rkey": {"type": "string", "maxLength": 15},
        "value": {"type": "unknown"}
      }
    },
    "update": {
      "type": "object",
      "description": "Operation which updates an existing record.",
      "required": ["collection", "rkey", "value"],
      "properties": {
        "collection": {"type": "string", "format": "nsid"},
        "rkey": {"type": "string"},
        "value": {"type": "unknown"}
      }
    },
    "delete": {
      "type": "object",
      "description": "Operation which deletes an existing record.",
      "required": ["collection", "rkey"],
      "properties": {
        "collection": {"type": "string", "format": "nsid"},
        "rkey": {"type": "string"}
      }
    }
  }
};