723 lines
26 KiB
Go
723 lines
26 KiB
Go
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||
package docs
|
||
|
||
import "github.com/swaggo/swag"
|
||
|
||
const docTemplate = `{
|
||
"schemes": {{ marshal .Schemes }},
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"description": "{{escape .Description}}",
|
||
"title": "{{.Title}}",
|
||
"contact": {
|
||
"name": "douxu",
|
||
"url": "http://www.swagger.io/support",
|
||
"email": "douxu@clea.com.cn"
|
||
},
|
||
"license": {
|
||
"name": "Apache 2.0",
|
||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||
},
|
||
"version": "{{.Version}}"
|
||
},
|
||
"host": "{{.Host}}",
|
||
"basePath": "{{.BasePath}}",
|
||
"paths": {
|
||
"/data/realtime": {
|
||
"get": {
|
||
"description": "根据用户输入的组件token,从 dataRT 服务中持续获取测点实时数据",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RealTime Component"
|
||
],
|
||
"summary": "获取实时测点数据",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "测量点唯一标识符 (e.g.grid_1:zone_1:station_1:transformfeeder1_220.I_A_rms)",
|
||
"name": "token",
|
||
"in": "query",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"description": "查询起始时间 (Unix时间戳, e.g., 1761008266)",
|
||
"name": "begin",
|
||
"in": "query",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"description": "查询结束时间 (Unix时间戳, e.g., 1761526675)",
|
||
"name": "end",
|
||
"in": "query",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "返回实时数据成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/definitions/network.RealTimeDataPayload"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "返回实时数据失败",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/measurement/recommend": {
|
||
"get": {
|
||
"description": "根据用户输入的字符串,从 Redis 中查询可能的测量点或结构路径,并提供推荐列表。",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Measurement Recommend"
|
||
],
|
||
"summary": "测量点推荐(搜索框自动补全)",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"example": "\"grid1\"",
|
||
"description": "推荐关键词,例如 'grid1' 或 'grid1.'",
|
||
"name": "input",
|
||
"in": "query",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "返回推荐列表成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/definitions/network.MeasurementRecommendPayload"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "返回推荐列表失败",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/model/diagram_load/{page_id}": {
|
||
"get": {
|
||
"description": "load circuit diagram info by page id",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"load circuit_diagram"
|
||
],
|
||
"summary": "load circuit diagram info",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "page ID",
|
||
"name": "page_id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "request process success",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "request process failed",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/monitors/data/realtime/stream/:clientID": {
|
||
"get": {
|
||
"description": "根据用户输入的clientID拉取对应的实时数据",
|
||
"tags": [
|
||
"RealTime Component Websocket"
|
||
],
|
||
"summary": "实时数据拉取 websocket api",
|
||
"responses": {}
|
||
}
|
||
},
|
||
"/monitors/data/subscriptions": {
|
||
"post": {
|
||
"description": "根据用户输入的组件token,从 modelRT 服务中开始或结束对于量测节点的实时数据的订阅",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RealTime Component"
|
||
],
|
||
"summary": "开始或结束订阅实时数据",
|
||
"parameters": [
|
||
{
|
||
"description": "量测节点实时数据订阅",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/network.RealTimeSubRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"2000": {
|
||
"description": "订阅实时数据结果列表",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/definitions/network.RealTimeSubPayload"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"3000": {
|
||
"description": "订阅实时数据结果列表",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/definitions/network.RealTimeSubPayload"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/task/async": {
|
||
"post": {
|
||
"description": "创建新的异步任务并返回任务ID,任务将被提交到队列等待处理",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"AsyncTask"
|
||
],
|
||
"summary": "创建异步任务",
|
||
"parameters": [
|
||
{
|
||
"description": "任务创建请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/network.AsyncTaskCreateRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "任务创建成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/definitions/network.AsyncTaskCreateResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器内部错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/task/async/results": {
|
||
"get": {
|
||
"description": "根据任务ID列表查询异步任务的状态和结果",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"AsyncTask"
|
||
],
|
||
"summary": "查询异步任务结果",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "任务ID列表,用逗号分隔",
|
||
"name": "task_ids",
|
||
"in": "query",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "查询成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/definitions/network.AsyncTaskResultQueryResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器内部错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/task/async/{task_id}": {
|
||
"get": {
|
||
"description": "根据任务ID查询异步任务的详细状态和结果",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"AsyncTask"
|
||
],
|
||
"summary": "查询异步任务详情",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "任务ID",
|
||
"name": "task_id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "查询成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/definitions/network.AsyncTaskResult"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "任务不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器内部错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/task/async/{task_id}/cancel": {
|
||
"post": {
|
||
"description": "取消指定ID的异步任务(如果任务尚未开始执行)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"AsyncTask"
|
||
],
|
||
"summary": "取消异步任务",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "任务ID",
|
||
"name": "task_id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "任务取消成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.SuccessResponse"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误或任务无法取消",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "任务不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "服务器内部错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/network.FailureResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"network.AsyncTaskCreateRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"params": {
|
||
"description": "required: true",
|
||
"type": "object"
|
||
},
|
||
"task_type": {
|
||
"description": "required: true\nenum: TOPOLOGY_ANALYSIS, PERFORMANCE_ANALYSIS, EVENT_ANALYSIS, BATCH_IMPORT",
|
||
"type": "string",
|
||
"example": "TOPOLOGY_ANALYSIS"
|
||
}
|
||
}
|
||
},
|
||
"network.AsyncTaskCreateResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"task_id": {
|
||
"type": "string",
|
||
"example": "123e4567-e89b-12d3-a456-426614174000"
|
||
}
|
||
}
|
||
},
|
||
"network.AsyncTaskResult": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "integer",
|
||
"example": 1741846200
|
||
},
|
||
"error_code": {
|
||
"type": "integer",
|
||
"example": 400102
|
||
},
|
||
"error_detail": {
|
||
"type": "object"
|
||
},
|
||
"error_message": {
|
||
"type": "string",
|
||
"example": "Component UUID not found"
|
||
},
|
||
"finished_at": {
|
||
"type": "integer",
|
||
"example": 1741846205
|
||
},
|
||
"progress": {
|
||
"type": "integer",
|
||
"example": 65
|
||
},
|
||
"result": {
|
||
"type": "object"
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"example": "COMPLETED"
|
||
},
|
||
"task_id": {
|
||
"type": "string",
|
||
"example": "123e4567-e89b-12d3-a456-426614174000"
|
||
},
|
||
"task_type": {
|
||
"type": "string",
|
||
"example": "TOPOLOGY_ANALYSIS"
|
||
}
|
||
}
|
||
},
|
||
"network.AsyncTaskResultQueryResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"tasks": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/network.AsyncTaskResult"
|
||
}
|
||
},
|
||
"total": {
|
||
"type": "integer",
|
||
"example": 3
|
||
}
|
||
}
|
||
},
|
||
"network.FailureResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 3000
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "process completed with partial failures"
|
||
},
|
||
"payload": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"network.MeasurementRecommendPayload": {
|
||
"type": "object",
|
||
"properties": {
|
||
"input": {
|
||
"type": "string",
|
||
"example": "transformfeeder1_220."
|
||
},
|
||
"offset": {
|
||
"type": "integer",
|
||
"example": 21
|
||
},
|
||
"recommended_list": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"example": [
|
||
"[\"I_A_rms\"",
|
||
" \"I_B_rms\"",
|
||
"\"I_C_rms\"]"
|
||
]
|
||
},
|
||
"recommended_type": {
|
||
"type": "string",
|
||
"example": "grid_tag"
|
||
}
|
||
}
|
||
},
|
||
"network.RealTimeDataPayload": {
|
||
"type": "object",
|
||
"properties": {
|
||
"sub_pos": {
|
||
"description": "TODO 增加example tag",
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"network.RealTimeMeasurementItem": {
|
||
"type": "object",
|
||
"properties": {
|
||
"interval": {
|
||
"type": "string",
|
||
"example": "1"
|
||
},
|
||
"targets": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"example": [
|
||
"[\"grid1.zone1.station1.ns1.tag1.bay.I11_A_rms\"",
|
||
"\"grid1.zone1.station1.ns1.tag1.tag1.bay.I11_B_rms\"]"
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"network.RealTimeSubPayload": {
|
||
"type": "object",
|
||
"properties": {
|
||
"client_id": {
|
||
"type": "string",
|
||
"example": "5d72f2d9-e33a-4f1b-9c76-88a44b9a953e"
|
||
},
|
||
"targets": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/network.TargetResult"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"network.RealTimeSubRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"action": {
|
||
"description": "required: true\nenum: [start, stop]",
|
||
"type": "string",
|
||
"example": "start"
|
||
},
|
||
"client_id": {
|
||
"type": "string",
|
||
"example": "5d72f2d9-e33a-4f1b-9c76-88a44b9a953e"
|
||
},
|
||
"measurements": {
|
||
"description": "required: true",
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/network.RealTimeMeasurementItem"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"network.SuccessResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 2000
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "process completed"
|
||
},
|
||
"payload": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"network.TargetResult": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 20000
|
||
},
|
||
"id": {
|
||
"type": "string",
|
||
"example": "grid1.zone1.station1.ns1.tag1.transformfeeder1_220.I_A_rms"
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "subscription success"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}`
|
||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||
var SwaggerInfo = &swag.Spec{
|
||
Version: "1.0",
|
||
Host: "localhost:8080",
|
||
BasePath: "/api/v1",
|
||
Schemes: []string{},
|
||
Title: "ModelRT 实时模型服务 API 文档",
|
||
Description: "实时数据计算和模型运行服务的 API 服务",
|
||
InfoInstanceName: "swagger",
|
||
SwaggerTemplate: docTemplate,
|
||
LeftDelim: "{{",
|
||
RightDelim: "}}",
|
||
}
|
||
|
||
func init() {
|
||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||
}
|