127 lines
3.8 KiB
JSON
127 lines
3.8 KiB
JSON
|
{
|
||
|
"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 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
|
||
|
}
|
||
|
},
|
||
|
"swapCommit": {
|
||
|
"type": "string",
|
||
|
"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.",
|
||
|
"format": "cid"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
"output": {
|
||
|
"encoding": "application/json",
|
||
|
"schema": {
|
||
|
"type": "object",
|
||
|
"required": [],
|
||
|
"properties": {
|
||
|
"commit": {
|
||
|
"type": "ref",
|
||
|
"ref": "com.atproto.repo.defs#commitMeta"
|
||
|
},
|
||
|
"results": {
|
||
|
"type": "array",
|
||
|
"items": {
|
||
|
"type": "union",
|
||
|
"refs": ["#createResult", "#updateResult", "#deleteResult"],
|
||
|
"closed": true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
"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" }
|
||
|
}
|
||
|
},
|
||
|
"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": {}
|
||
|
}
|
||
|
}
|
||
|
}
|