文档API 参考

Rust · 0.1.0

ImportMemosRequest

有状态上传请求:用 spec 开始,再用 uploadId 继续。

每次请求选择一种上传选项

spec 与 uploadId 是互斥选项,不应同时发送。writeOffset 与 totalSize 使用十进制字符串,REST JSON 中的 data 使用 Base64。按照服务端 committedSize 继续,全部字节到齐后才结束。最终提交、重试与验证行为见操作页。

此结构在哪里使用

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

结构与字段

object

字段类型 / 是否必需描述
namestring
必需
Required. The user who receives the memos. Must be the caller. Format: users/{user}
specallOf
ImportMemosSpec
Starts a new upload. The same call may also carry data and finish_write.
uploadIdstringContinues the upload identified by a previous response.
writeOffsetstring
必需
Required. Zero-based byte offset at which data is written. Must equal the committed size, except when retrying the most recently accepted chunk with identical bytes and offset, which is accepted without writing again.
datastring (bytes)Optional. Archive bytes, at most max_chunk_size long. With no data and finish_write false, the call reports progress without writing, and write_offset is ignored.
finishWritebooleanOptional. Finish the upload after writing data. The committed size must then equal total_size. The archive is validated and, unless validate_only is set, imported. Any later call for an imported upload returns the same report.
validateOnlybooleanOptional. On a finishing call, validate the archive and return the plan without importing. The upload stays staged so a later finishing call can import it.
conflictPolicystring (enum)
CONFLICT_POLICY_UNSPECIFIED · SKIP · REPLACE · DUPLICATE
Optional. Read on the finishing call that imports. Unspecified means SKIP.

完整结构

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

{
  "required": [
    "name",
    "writeOffset"
  ],
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Required. The user who receives the memos. Must be the caller.\n Format: users/{user}"
    },
    "spec": {
      "allOf": [
        {
          "$ref": "#/components/schemas/ImportMemosSpec"
        }
      ],
      "description": "Starts a new upload. The same call may also carry data and finish_write."
    },
    "uploadId": {
      "type": "string",
      "description": "Continues the upload identified by a previous response."
    },
    "writeOffset": {
      "type": "string",
      "description": "Required. Zero-based byte offset at which data is written. Must equal the\n committed size, except when retrying the most recently accepted chunk\n with identical bytes and offset, which is accepted without writing again."
    },
    "data": {
      "type": "string",
      "description": "Optional. Archive bytes, at most max_chunk_size long. With no data and\n finish_write false, the call reports progress without writing, and\n write_offset is ignored.",
      "format": "bytes"
    },
    "finishWrite": {
      "type": "boolean",
      "description": "Optional. Finish the upload after writing data. The committed size must\n then equal total_size. The archive is validated and, unless\n validate_only is set, imported. Any later call for an imported upload\n returns the same report."
    },
    "validateOnly": {
      "type": "boolean",
      "description": "Optional. On a finishing call, validate the archive and return the plan\n without importing. The upload stays staged so a later finishing call can\n import it."
    },
    "conflictPolicy": {
      "enum": [
        "CONFLICT_POLICY_UNSPECIFIED",
        "SKIP",
        "REPLACE",
        "DUPLICATE"
      ],
      "type": "string",
      "description": "Optional. Read on the finishing call that imports. Unspecified means SKIP.",
      "format": "enum"
    }
  }
}