Files
ez-api/internal/api/response_envelope.go
zenfun 5349c9c833 feat(api): add admin master key listing/revoke
Add admin endpoints to list and revoke child keys under a master.
Standardize OpenAPI responses to use ResponseEnvelope with MapData
for error payloads, and regenerate swagger specs accordingly.
2026-01-10 01:10:36 +08:00

20 lines
840 B
Go

package api
// ResponseEnvelope is the standard wrapper for EZ-API JSON responses.
// Code is a numeric business code: 0 for success, non-zero for errors.
// Message is "success" for success, error description for failures.
// Data holds the original response payload for success; null for errors.
// TraceID is a request correlation identifier.
// Details holds optional structured error information.
// swagger:model ResponseEnvelope
type ResponseEnvelope struct {
Code int `json:"code" example:"0"`
Message string `json:"message" example:"success"`
Data any `json:"data" swaggertype:"object"`
TraceID string `json:"trace_id" example:"a1b2c3d4e5f6g7h8"`
Details any `json:"details,omitempty" swaggertype:"object"`
}
// MapData represents a generic JSON object for documentation purposes.
type MapData map[string]any