创建与引用已有附件
CreateAttachment 接受 Base64 content。分块上传把元数据放在 spec.attachment,把字节放在 data。已有附件出现在笔记目标附件集合中时,通过 name 标识;共用结构中的 filename/type 要求不表示需要重新上传字节。UpdateAttachment 只修改 filename,mediaMetadata 在创建后不可变。
此结构在哪里使用
以下链接根据协议快照中的直接引用生成。认证、可写字段和运行行为应以调用操作为准;可复用资源结构本身并不是完整的写入请求。
- POSTCreate Attachment
/api/v1/attachments - GETGet Attachment
/api/v1/attachments/{attachment} - PATCHUpdate Attachment
/api/v1/attachments/{attachment}
被以下组件结构引用:
结构与字段
object
| 字段 | 类型 / 是否必需 | 描述 |
|---|---|---|
name | string | The name of the attachment. Format: attachments/{attachment} |
createTime | string (date-time) | Output only. The creation timestamp. |
filename | string 必需 | The filename of the attachment. |
content | string (bytes) | Input only. The content of the attachment. |
externalLink | string | Optional. The external link of the attachment. |
type | string 必需 | The MIME type of the attachment. |
size | string | Output only. The size of the attachment in bytes. |
memo | string | Optional. The related memo. Refer to `Memo.name`. Format: memos/{memo} |
motionMedia | allOf MotionMedia | Optional. Motion media metadata. |
mediaMetadata | allOf MediaMetadata | Optional. Immutable normalized media metadata explicitly supplied by the client at creation time. |
完整结构
约束与嵌套结构请以这份完整 JSON 定义为准。字段出现在这里,并不意味着每位调用者都能修改它。
{
"required": [
"filename",
"type"
],
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the attachment.\n Format: attachments/{attachment}"
},
"createTime": {
"readOnly": true,
"type": "string",
"description": "Output only. The creation timestamp.",
"format": "date-time"
},
"filename": {
"type": "string",
"description": "The filename of the attachment."
},
"content": {
"writeOnly": true,
"type": "string",
"description": "Input only. The content of the attachment.",
"format": "bytes"
},
"externalLink": {
"type": "string",
"description": "Optional. The external link of the attachment."
},
"type": {
"type": "string",
"description": "The MIME type of the attachment."
},
"size": {
"readOnly": true,
"type": "string",
"description": "Output only. The size of the attachment in bytes."
},
"memo": {
"type": "string",
"description": "Optional. The related memo. Refer to `Memo.name`.\n Format: memos/{memo}"
},
"motionMedia": {
"allOf": [
{
"$ref": "#/components/schemas/MotionMedia"
}
],
"description": "Optional. Motion media metadata."
},
"mediaMetadata": {
"allOf": [
{
"$ref": "#/components/schemas/MediaMetadata"
}
],
"description": "Optional. Immutable normalized media metadata explicitly supplied by the client at creation time."
}
}
}