文档API 参考

Rust · 0.1.0

Attachment

文件元数据;content 仅用于上传,普通读取返回元数据。

创建与引用已有附件

CreateAttachment 接受 Base64 content。分块上传把元数据放在 spec.attachment,把字节放在 data。已有附件出现在笔记目标附件集合中时,通过 name 标识;共用结构中的 filename/type 要求不表示需要重新上传字节。UpdateAttachment 只修改 filename,mediaMetadata 在创建后不可变。

此结构在哪里使用

以下链接根据协议快照中的直接引用生成。认证、可写字段和运行行为应以调用操作为准;可复用资源结构本身并不是完整的写入请求。

被以下组件结构引用:

结构与字段

object

字段类型 / 是否必需描述
namestringThe name of the attachment. Format: attachments/{attachment}
createTimestring (date-time)Output only. The creation timestamp.
filenamestring
必需
The filename of the attachment.
contentstring (bytes)Input only. The content of the attachment.
externalLinkstringOptional. The external link of the attachment.
typestring
必需
The MIME type of the attachment.
sizestringOutput only. The size of the attachment in bytes.
memostringOptional. The related memo. Refer to `Memo.name`. Format: memos/{memo}
motionMediaallOf
MotionMedia
Optional. Motion media metadata.
mediaMetadataallOf
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."
    }
  }
}