110 lines
3.2 KiB
Plaintext
110 lines
3.2 KiB
Plaintext
syntax = "v1"
|
|
import "common.api"
|
|
|
|
type (
|
|
PlayerService {
|
|
Id string `json:"id"`
|
|
PlayerId string `json:"playerId"`
|
|
GameId string `json:"gameId"`
|
|
GameName string `json:"gameName"`
|
|
Title string `json:"title"`
|
|
Description string `json:"description"`
|
|
Price float64 `json:"price"`
|
|
Unit string `json:"unit"`
|
|
RankRange string `json:"rankRange,optional"`
|
|
Availability []string `json:"availability"`
|
|
}
|
|
|
|
PlayerServiceListResp {
|
|
Items []PlayerService `json:"items"`
|
|
Meta PageMeta `json:"meta"`
|
|
}
|
|
|
|
CreateServiceReq {
|
|
GameId string `json:"gameId"`
|
|
Title string `json:"title"`
|
|
Description string `json:"description,optional"`
|
|
Price float64 `json:"price"`
|
|
Unit string `json:"unit"`
|
|
RankRange string `json:"rankRange,optional"`
|
|
Availability []string `json:"availability,optional"`
|
|
}
|
|
|
|
PlayerProfile {
|
|
Id string `json:"id"`
|
|
User UserProfile `json:"user"`
|
|
Rating float64 `json:"rating"`
|
|
TotalOrders int64 `json:"totalOrders"`
|
|
CompletionRate float64 `json:"completionRate"`
|
|
Status string `json:"status"`
|
|
Games []string `json:"games"`
|
|
Services []PlayerService `json:"services"`
|
|
ShopId string `json:"shopId,optional"`
|
|
ShopName string `json:"shopName,optional"`
|
|
Tags []string `json:"tags"`
|
|
}
|
|
|
|
PlayerListReq {
|
|
PageReq
|
|
GameId string `form:"gameId,optional"`
|
|
Gender int `form:"gender,optional"`
|
|
}
|
|
|
|
PlayerListResp {
|
|
Items []PlayerProfile `json:"items"`
|
|
Meta PageMeta `json:"meta"`
|
|
}
|
|
|
|
UpdatePlayerStatusReq {
|
|
Status string `json:"status"`
|
|
}
|
|
)
|
|
|
|
@server(
|
|
prefix: api/v1
|
|
group: player
|
|
)
|
|
service juwan-api {
|
|
@doc "获取打手列表"
|
|
@handler ListPlayers
|
|
get /players (PlayerListReq) returns (PlayerListResp)
|
|
|
|
@doc "获取打手详情"
|
|
@handler GetPlayer
|
|
get /players/:id (EmptyResp) returns (PlayerProfile)
|
|
|
|
@doc "获取所有服务列表"
|
|
@handler ListServices
|
|
get /services (PageReq) returns (PlayerServiceListResp)
|
|
|
|
@doc "获取服务详情"
|
|
@handler GetService
|
|
get /services/:id (EmptyResp) returns (PlayerService)
|
|
|
|
@doc "获取指定打手的服务列表"
|
|
@handler ListPlayerServices
|
|
get /players/:id/services (PageReq) returns (PlayerServiceListResp)
|
|
}
|
|
|
|
@server(
|
|
prefix: api/v1
|
|
group: player
|
|
jwt: Auth
|
|
)
|
|
service juwan-api {
|
|
@doc "更新接单状态"
|
|
@handler UpdatePlayerStatus
|
|
put /players/me/status (UpdatePlayerStatusReq) returns (EmptyResp)
|
|
|
|
@doc "创建服务"
|
|
@handler CreateService
|
|
post /services (CreateServiceReq) returns (PlayerService)
|
|
|
|
@doc "更新服务"
|
|
@handler UpdateService
|
|
put /services/:id (CreateServiceReq) returns (PlayerService)
|
|
|
|
@doc "删除服务"
|
|
@handler DeleteService
|
|
delete /services/:id (EmptyResp) returns (EmptyResp)
|
|
} |