mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
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
32 lines
1.3 KiB
Go
32 lines
1.3 KiB
Go
package dto
|
|
|
|
import "time"
|
|
|
|
// BindingResponse represents a binding in API responses.
|
|
// @Description Binding response
|
|
type BindingResponse struct {
|
|
ID uint `json:"id" example:"1"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Namespace string `json:"namespace" example:"default"`
|
|
PublicModel string `json:"public_model" example:"gpt-4"`
|
|
GroupID uint `json:"group_id" example:"1"`
|
|
Weight int `json:"weight" example:"1"`
|
|
SelectorType string `json:"selector_type" example:"exact"`
|
|
SelectorValue string `json:"selector_value" example:"gpt-4-turbo"`
|
|
Status string `json:"status" example:"active"`
|
|
}
|
|
|
|
// BindingDTO defines inbound payload for binding creation/update.
|
|
// It maps "(namespace, public_model)" to a ProviderGroup and an upstream selector.
|
|
// @Description Binding create/update request
|
|
type BindingDTO struct {
|
|
Namespace string `json:"namespace" example:"default"`
|
|
PublicModel string `json:"public_model" example:"gpt-4"`
|
|
GroupID uint `json:"group_id" example:"1"`
|
|
Weight int `json:"weight" example:"1"`
|
|
SelectorType string `json:"selector_type" example:"exact"`
|
|
SelectorValue string `json:"selector_value" example:"gpt-4-turbo"`
|
|
Status string `json:"status" example:"active"`
|
|
}
|