列表 API 查询参数
监控类列表端点共享分页契约:page(默认 1)、per_page(默认 20,上限 100),响应统一为 { items, page, per_page, total }。本页列出各端点的专属过滤参数与取值约定。
GET /api/v1/work-items
| 参数 | 取值 | 说明 |
|---|---|---|
kind | issue / pull_request | 工作项类型 |
state | open / closed | state=closed 时默认按 display.closed_limit 设置限量 |
repository_id | 仓库 ID | 限定单仓 |
review | approved / changes_requested / pending | PR 审核结论;pending 映射为尚无审核记录(服务端存空串) |
check | passed / failed / pending | PR 检查状态;passed/failed 分别映射存储值 success/failure,pending 匹配空串或 pending |
search | 任意文本 | 在标题、作者、工作项编号或仓库名称上执行不区分大小写搜索;分页与 total 均基于搜索结果 |
ignored | true / all | 默认仅返回未忽略项;true 仅已忽略,all 含全部 |
review / check 的组合过滤在 SQL 层完成,分页与 total 均为过滤后结果。
POST /api/v1/work-items/batch-ignore
批量更新工作项(Issue / PR)的本地忽略状态,避免逐条 PATCH 导致网络往返。服务端在单个事务内完成全部更新,单次请求上限 100 条(ID 去重后计数)。
| 字段 | 类型 | 说明 |
|---|---|---|
ids | string[] | 待更新的工作项 ID 列表(长度 1–100) |
ignored | boolean | true 为忽略,false 为取消忽略 |
响应 { "updated_count": <更新条数>, "ignored": <布尔值> }。任一 ID 不存在时整体回滚并返回 404,不会出现「部分已更新」的中间状态。写入成功后通过 SSE 广播 work_items.changed。需管理员 Session 与 CSRF。
GET /api/v1/events/stream
Server-Sent Events (SSE) 实时长连接端点。当 Webhook 入库、通知状态流转、AI 审查完成或工作项忽略状态变更时向前端广播最新资源变更事件,客户端自动防抖合并(150ms 窗口)并按需局部失效缓存。每 15 秒发送心跳保活 ping,支持 1024 个并发连接,单客户端配备 64 条消息背压隔离。需管理员 Session。
GET /api/v1/notifications/outbox
| 参数 | 取值 | 说明 |
|---|---|---|
status | pending / sending / sent / dead | 通知投递状态(重试中的条目仍为 pending,由 attempt_count 体现) |
channel_type | 渠道类型(如 telegram) | 服务端解析为渠道 ID 集合后下推 SQL;无匹配渠道时返回空页且分页参数已归一化 |
POST /api/v1/notifications/outbox/retry-dead
一键重新排队全部失败投递,后端单次 UPDATE 完成(与逐条 POST /notifications/outbox/{id}/retry 同一字段语义:转 pending、立即到期、清空错误码与锁)。
| 参数 | 取值 | 说明 |
|---|---|---|
channel_type | 渠道类型(如 telegram),可选 | 仅重新排队该渠道的 dead 投递;缺省重试全部渠道 |
响应 { "status": "queued", "retried": <重新排队条数> }。需管理员 Session 与 CSRF。
GET /api/v1/repositories
| 参数 | 取值 | 说明 |
|---|---|---|
type | installation / external | 仓库来源类型 |
GET /api/v1/events
| 参数 | 取值 | 说明 |
|---|---|---|
kind | 事件类型 | 如 issue、pull_request、workflow_run |
repository_id | 仓库 ID | 限定单仓 |
GET /api/v1/workflow-runs
| 参数 | 取值 | 说明 |
|---|---|---|
conclusion | workflow 结论(如 success、failure) | 按 conclusion 列过滤 |
repository_id | 仓库 ID | 限定单仓 |
GET /api/v1/security-alerts
| 参数 | 取值 | 说明 |
|---|---|---|
alert_kind | dependabot / code_scanning / secret_scanning | 告警来源 |
state | open / dismissed / fixed / withdrawn | 告警状态;withdrawn(已撤回)由对账检测到源端告警消失后写入 |
GET /api/v1/starred-releases/trackers
| 参数 | 取值 | 说明 |
|---|---|---|
state | tracking / inactive / disabled / unavailable | Star Release 追踪状态;inactive(无 Release)默认 7 天复查,disabled 为手动停用 |
POST /api/v1/rules/dry-run
规则试算与通知效果模拟端点(0 数据库写入、0 Outbox 写入、0 外部网络调用、0 审计日志副作用),供通知模拟器或自动化规则验证使用。
| 字段 | 类型 | 说明 |
|---|---|---|
event_type | string | 必填,事件类型(如 pull_request、issues、workflow_run、release 等) |
action | string | 可选,事件动作(如 opened、completed、published) |
repository | string | 可选,仓库完整全称(如 owner/repo) |
branch | string | 可选,分支或引用名 |
payload_raw | string | 可选,完整的原始 Webhook JSON 字符串 |
channels | object[] | 可选,临时覆盖使用的渠道配置列表(未提供则使用系统当前配置渠道) |
响应包含格式化后的事件标题、正文渲染结果(HTML/Markdown)、命中的过滤规则列表、各渠道匹配状态与跳过原因(channel_results),以及是否触发紧急静音。需管理员 Session 与 CSRF。