42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package responses
|
|
|
|
import (
|
|
"time"
|
|
|
|
"tyapi-server/internal/domains/product/entities"
|
|
)
|
|
|
|
// DocumentationResponse 文档响应
|
|
type DocumentationResponse struct {
|
|
ID string `json:"id"`
|
|
ProductID string `json:"product_id"`
|
|
RequestURL string `json:"request_url"`
|
|
RequestMethod string `json:"request_method"`
|
|
BasicInfo string `json:"basic_info"`
|
|
RequestParams string `json:"request_params"`
|
|
ResponseFields string `json:"response_fields"`
|
|
ResponseExample string `json:"response_example"`
|
|
ErrorCodes string `json:"error_codes"`
|
|
Version string `json:"version"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// NewDocumentationResponse 从实体创建响应
|
|
func NewDocumentationResponse(doc *entities.ProductDocumentation) DocumentationResponse {
|
|
return DocumentationResponse{
|
|
ID: doc.ID,
|
|
ProductID: doc.ProductID,
|
|
RequestURL: doc.RequestURL,
|
|
RequestMethod: doc.RequestMethod,
|
|
BasicInfo: doc.BasicInfo,
|
|
RequestParams: doc.RequestParams,
|
|
ResponseFields: doc.ResponseFields,
|
|
ResponseExample: doc.ResponseExample,
|
|
ErrorCodes: doc.ErrorCodes,
|
|
Version: doc.Version,
|
|
CreatedAt: doc.CreatedAt,
|
|
UpdatedAt: doc.UpdatedAt,
|
|
}
|
|
}
|