103 lines
5.0 KiB
Go
103 lines
5.0 KiB
Go
package api_feature
|
||
|
||
import (
|
||
"dataengine/consts/api-feature"
|
||
entity "dataengine/model/entity/dict"
|
||
|
||
"gitea.redpowerfuture.com/red-future/common/beans"
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
)
|
||
|
||
// CreateApiInterfaceReq 创建接口请求
|
||
type CreateApiInterfaceReq struct {
|
||
g.Meta `path:"/createApiInterface" method:"post" tags:"接口管理" summary:"创建接口" dc:"创建新的数据接口"`
|
||
PlatformId int64 `json:"platformId" v:"required" dc:"所属平台ID"`
|
||
Name string `json:"name" v:"required" dc:"接口名称"`
|
||
Code string `json:"code" v:"required" dc:"接口编码"`
|
||
Url string `json:"url" v:"required" dc:"接口地址"`
|
||
Method api_feature.ApiMethod `json:"method" v:"required" dc:"请求方法"`
|
||
Status api_feature.PlatformStatus `json:"status" dc:"接口状态" d:"active"`
|
||
AuthType string `json:"authType" dc:"认证类型"`
|
||
RequestConfig map[string]interface{} `json:"requestConfig" dc:"请求配置"`
|
||
ResponseConfig map[string]interface{} `json:"responseConfig" dc:"响应配置"`
|
||
LimitConfig map[string]interface{} `json:"limitConfig" dc:"接口独立限流配置"`
|
||
}
|
||
|
||
// CreateApiInterfaceRes 创建接口响应
|
||
type CreateApiInterfaceRes struct {
|
||
Id int64 `json:"id" dc:"接口ID"`
|
||
}
|
||
|
||
// ListApiInterfaceReq 获取接口列表请求
|
||
type ListApiInterfaceReq struct {
|
||
g.Meta `path:"/listApiInterfaces" method:"get" tags:"接口管理" summary:"获取接口列表" dc:"分页查询接口列表"`
|
||
*beans.Page
|
||
PlatformId int64 `json:"platformId" dc:"平台ID"`
|
||
Name string `json:"name" dc:"接口名称"`
|
||
Code string `json:"code" dc:"接口编码"`
|
||
Method api_feature.ApiMethod `json:"method" dc:"请求方法"`
|
||
Status api_feature.PlatformStatus `json:"status" dc:"接口状态"`
|
||
Keyword string `json:"keyword" dc:"关键字(搜索名称或编码)"`
|
||
}
|
||
|
||
// ListApiInterfaceRes 获取接口列表响应
|
||
type ListApiInterfaceRes struct {
|
||
List []ApiInterfaceItem `json:"list" dc:"接口列表"`
|
||
Total int `json:"total" dc:"总数"`
|
||
}
|
||
|
||
type ApiInterfaceItem struct {
|
||
Id int64 `json:"id,string"`
|
||
PlatformId int64 `json:"platformId"`
|
||
PlatformName string `json:"platformName"`
|
||
Name string `json:"name"`
|
||
Code string `json:"code"`
|
||
Url string `json:"url"`
|
||
Method api_feature.ApiMethod `json:"method"`
|
||
Status api_feature.PlatformStatus `json:"status"`
|
||
StatusName string `json:"statusName"`
|
||
CreatedAt int64 `json:"createdAt"`
|
||
UpdatedAt int64 `json:"updatedAt"`
|
||
}
|
||
|
||
// GetApiInterfaceReq 获取接口详情请求
|
||
type GetApiInterfaceReq struct {
|
||
g.Meta `path:"/getApiInterface" method:"get" tags:"接口管理" summary:"获取接口详情" dc:"获取接口详情"`
|
||
Id int64 `json:"id" v:"required" dc:"接口ID"`
|
||
}
|
||
|
||
// GetApiInterfaceRes 获取接口详情响应
|
||
type GetApiInterfaceRes struct {
|
||
*entity.ApiInterface
|
||
PlatformName string `json:"platformName,omitempty"`
|
||
}
|
||
|
||
// UpdateApiInterfaceReq 更新接口请求
|
||
type UpdateApiInterfaceReq struct {
|
||
g.Meta `path:"/updateApiInterface" method:"put" tags:"接口管理" summary:"更新接口" dc:"更新接口信息"`
|
||
Id int64 `json:"id" v:"required" dc:"接口ID"`
|
||
PlatformId int64 `json:"platformId" dc:"所属平台ID"`
|
||
Name string `json:"name" dc:"接口名称"`
|
||
Code string `json:"code" dc:"接口编码"`
|
||
Url string `json:"url" dc:"接口地址"`
|
||
Method api_feature.ApiMethod `json:"method" dc:"请求方法"`
|
||
Status api_feature.PlatformStatus `json:"status,omitempty" dc:"接口状态"`
|
||
AuthType string `json:"authType" dc:"认证类型"`
|
||
RequestConfig map[string]interface{} `json:"requestConfig" dc:"请求配置"`
|
||
ResponseConfig map[string]interface{} `json:"responseConfig" dc:"响应配置"`
|
||
LimitConfig map[string]interface{} `json:"limitConfig" dc:"接口独立限流配置"`
|
||
}
|
||
|
||
// DeleteApiInterfaceReq 删除接口请求
|
||
type DeleteApiInterfaceReq struct {
|
||
g.Meta `path:"/deleteApiInterface" method:"delete" tags:"接口管理" summary:"删除接口" dc:"删除接口"`
|
||
Id int64 `json:"id" v:"required" dc:"接口ID"`
|
||
}
|
||
|
||
// UpdateApiInterfaceStatusReq 更新接口状态请求
|
||
type UpdateApiInterfaceStatusReq struct {
|
||
g.Meta `path:"/updateApiInterfaceStatus" method:"put" tags:"接口管理" summary:"更新接口状态" dc:"更新接口状态"`
|
||
Id int64 `json:"id" v:"required" dc:"接口ID"`
|
||
Status api_feature.PlatformStatus `json:"status" v:"required|in:active,inactive" dc:"状态:active启用/inactive停用"`
|
||
}
|