/api/repo
openRepoSnapshotDoc
- 🛠 读取快照文件内容
/api/repo/openRepoSnapshotDoc
请求
ts
/**
* Open document in repository snapshot
*/
export interface IPayload {
/**
* Snapshot file object ID
*/
readonly id: string;
}
json5
/**
* schemas/kernel/api/repo/openRepoSnapshotDoc/payload.schema.json5
* 打开快照中仓库中的文档
* REF: https://github.com/siyuan-note/siyuan/blob/v2.9.7/kernel/api/repo.go#L29-L51
* @pathname: /api/repo/openRepoSnapshotDoc
* @version: 2.9.7
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/repo/openRepoSnapshotDoc/payload.schema.json5',
$comment: 'v2.9.7',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'payload body',
description: 'Open document in repository snapshot',
type: 'object',
additionalProperties: false,
required: [
'id',
],
properties: {
id: {
// 快照文件对象 ID
type: 'string',
description: 'Snapshot file object ID',
pattern: '^[0-9a-f]{40}$',
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/repo/openRepoSnapshotDoc/payload.schema.json",
"$comment": "v2.9.7",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "payload body",
"description": "Open document in repository snapshot",
"type": "object",
"additionalProperties": false,
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"description": "Snapshot file object ID",
"pattern": "^[0-9a-f]{40}$"
}
}
}
}
}
响应
ts
/**
* Open document in repository snapshot
*/
export interface IResponse {
/**
* status code
*/
readonly code: number;
readonly data: IData;
/**
* status message
*/
readonly msg: string;
}
/**
* Response information
*/
export interface IData {
/**
* snapshot file content
*/
readonly content: string;
/**
* Whether the content is original
* true: json file original text / other file path
* false: block DOM string
*/
readonly isProtyleDoc: boolean;
/**
* update time (Unix timestamp, ms)
*/
readonly updated: number;
}
json5
/**
* schemas/kernel/api/history/getDocHistoryContent/response.schema.json5
* 打开快照中仓库中的文档
* REF: https://github.com/siyuan-note/siyuan/blob/v2.9.7/kernel/api/repo.go#L29-L51
* @pathname: /api/repo/openRepoSnapshotDoc
* @version: 2.9.7
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/history/getDocHistoryContent/response.schema.json5',
$comment: 'v2.9.7',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'response body',
description: 'Open document in repository snapshot',
type: 'object',
additionalProperties: false,
required: [
'code',
'msg',
'data',
],
properties: {
code: {
type: 'integer',
description: 'status code',
},
msg: {
type: 'string',
description: 'status message',
},
data: {
$ref: '#/$defs/data',
},
},
},
data: {
title: 'IData',
description: 'Response information',
type: 'object',
additionalProperties: false,
required: [
'updated',
'isProtyleDoc',
'content',
],
properties: {
updated: {
// 更新时间 (Unix 时间戳, 单位: ms)
type: 'integer',
description: 'update time (Unix timestamp, ms)',
examples: [
1690296491237,
],
},
isProtyleDoc: {
// 内容是否为原始内容, true: 原始文本/文件路径, false: 块 DOM 字符串
type: 'boolean',
description: 'Whether the content is original\ntrue: json file original text / other file path\nfalse: block DOM string',
},
content: {
// 快照文件内容
type: 'string',
description: 'snapshot file content',
examples: [
'<div data-node-id="20230725221731-6g59iid" data-node-index="1" data-type="NodeParagraph" class="p" updated="20230725221745"><div contenteditable="false" spellcheck="false">123</div><div class="protyle-attr" contenteditable="false"></div></div><div data-node-id="20230725224810-naky2y2" data-node-index="2" data-type="NodeParagraph" class="p"><div contenteditable="false" spellcheck="false"></div><div class="protyle-attr" contenteditable="false"></div></div>', // 文档文件
'{}', // json 文件
'/plugins/open-api/README.md', // 其他文件
'/plugins/open-api/icon.png', // 其他文件
],
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/history/getDocHistoryContent/response.schema.json",
"$comment": "v2.9.7",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "response body",
"description": "Open document in repository snapshot",
"type": "object",
"additionalProperties": false,
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"description": "status code"
},
"msg": {
"type": "string",
"description": "status message"
},
"data": {
"$ref": "#/$defs/data"
}
}
},
"data": {
"title": "IData",
"description": "Response information",
"type": "object",
"additionalProperties": false,
"required": [
"updated",
"isProtyleDoc",
"content"
],
"properties": {
"updated": {
"type": "integer",
"description": "update time (Unix timestamp, ms)",
"examples": [
1690296491237
]
},
"isProtyleDoc": {
"type": "boolean",
"description": "Whether the content is original\ntrue: json file original text / other file path\nfalse: block DOM string"
},
"content": {
"type": "string",
"description": "snapshot file content",
"examples": [
"<div data-node-id=\"20230725221731-6g59iid\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20230725221745\"><div contenteditable=\"false\" spellcheck=\"false\">123</div><div class=\"protyle-attr\" contenteditable=\"false\"></div></div><div data-node-id=\"20230725224810-naky2y2\" data-node-index=\"2\" data-type=\"NodeParagraph\" class=\"p\"><div contenteditable=\"false\" spellcheck=\"false\"></div><div class=\"protyle-attr\" contenteditable=\"false\"></div></div>",
"{}",
"/plugins/open-api/README.md",
"/plugins/open-api/icon.png"
]
}
}
}
}
}