Initial commit
This commit is contained in:
295
reference/goedge 文档/ScriptService.md
Normal file
295
reference/goedge 文档/ScriptService.md
Normal file
@@ -0,0 +1,295 @@
|
||||
# ScriptService
|
||||
> 脚本相关服务
|
||||
|
||||
---
|
||||
|
||||
## checkScriptUpdates
|
||||
> 检查脚本是否需要有更新
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/checkScriptUpdates`
|
||||
- RPC:`rpc checkScriptUpdates(CheckScriptUpdatesRequest) returns (CheckScriptUpdatesResponse);`
|
||||
|
||||
**请求对象 (`CheckScriptUpdatesRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"userId": "int64 // 用户ID"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`CheckScriptUpdatesResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"hasUpdates": "bool",
|
||||
"version": "int64"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/checkScriptUpdates" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## countAllEnabledScripts
|
||||
> 计算脚本数量
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/countAllEnabledScripts`
|
||||
- RPC:`rpc countAllEnabledScripts(CountAllEnabledScriptsRequest) returns (RPCCountResponse);`
|
||||
|
||||
**请求对象 (`CountAllEnabledScriptsRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"userId": "int64 // 用户ID"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCCountResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"count": "int64 // 数量"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/countAllEnabledScripts" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## createScript
|
||||
> 添加脚本
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/createScript`
|
||||
- RPC:`rpc createScript(CreateScriptRequest) returns (CreateScriptResponse);`
|
||||
|
||||
**请求对象 (`CreateScriptRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "string // 名称",
|
||||
"filename": "string // 文件名",
|
||||
"code": "string"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`CreateScriptResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"scriptId": "int64"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/createScript" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## deleteScript
|
||||
> 删除脚本
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/deleteScript`
|
||||
- RPC:`rpc deleteScript(DeleteScriptRequest) returns (RPCSuccess);`
|
||||
|
||||
**请求对象 (`DeleteScriptRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"scriptId": "int64"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCSuccess`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/deleteScript" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## findEnabledScript
|
||||
> 查找单个脚本
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/findEnabledScript`
|
||||
- RPC:`rpc findEnabledScript(FindEnabledScriptRequest) returns (FindEnabledScriptResponse);`
|
||||
|
||||
**请求对象 (`FindEnabledScriptRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"scriptId": "int64"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`FindEnabledScriptResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"script": "Script"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/findEnabledScript" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## listEnabledScripts
|
||||
> 列出单页脚本
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/listEnabledScripts`
|
||||
- RPC:`rpc listEnabledScripts(ListEnabledScriptsRequest) returns (ListEnabledScriptsResponse);`
|
||||
|
||||
**请求对象 (`ListEnabledScriptsRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"userId": "int64 // 用户ID",
|
||||
"offset": "int64 // 读取位置",
|
||||
"size": "int64 // 数量,通常不能小于0"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`ListEnabledScriptsResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": "[]Script"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/listEnabledScripts" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## publishScripts
|
||||
> 发布脚本
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/publishScripts`
|
||||
- RPC:`rpc publishScripts(PublishScriptsRequest) returns (RPCSuccess);`
|
||||
|
||||
**请求对象 (`PublishScriptsRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"userId": "int64 // 用户ID"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCSuccess`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/publishScripts" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## updateScript
|
||||
> 修改脚本
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/ScriptService/updateScript`
|
||||
- RPC:`rpc updateScript(UpdateScriptRequest) returns (RPCSuccess);`
|
||||
|
||||
**请求对象 (`UpdateScriptRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"scriptId": "int64",
|
||||
"name": "string // 名称",
|
||||
"filename": "string // 文件名",
|
||||
"code": "string",
|
||||
"isOn": "bool // 是否启用"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCSuccess`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/ScriptService/updateScript" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user