MemoService · MemoService_SetMemoAttachments
破坏性替换:必须发送期望保留的完整附件集合。省略已有附件会删除其元数据,并执行存储文件清理,不是无损解除关联。空集合会移除全部附件。对于已有 APPLE_LIVE_PHOTO 配对,仅保留一个成员可能在更新通过正文引用校验后删除整组,包括你提交要保留的那个成员。应完整保留两者,或有意同时移除。请先保留备份;响应丢失后,重试前先核对当前状态。
访问权限
需要笔记作者或实例管理员。更新与分享管理还会检查适用的空间归属;空间成员资格本身不会赋予他人笔记的所有者权限。
替换会删除遗漏文件
先读取当前附件列表,再提交希望保留的完整集合。已有 name 用于标识附件,这不是文件上传。遗漏的附件会被删除并清理存储,而非仅解除关联。Markdown 中受管理图片的引用必须有保留的附件支撑。如需同时移除图片引用和文件,请在一次 UpdateMemo 中更新 content 与 attachments。在正文约束允许时,空 attachments 数组会移除整个集合。
成功响应
此操作没有资源对象需要返回。Rust REST 传输将 protobuf Empty 序列化为 HTTP 200 与 JSON {}。生成接口定义中的成功结构为空是有意行为,不表示遗漏了请求说明。
完整保留已有 Live Photo 配对
替换附件集合时,如果只提交已有 APPLE_LIVE_PHOTO 配对中的一个成员,会从请求集合中移除整组,包括提交的那个成员。若正文引用校验通过且更新继续,两者都将被删除。应保留两者的完整附件资源名,或有意同时移除。此行为不同于 DeleteAttachment 和 BatchDeleteAttachments,后两者会拒绝部分分组。写入响应丢失后,重试前先核对当前附件集合。
请求
SetMemoAttachments replaces the full set of attachments on a memo with the provided list (not an append). Pass the complete desired set; an empty list clears all attachments. Idempotent.
/api/v1/memos/{memo}/attachments参数
| 名称 / 位置 | 类型 / 是否必需 | 描述 |
|---|---|---|
memopath | string 必需 | The memo id. |
请求体
必需
application/json · SetMemoAttachmentsRequest
响应
200 · OK
default · Default error response
application/json · Status
完整操作定义
下方保留全部已声明约束、媒体类型和响应细节。结构引用链接到完整定义。
展开 JSON 定义
{
"tags": [
"MemoService"
],
"description": "SetMemoAttachments replaces the full set of attachments on a memo with the\n provided list (not an append). Pass the complete desired set; an empty list\n clears all attachments. Idempotent.",
"operationId": "MemoService_SetMemoAttachments",
"parameters": [
{
"name": "memo",
"in": "path",
"description": "The memo id.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SetMemoAttachmentsRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {}
},
"default": {
"description": "Default error response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
}
}
}