~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
158 lines · 3.8 KB Raw History
{
  "lexicon": 1,
  "id": "com.atproto.space.applyWrites",
  "defs": {
    "main": {
      "type": "procedure",
      "description": "Apply a batch transaction of creates, updates, and deletes to a space repo. Requires auth, implemented by PDS.",
      "input": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": ["space", "repo", "writes"],
          "properties": {
            "space": {
              "type": "string",
              "format": "space-ref"
            },
            "repo": {
              "type": "string",
              "format": "did"
            },
            "validate": {
              "type": "boolean",
              "description": "Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons."
            },
            "writes": {
              "type": "array",
              "items": {
                "type": "union",
                "refs": ["#create", "#update", "#delete"],
                "closed": true
              }
            }
          }
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "properties": {
            "results": {
              "type": "array",
              "items": {
                "type": "union",
                "refs": ["#createResult", "#updateResult", "#deleteResult"],
                "closed": true
              }
            }
          }
        }
      },
      "errors": [
        {
          "name": "SpaceNotFound"
        },
        {
          "name": "RecordNotFound"
        },
        {
          "name": "RecordAlreadyExists"
        }
      ]
    },
    "create": {
      "type": "object",
      "description": "Operation which creates a new record.",
      "required": ["collection", "value"],
      "properties": {
        "collection": {
          "type": "string",
          "format": "nsid"
        },
        "rkey": {
          "type": "string",
          "format": "record-key"
        },
        "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",
          "format": "record-key"
        },
        "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",
          "format": "record-key"
        }
      }
    },
    "createResult": {
      "type": "object",
      "required": ["uri", "cid"],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri"
        },
        "cid": {
          "type": "string",
          "format": "cid"
        },
        "validationStatus": {
          "type": "string",
          "knownValues": ["valid", "unknown"]
        }
      }
    },
    "updateResult": {
      "type": "object",
      "required": ["uri", "cid"],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri"
        },
        "cid": {
          "type": "string",
          "format": "cid"
        },
        "validationStatus": {
          "type": "string",
          "knownValues": ["valid", "unknown"]
        }
      }
    },
    "deleteResult": {
      "type": "object",
      "required": [],
      "properties": {}
    }
  }
}