mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
refactor(api): standardize DTOs and update swagger
Decouple API contract from internal models by introducing dedicated DTOs for requests and responses. - Add Response DTOs for all resources (API Keys, Bindings, Models, Namespaces, etc.) - Update Swagger annotations to use DTOs with field examples instead of internal models - Refactor handlers to bind and return DTO structures - Consolidate request/response definitions in the dto package
This commit is contained in:
24
internal/dto/log_record.go
Normal file
24
internal/dto/log_record.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package dto
|
||||
|
||||
// LogRecordRequest defines the request body for log ingestion.
|
||||
// @Description Log record ingest request
|
||||
type LogRecordRequest struct {
|
||||
Group string `json:"group" example:"default"`
|
||||
MasterID uint `json:"master_id" example:"1"`
|
||||
KeyID uint `json:"key_id" example:"1"`
|
||||
ModelName string `json:"model" example:"gpt-4"`
|
||||
ProviderID uint `json:"provider_id" example:"1"`
|
||||
ProviderType string `json:"provider_type" example:"openai"`
|
||||
ProviderName string `json:"provider_name" example:"openai-prod"`
|
||||
StatusCode int `json:"status_code" example:"200"`
|
||||
LatencyMs int64 `json:"latency_ms" example:"150"`
|
||||
TokensIn int64 `json:"tokens_in" example:"100"`
|
||||
TokensOut int64 `json:"tokens_out" example:"50"`
|
||||
ErrorMessage string `json:"error_message,omitempty"`
|
||||
ClientIP string `json:"client_ip" example:"192.168.1.1"`
|
||||
RequestSize int64 `json:"request_size" example:"1024"`
|
||||
ResponseSize int64 `json:"response_size" example:"2048"`
|
||||
AuditReason string `json:"audit_reason,omitempty"`
|
||||
RequestBody string `json:"request_body,omitempty"`
|
||||
ResponseBody string `json:"response_body,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user