add: some user api and all api desc

This commit is contained in:
wwweww
2026-02-27 19:17:01 +08:00
parent a0c720eb2f
commit 5930fb0dde
156 changed files with 9457 additions and 1086 deletions
+69
View File
@@ -0,0 +1,69 @@
syntax = "v1"
import "common.api"
type (
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 string `json:"targetId"`
}
FavoriteCheckReq {
TargetType string `form:"targetType"`
TargetId string `form:"targetId"`
}
FavoriteCheckResp {
Favorited bool `json:"favorited"`
}
)
@server(
prefix: api/v1
group: search
)
service juwan-api {
@doc "统一搜索"
@handler Search
get /search (SearchReq) returns (SearchResp)
@doc "首页推荐"
@handler Recommendations
get /recommendations/home (PageReq) returns (SearchResp)
}
@server(
prefix: api/v1
group: favorites
jwt: Auth
)
service juwan-api {
@doc "获取收藏列表"
@handler ListFavorites
get /favorites (PageReq) returns (SearchResp)
@doc "添加收藏"
@handler AddFavorite
post /favorites (FavoriteReq) returns (EmptyResp)
@doc "取消收藏"
@handler RemoveFavorite
delete /favorites/:id (EmptyResp) returns (EmptyResp)
@doc "检查收藏状态"
@handler CheckFavorite
get /users/:id/favorites/check (FavoriteCheckReq) returns (FavoriteCheckResp)
}