From d5a2de567660cbe30897c75c3d8fc79183d35f08 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 5 Jun 2022 11:53:53 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=8F=90=E4=BE=9B=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=8E=A8=E9=80=81=20API=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20https://github.com/siyuan-note/siyuan/issues/5102?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++-- API_zh_CN.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 117 insertions(+), 5 deletions(-) diff --git a/API.md b/API.md index 4d15bc941..04c663326 100644 --- a/API.md +++ b/API.md @@ -35,10 +35,13 @@ * [Templates](#Templates) * [Render a template](#Render-a-template) * [File](#File) - * [Get File](#Get-file) - * [Put File](#Put-file) + * [Get file](#Get-file) + * [Put file](#Put-file) * [Export](#Export) * [Export Markdown](#Export-Markdown) +* [Notification](#Notification) + * [Push message](#Push-message) + * [Push error message](#Push-error-message) * [System](#System) * [Get boot progress](#Get-boot-progress) * [Get system version](#Get-system-version) @@ -846,6 +849,60 @@ View API token in Settings - About, request header: `Authorization: T * `hPath`: human-readable path * `content`: Markdown content +## Notification + +### Push message + +* `/api/notification/pushMsg` +* Parameters + + ```json + { + "msg": "test", + "timeout": 7000 + } + ``` + * `timeout`: The duration of the message display in milliseconds. This field can be omitted, the default is 7000 + milliseconds +* Return value + + ```json + { + "code": 0, + "msg": "", + "data": { + "id": "62jtmqi" + } + } + ``` + * `id`: Message ID + +### Push error message + +* `/api/notification/pushErrMsg` +* Parameters + + ```json + { + "msg": "test", + "timeout": 7000 + } + ``` + * `timeout`: The duration of the message display in milliseconds. This field can be omitted, the default is 7000 + milliseconds +* Return value + + ```json + { + "code": 0, + "msg": "", + "data": { + "id": "qc9znut" + } + } + ``` + * `id`:Message ID + ## System ### Get boot progress diff --git a/API_zh_CN.md b/API_zh_CN.md index 89f36e1f3..bbe29299b 100644 --- a/API_zh_CN.md +++ b/API_zh_CN.md @@ -34,11 +34,14 @@ * [执行 SQL 查询](#执行-SQL-查询) * [模板](#模板) * [渲染模板](#渲染模板) -* [导出](#导出) - * [导出 Markdown 文本](#导出-markdown-文本) * [文件](#文件) * [获取文件](#获取文件) * [写入文件](#写入文件) +* [导出](#导出) + * [导出 Markdown 文本](#导出-markdown-文本) +* [通知](#通知) + * [推送消息](#推送消息) + * [推送报错消息](#推送报错消息) * [系统](#系统) * [获取启动进度](#获取启动进度) * [获取系统版本](#获取系统版本) @@ -799,7 +802,7 @@ * 参数为 HTTP Multipart 表单 * `path`:工作空间路径下的文件路径 - * `isDir`:是否为创建文件夹,为 `true` 时仅创建文件夹,忽略 `file` + * `isDir`:是否为创建文件夹,为 `true` 时仅创建文件夹,忽略 `file` * `modTime`:最近访问和修改时间,Unix time * `file`:上传的文件 * 返回值 @@ -842,6 +845,58 @@ * `hPath`:人类可读的路径 * `content`:Markdown 内容 +## 通知 + +### 推送消息 + +* `/api/notification/pushMsg` +* 参数 + + ```json + { + "msg": "test", + "timeout": 7000 + } + ``` + * `timeout`:消息持续显示时间,单位为毫秒。可以不传入该字段,默认为 7000 毫秒 +* 返回值 + + ```json + { + "code": 0, + "msg": "", + "data": { + "id": "62jtmqi" + } + } + ``` + * `id`:消息 ID + +### 推送报错消息 + +* `/api/notification/pushErrMsg` +* 参数 + + ```json + { + "msg": "test", + "timeout": 7000 + } + ``` + * `timeout`:消息持续显示时间,单位为毫秒。可以不传入该字段,默认为 7000 毫秒 +* 返回值 + + ```json + { + "code": 0, + "msg": "", + "data": { + "id": "qc9znut" + } + } + ``` + * `id`:消息 ID + ## 系统 ### 获取启动进度