feat(api): add events history endpoint

Expose events via REST and websocket streaming, update
swagger docs, and emit config reload/error events
This commit is contained in:
yusing
2026-02-10 18:03:30 +08:00
parent 31a7827fab
commit 3b7a6226ad
5 changed files with 194 additions and 4 deletions

View File

@@ -837,6 +837,45 @@
"operationId": "stop"
}
},
"/events": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"v1"
],
"summary": "Get events history",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_yusing_goutils_events.Event"
}
}
},
"403": {
"description": "Forbidden: unauthorized",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Server Error: internal error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-id": "events",
"operationId": "events"
}
},
"/favicon": {
"get": {
"description": "Get favicon",
@@ -5029,6 +5068,7 @@
"x-omitempty": false
},
"validationError": {
"description": "we need the structured error, not the plain string",
"x-nullable": false,
"x-omitempty": false
}
@@ -5064,6 +5104,7 @@
"type": "object",
"properties": {
"executionError": {
"description": "we need the structured error, not the plain string",
"x-nullable": false,
"x-omitempty": false
},
@@ -6660,6 +6701,54 @@
"x-nullable": false,
"x-omitempty": false
},
"events.Level": {
"type": "string",
"enum": [
"debug",
"info",
"warn",
"error"
],
"x-enum-varnames": [
"LevelDebug",
"LevelInfo",
"LevelWarn",
"LevelError"
],
"x-nullable": false,
"x-omitempty": false
},
"github_com_yusing_goutils_events.Event": {
"type": "object",
"properties": {
"action": {
"type": "string",
"x-nullable": false,
"x-omitempty": false
},
"category": {
"type": "string",
"x-nullable": false,
"x-omitempty": false
},
"data": {
"x-nullable": false,
"x-omitempty": false
},
"level": {
"$ref": "#/definitions/events.Level",
"x-nullable": false,
"x-omitempty": false
},
"timestamp": {
"type": "string",
"x-nullable": false,
"x-omitempty": false
}
},
"x-nullable": false,
"x-omitempty": false
},
"icons.Source": {
"type": "string",
"enum": [