style: 自动格式化
This commit is contained in:
+53
-56
@@ -1,72 +1,69 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PathIDReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
SearchReq {
|
||||
PageReq
|
||||
Q string `form:"q"`
|
||||
MinPrice float64 `form:"min,optional"`
|
||||
MaxPrice float64 `form:"max,optional"`
|
||||
OnlyOnline bool `form:"onlyOnline,optional"`
|
||||
Sort string `form:"sort,optional"`
|
||||
}
|
||||
|
||||
SearchResp {
|
||||
Items []interface{} `json:"items"` // Mixed items
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
FavoriteReq {
|
||||
TargetType string `json:"targetType"` // player, shop
|
||||
TargetId int64 `json:"targetId"`
|
||||
}
|
||||
|
||||
FavoriteCheckReq {
|
||||
PathIDReq
|
||||
TargetType string `form:"targetType"`
|
||||
TargetId int64 `form:"targetId"`
|
||||
}
|
||||
|
||||
FavoriteCheckResp {
|
||||
Favorited bool `json:"favorited"`
|
||||
}
|
||||
PathIDReq {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
SearchReq {
|
||||
PageReq
|
||||
Q string `form:"q"`
|
||||
MinPrice float64 `form:"min,optional"`
|
||||
MaxPrice float64 `form:"max,optional"`
|
||||
OnlyOnline bool `form:"onlyOnline,optional"`
|
||||
Sort string `form:"sort,optional"`
|
||||
}
|
||||
SearchResp {
|
||||
Items []interface{} `json:"items"` // Mixed items
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
FavoriteReq {
|
||||
TargetType string `json:"targetType"` // player, shop
|
||||
TargetId int64 `json:"targetId"`
|
||||
}
|
||||
FavoriteCheckReq {
|
||||
PathIDReq
|
||||
TargetType string `form:"targetType"`
|
||||
TargetId int64 `form:"targetId"`
|
||||
}
|
||||
FavoriteCheckResp {
|
||||
Favorited bool `json:"favorited"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: search
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: search
|
||||
)
|
||||
service search-api {
|
||||
@doc "统一搜索"
|
||||
@handler Search
|
||||
get /search (SearchReq) returns (SearchResp)
|
||||
@doc "统一搜索"
|
||||
@handler Search
|
||||
get /search (SearchReq) returns (SearchResp)
|
||||
|
||||
@doc "首页推荐"
|
||||
@handler Recommendations
|
||||
get /recommendations/home (PageReq) returns (SearchResp)
|
||||
@doc "首页推荐"
|
||||
@handler Recommendations
|
||||
get /recommendations/home (PageReq) returns (SearchResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: favorites
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: favorites
|
||||
)
|
||||
service search-api {
|
||||
@doc "获取收藏列表"
|
||||
@handler ListFavorites
|
||||
get /favorites (PageReq) returns (SearchResp)
|
||||
@doc "获取收藏列表"
|
||||
@handler ListFavorites
|
||||
get /favorites (PageReq) returns (SearchResp)
|
||||
|
||||
@doc "添加收藏"
|
||||
@handler AddFavorite
|
||||
post /favorites (FavoriteReq) returns (EmptyResp)
|
||||
@doc "添加收藏"
|
||||
@handler AddFavorite
|
||||
post /favorites (FavoriteReq) returns (EmptyResp)
|
||||
|
||||
@doc "取消收藏"
|
||||
@handler RemoveFavorite
|
||||
delete /favorites/:id (PathIDReq) returns (EmptyResp)
|
||||
@doc "取消收藏"
|
||||
@handler RemoveFavorite
|
||||
delete /favorites/:id (PathIDReq) returns (EmptyResp)
|
||||
|
||||
@doc "检查收藏状态"
|
||||
@handler CheckFavorite
|
||||
get /users/:id/favorites/check (FavoriteCheckReq) returns (FavoriteCheckResp)
|
||||
}
|
||||
@doc "检查收藏状态"
|
||||
@handler CheckFavorite
|
||||
get /users/:id/favorites/check (FavoriteCheckReq) returns (FavoriteCheckResp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user