Files
2025-11-18 03:36:49 +08:00

5.1 KiB
Raw Permalink Blame History

ScriptService

脚本相关服务


checkScriptUpdates

检查脚本是否需要有更新

  • 角色:admin, user
  • HTTPPOST https://backend.dooki.cloud/ScriptService/checkScriptUpdates
  • RPCrpc checkScriptUpdates(CheckScriptUpdatesRequest) returns (CheckScriptUpdatesResponse);

请求对象 (CheckScriptUpdatesRequest)

{
  "userId": "int64 // 用户ID"
}

响应对象 (CheckScriptUpdatesResponse)

{
  "hasUpdates": "bool",
  "version": "int64"
}

调用示例

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
  • HTTPPOST https://backend.dooki.cloud/ScriptService/countAllEnabledScripts
  • RPCrpc countAllEnabledScripts(CountAllEnabledScriptsRequest) returns (RPCCountResponse);

请求对象 (CountAllEnabledScriptsRequest)

{
  "userId": "int64 // 用户ID"
}

响应对象 (RPCCountResponse)

{
  "count": "int64 // 数量"
}

调用示例

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
  • HTTPPOST https://backend.dooki.cloud/ScriptService/createScript
  • RPCrpc createScript(CreateScriptRequest) returns (CreateScriptResponse);

请求对象 (CreateScriptRequest)

{
  "name": "string // 名称",
  "filename": "string // 文件名",
  "code": "string"
}

响应对象 (CreateScriptResponse)

{
  "scriptId": "int64"
}

调用示例

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
  • HTTPPOST https://backend.dooki.cloud/ScriptService/deleteScript
  • RPCrpc deleteScript(DeleteScriptRequest) returns (RPCSuccess);

请求对象 (DeleteScriptRequest)

{
  "scriptId": "int64"
}

响应对象 (RPCSuccess)

{}

调用示例

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
  • HTTPPOST https://backend.dooki.cloud/ScriptService/findEnabledScript
  • RPCrpc findEnabledScript(FindEnabledScriptRequest) returns (FindEnabledScriptResponse);

请求对象 (FindEnabledScriptRequest)

{
  "scriptId": "int64"
}

响应对象 (FindEnabledScriptResponse)

{
  "script": "Script"
}

调用示例

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
  • HTTPPOST https://backend.dooki.cloud/ScriptService/listEnabledScripts
  • RPCrpc listEnabledScripts(ListEnabledScriptsRequest) returns (ListEnabledScriptsResponse);

请求对象 (ListEnabledScriptsRequest)

{
  "userId": "int64 // 用户ID",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量通常不能小于0"
}

响应对象 (ListEnabledScriptsResponse)

{
  "scripts": "[]Script"
}

调用示例

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
  • HTTPPOST https://backend.dooki.cloud/ScriptService/publishScripts
  • RPCrpc publishScripts(PublishScriptsRequest) returns (RPCSuccess);

请求对象 (PublishScriptsRequest)

{
  "userId": "int64 // 用户ID"
}

响应对象 (RPCSuccess)

{}

调用示例

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
  • HTTPPOST https://backend.dooki.cloud/ScriptService/updateScript
  • RPCrpc updateScript(UpdateScriptRequest) returns (RPCSuccess);

请求对象 (UpdateScriptRequest)

{
  "scriptId": "int64",
  "name": "string // 名称",
  "filename": "string // 文件名",
  "code": "string",
  "isOn": "bool // 是否启用"
}

响应对象 (RPCSuccess)

{}

调用示例

curl -X POST "https://backend.dooki.cloud/ScriptService/updateScript" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'