backend/generate/api/common.api

34 lines
871 B
Plaintext
Raw Normal View History

2025-09-30 16:53:31 +00:00
syntax = "v1"
// ================ 通用響應 ================
type (
// 成功響應
2025-10-22 13:40:31 +00:00
RespOK {}
2025-09-30 16:53:31 +00:00
// 分頁響應
PagerResp {
Total int64 `json:"total"`
Size int64 `json:"size"`
Index int64 `json:"index"`
}
// 錯誤響應
ErrorResp {
Code int `json:"code"`
Msg string `json:"msg"`
Details string `json:"details,omitempty"`
Error interface{} `json:"error,omitempty"` // 可選的錯誤信息
}
BaseReq {}
Authorization {
Authorization string `header:"Authorization" validate:"required"`
2025-09-30 16:53:31 +00:00
}
2025-10-22 13:40:31 +00:00
Status {
Code int64 `json:"code"` // 狀態碼
Message string `json:"message"` // 訊息
Data interface{} `json:"data,omitempty"` // 可選的資料,當有返回時才出現
}
2025-09-30 16:53:31 +00:00
)