modelRT/docs/swagger.yaml

455 lines
12 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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