文档API 参考

Rust · 0.1.0

Memo

读写共用的笔记资源,可写字段取决于具体操作。

不要回传整个响应

CreateMemo 与 UpdateMemo 直接接收此对象。creator、tags、reactions、property、parent 与 snippet 由服务端生成。虽然共用结构把 state 与 visibility 列为必需,updateMask=content 的 PATCH 只需提供 content。更新选中 attachments 或 relations 时采用集合替换语义。把响应复制成请求前先阅读操作运行时说明。

创建并非写入完整资源

CreateMemo 与 CreateMemoComment 忽略 state 和 pinned,创建的是 NORMAL 且未置顶的记录。需要时应随后通过 UpdateMemo 修改。这份共享必需字段及属性列表描述协议资源,实际采用哪些输入由调用操作决定。

此结构在哪里使用

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

被以下组件结构引用:

结构与字段

object

字段类型 / 是否必需描述
namestringThe resource name of the memo. Format: memos/{memo}, where memo is the user-defined UID.
statestring (enum)
STATE_UNSPECIFIED · NORMAL · ARCHIVED
必需
The state of the memo.
creatorstringThe name of the creator. Format: users/{user}
createTimestring (date-time)The creation timestamp. If not set on creation, the server will set it to the current time.
updateTimestring (date-time)The last update timestamp. If not set on creation, the server will set it to the current time.
contentstring
必需
Required. The content of the memo in Markdown format.
visibilitystring (enum)
VISIBILITY_UNSPECIFIED · PRIVATE · PROTECTED · PUBLIC · SPACE
必需
The visibility of the memo. One of PRIVATE (creator only), PROTECTED (signed-in users), PUBLIC (anonymous-eligible), or SPACE (active space members). Defaults to PRIVATE on creation when unspecified.
tagsarray<string>Output only. The tags extracted from the content.
pinnedbooleanWhether the memo is pinned.
attachmentsarray<Attachment>Optional. The attachments of the memo.
relationsarray<MemoRelation>Optional. The relations of the memo.
reactionsarray<Reaction>Output only. The reactions to the memo.
propertyallOf
Memo_Property
Output only. The computed properties of the memo.
parentstringOutput only. The context memo of this COMMENT relation, if any. Its identity is returned even when the caller cannot read the parent. Fetch the parent independently; this field does not grant read access. Format: memos/{memo}
snippetstringOutput only. The snippet of the memo content. Plain text only.
locationallOf
Location
Optional. The location of the memo.
spacestringOptional. The space in which this memo is placed. Format: spaces/{space}. Every memo, including a comment, owns its placement independently.

完整结构

约束与嵌套结构请以这份完整 JSON 定义为准。字段出现在这里,并不意味着每位调用者都能修改它。

{
  "required": [
    "state",
    "content",
    "visibility"
  ],
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The resource name of the memo.\n Format: memos/{memo}, where memo is the user-defined UID."
    },
    "state": {
      "enum": [
        "STATE_UNSPECIFIED",
        "NORMAL",
        "ARCHIVED"
      ],
      "type": "string",
      "description": "The state of the memo.",
      "format": "enum"
    },
    "creator": {
      "readOnly": true,
      "type": "string",
      "description": "The name of the creator.\n Format: users/{user}"
    },
    "createTime": {
      "type": "string",
      "description": "The creation timestamp.\n If not set on creation, the server will set it to the current time.",
      "format": "date-time"
    },
    "updateTime": {
      "type": "string",
      "description": "The last update timestamp.\n If not set on creation, the server will set it to the current time.",
      "format": "date-time"
    },
    "content": {
      "type": "string",
      "description": "Required. The content of the memo in Markdown format."
    },
    "visibility": {
      "enum": [
        "VISIBILITY_UNSPECIFIED",
        "PRIVATE",
        "PROTECTED",
        "PUBLIC",
        "SPACE"
      ],
      "type": "string",
      "description": "The visibility of the memo.\n One of PRIVATE (creator only), PROTECTED (signed-in users), PUBLIC\n (anonymous-eligible), or SPACE (active space members). Defaults to\n PRIVATE on creation when unspecified.",
      "format": "enum"
    },
    "tags": {
      "readOnly": true,
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Output only. The tags extracted from the content."
    },
    "pinned": {
      "type": "boolean",
      "description": "Whether the memo is pinned."
    },
    "attachments": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Attachment"
      },
      "description": "Optional. The attachments of the memo."
    },
    "relations": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/MemoRelation"
      },
      "description": "Optional. The relations of the memo."
    },
    "reactions": {
      "readOnly": true,
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Reaction"
      },
      "description": "Output only. The reactions to the memo."
    },
    "property": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/Memo_Property"
        }
      ],
      "description": "Output only. The computed properties of the memo."
    },
    "parent": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. The context memo of this COMMENT relation, if any.\n Its identity is returned even when the caller cannot read the parent.\n Fetch the parent independently; this field does not grant read access.\n Format: memos/{memo}"
    },
    "snippet": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. The snippet of the memo content. Plain text only."
    },
    "location": {
      "allOf": [
        {
          "$ref": "#/components/schemas/Location"
        }
      ],
      "description": "Optional. The location of the memo."
    },
    "space": {
      "type": "string",
      "description": "Optional. The space in which this memo is placed. Format: spaces/{space}.\n Every memo, including a comment, owns its placement independently."
    }
  }
}