222 lines
4.1 KiB
Markdown
222 lines
4.1 KiB
Markdown
|
|
# UserScriptService
|
|||
|
|
> 用户脚本服务
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## countUserScripts
|
|||
|
|
> 计算用户脚本数量
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/UserScriptService/countUserScripts`
|
|||
|
|
- RPC:`rpc countUserScripts(CountUserScriptsRequest) returns (RPCCountResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`CountUserScriptsRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userId": "int64 // 所属用户ID",
|
|||
|
|
"isAuditing": "bool // 是否正在审核"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCCountResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"count": "int64 // 数量"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/UserScriptService/countUserScripts" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## findUserScript
|
|||
|
|
> 查找单个用户脚本信息
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/UserScriptService/findUserScript`
|
|||
|
|
- RPC:`rpc findUserScript(FindUserScriptRequest) returns (FindUserScriptResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`FindUserScriptRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userScriptId": "int64 // 用户脚本ID"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`FindUserScriptResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userScript": "UserScript // 用户脚本信息"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/UserScriptService/findUserScript" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## findUserScriptWithMD5
|
|||
|
|
> 根据代码MD5查找脚本
|
|||
|
|
|
|||
|
|
- 角色:`admin`, `user`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/UserScriptService/findUserScriptWithMD5`
|
|||
|
|
- RPC:`rpc findUserScriptWithMD5(FindUserScriptWithMD5Request) returns (FindUserScriptWithMD5Response);`
|
|||
|
|
|
|||
|
|
**请求对象 (`FindUserScriptWithMD5Request`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"codeMD5": "string // 代码MD5(32位)"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`FindUserScriptWithMD5Response`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userScript": "UserScript // 用户脚本信息"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/UserScriptService/findUserScriptWithMD5" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## listUserScripts
|
|||
|
|
> 列出单页用户脚本
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/UserScriptService/listUserScripts`
|
|||
|
|
- RPC:`rpc listUserScripts(ListUserScriptsRequest) returns (ListUserScriptsResponse);`
|
|||
|
|
|
|||
|
|
**请求对象 (`ListUserScriptsRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userId": "int64 // 所属用户ID",
|
|||
|
|
"isAuditing": "bool // 是否正在审核",
|
|||
|
|
"offset": "int64 // 开始读取位置",
|
|||
|
|
"size": "int64 // 读取数量"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`ListUserScriptsResponse`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userScripts": "[]UserScript // 用户脚本列表"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/UserScriptService/listUserScripts" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## passUserScript
|
|||
|
|
> 审核并通过用户脚本
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/UserScriptService/passUserScript`
|
|||
|
|
- RPC:`rpc passUserScript(PassUserScriptRequest) returns (RPCSuccess);`
|
|||
|
|
|
|||
|
|
**请求对象 (`PassUserScriptRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userScriptId": "int64 // 用户脚本ID"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCSuccess`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/UserScriptService/passUserScript" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## rejectUserScript
|
|||
|
|
> 审核并驳回用户脚本
|
|||
|
|
|
|||
|
|
- 角色:`admin`
|
|||
|
|
- HTTP:`POST https://backend.dooki.cloud/UserScriptService/rejectUserScript`
|
|||
|
|
- RPC:`rpc rejectUserScript(RejectUserScriptRequest) returns (RPCSuccess);`
|
|||
|
|
|
|||
|
|
**请求对象 (`RejectUserScriptRequest`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"userScriptId": "int64 // 用户脚本ID",
|
|||
|
|
"reason": "string // 驳回理由"
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**响应对象 (`RPCSuccess`)**
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**调用示例**
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -X POST "https://backend.dooki.cloud/UserScriptService/rejectUserScript" \
|
|||
|
|
-H "Content-Type: application/json" \
|
|||
|
|
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
|||
|
|
-d '{
|
|||
|
|
...
|
|||
|
|
}'
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|