45 lines
1.9 KiB
Go
45 lines
1.9 KiB
Go
// Package network define struct of network operation
|
|
package network
|
|
|
|
// FailureResponse define struct of standard failure API response format
|
|
type FailureResponse struct {
|
|
Code int `json:"code" example:"3000"`
|
|
Msg string `json:"msg" example:"process completed with partial failures"`
|
|
Payload any `json:"payload" swaggertype:"object"`
|
|
}
|
|
|
|
// SuccessResponse define struct of standard successful API response format
|
|
type SuccessResponse struct {
|
|
Code int `json:"code" example:"2000"`
|
|
Msg string `json:"msg" example:"process completed"`
|
|
Payload any `json:"payload" swaggertype:"object"`
|
|
}
|
|
|
|
// WSResponse define struct of standard websocket API response format
|
|
type WSResponse struct {
|
|
Code int `json:"code" example:"2000"`
|
|
Msg string `json:"msg" example:"process completed"`
|
|
Payload any `json:"payload,omitempty" swaggertype:"object"`
|
|
}
|
|
|
|
// MeasurementRecommendPayload define struct of represents the data payload for the successful recommendation response.
|
|
type MeasurementRecommendPayload struct {
|
|
Input string `json:"input" example:"transformfeeder1_220."`
|
|
Offset int `json:"offset" example:"21"`
|
|
RecommendType string `json:"recommended_type" example:"grid_tag"`
|
|
RecommendedList []string `json:"recommended_list" example:"[\"I_A_rms\", \"I_B_rms\",\"I_C_rms\"]"`
|
|
}
|
|
|
|
// TargetResult define struct of target item in real time data subscription response payload
|
|
type TargetResult struct {
|
|
ID string `json:"id" example:"grid1.zone1.station1.ns1.tag1.transformfeeder1_220.I_A_rms"`
|
|
Code int `json:"code" example:"20000"`
|
|
Msg string `json:"msg" example:"subscription success"`
|
|
}
|
|
|
|
// RealTimeSubPayload define struct of real time data subscription request
|
|
type RealTimeSubPayload struct {
|
|
ClientID string `json:"client_id" example:"5d72f2d9-e33a-4f1b-9c76-88a44b9a953e" description:"用于标识不同client的监控请求ID"`
|
|
TargetResults []TargetResult `json:"targets"`
|
|
}
|