132 lines
3.4 KiB
Plaintext
132 lines
3.4 KiB
Plaintext
syntax = "v1"
|
|
|
|
info(
|
|
title: "Admin API管理"
|
|
desc: "管理员API管理接口"
|
|
author: "team"
|
|
version: "v1"
|
|
)
|
|
|
|
type (
|
|
// API列表请求
|
|
AdminGetApiListReq {
|
|
Page int64 `form:"page,default=1"`
|
|
PageSize int64 `form:"page_size,default=20"`
|
|
ApiName string `form:"api_name,optional"`
|
|
Method string `form:"method,optional"`
|
|
Status int64 `form:"status,optional"`
|
|
}
|
|
|
|
// API列表响应
|
|
AdminGetApiListResp {
|
|
Items []AdminApiInfo `json:"items"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
|
|
// API信息
|
|
AdminApiInfo {
|
|
Id int64 `json:"id"`
|
|
ApiName string `json:"api_name"`
|
|
ApiCode string `json:"api_code"`
|
|
Method string `json:"method"`
|
|
Url string `json:"url"`
|
|
Status int64 `json:"status"`
|
|
Description string `json:"description"`
|
|
CreateTime string `json:"create_time"`
|
|
UpdateTime string `json:"update_time"`
|
|
}
|
|
|
|
// API详情请求
|
|
AdminGetApiDetailReq {
|
|
Id int64 `path:"id"`
|
|
}
|
|
|
|
// API详情响应
|
|
AdminGetApiDetailResp {
|
|
AdminApiInfo
|
|
}
|
|
|
|
// 创建API请求
|
|
AdminCreateApiReq {
|
|
ApiName string `json:"api_name"`
|
|
ApiCode string `json:"api_code"`
|
|
Method string `json:"method"`
|
|
Url string `json:"url"`
|
|
Status int64 `json:"status,default=1"`
|
|
Description string `json:"description,optional"`
|
|
}
|
|
|
|
// 创建API响应
|
|
AdminCreateApiResp {
|
|
Id int64 `json:"id"`
|
|
}
|
|
|
|
// 更新API请求
|
|
AdminUpdateApiReq {
|
|
Id int64 `path:"id"`
|
|
ApiName string `json:"api_name"`
|
|
ApiCode string `json:"api_code"`
|
|
Method string `json:"method"`
|
|
Url string `json:"url"`
|
|
Status int64 `json:"status"`
|
|
Description string `json:"description,optional"`
|
|
}
|
|
|
|
// 更新API响应
|
|
AdminUpdateApiResp {
|
|
Success bool `json:"success"`
|
|
}
|
|
|
|
// 删除API请求
|
|
AdminDeleteApiReq {
|
|
Id int64 `path:"id"`
|
|
}
|
|
|
|
// 删除API响应
|
|
AdminDeleteApiResp {
|
|
Success bool `json:"success"`
|
|
}
|
|
|
|
// 批量更新API状态请求
|
|
AdminBatchUpdateApiStatusReq {
|
|
Ids []int64 `json:"ids"`
|
|
Status int64 `json:"status"`
|
|
}
|
|
|
|
// 批量更新API状态响应
|
|
AdminBatchUpdateApiStatusResp {
|
|
Success bool `json:"success"`
|
|
}
|
|
)
|
|
|
|
@server (
|
|
prefix: api/v1
|
|
group: admin_api
|
|
middleware: AdminAuthInterceptor
|
|
)
|
|
service main {
|
|
// 获取API列表
|
|
@handler AdminGetApiList
|
|
get /admin/api/list (AdminGetApiListReq) returns (AdminGetApiListResp)
|
|
|
|
// 获取API详情
|
|
@handler AdminGetApiDetail
|
|
get /admin/api/detail/:id (AdminGetApiDetailReq) returns (AdminGetApiDetailResp)
|
|
|
|
// 创建API
|
|
@handler AdminCreateApi
|
|
post /admin/api/create (AdminCreateApiReq) returns (AdminCreateApiResp)
|
|
|
|
// 更新API
|
|
@handler AdminUpdateApi
|
|
put /admin/api/update/:id (AdminUpdateApiReq) returns (AdminUpdateApiResp)
|
|
|
|
// 删除API
|
|
@handler AdminDeleteApi
|
|
delete /admin/api/delete/:id (AdminDeleteApiReq) returns (AdminDeleteApiResp)
|
|
|
|
// 批量更新API状态
|
|
@handler AdminBatchUpdateApiStatus
|
|
put /admin/api/batch-update-status (AdminBatchUpdateApiStatusReq) returns (AdminBatchUpdateApiStatusResp)
|
|
}
|