syntax = "v1" import ( "base.api" ) type ( QueryApisReq { PageReq SortReq Path string `form:"path,optional"` Method string `form:"method,optional"` } CreateApiReq { Path string `json:"path" validate:"required" comment:"api路径"` Method string `json:"method" validate:"required" comment:"api请求方法"` Description string `json:"description,optional" comment:"api描述"` } UpdateApiReq { PathId Path string `json:"path" validate:"required" comment:"api路径"` Method string `json:"method" validate:"required" comment:"api请求方法"` Description string `json:"description,optional" comment:"api描述"` } QueryApisReply { PageReply Data []ApiReply `json:"data"` } ApiReply { Id int `json:"id"` Path string `json:"path" comment:"api路径"` Method string `json:"method" comment:"api请求方法"` Description string `json:"description" comment:"api描述"` CreatedAt int64 `json:"createdAt" comment:"创建时间"` // 创建时间 UpdatedAt int64 `json:"updatedAt" comment:"更新时间"` // 更新时间 } ) @server ( jwt: Auth group: api prefix: /api/v1 ) service spherical-api { @doc "查询接口分页列表" @handler queryApis get /apis (QueryApisReq) returns (QueryApisReply) @doc "获取接口详情" @handler getApi get /apis/:id (PathId) returns (ApiReply) @doc "创建接口" @handler createApi post /apis (CreateApiReq) returns (int) @doc "编辑接口" @handler updateApi put /apis/:id (UpdateApiReq) @doc "删除接口" @handler deleteApi delete /apis/:id (PathId) ////////////////////////////////////////////////// @doc "通过权限获取接口列表" @handler listApisOfPermission get /permissions/:id/apis/list (PathId) returns ([]ApiReply) }