36 lines
1.4 KiB
Go
36 lines
1.4 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:"500"`
|
|
Msg string `json:"msg" example:"failed to get recommend data from redis"`
|
|
PayLoad any `json:"payload" swaggertype:"object"`
|
|
}
|
|
|
|
// SuccessResponse define struct of standard successful API response format
|
|
type SuccessResponse struct {
|
|
Code int `json:"code" example:"200"`
|
|
Msg string `json:"msg" example:"success"`
|
|
PayLoad any `json:"payload" 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"`
|
|
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 query response payload
|
|
type TargetResult struct {
|
|
ID string `json:"id" example:"grid1.zone1.station1.ns1.tag1.transformfeeder1_220.I_A_rms"`
|
|
Code string `json:"code" example:"1001"`
|
|
Msg string `json:"msg" example:"subscription success"`
|
|
}
|
|
|
|
// RealTimeQueryPayload define struct of real time data query request
|
|
type RealTimeQueryPayload struct {
|
|
TargetResults []TargetResult `json:"targets"`
|
|
}
|