add: some user api and all api desc
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
syntax = "v1"
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
ChatSession {
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type"` // order, consultation
|
||||
OrderId string `json:"orderId,optional"`
|
||||
Participants []SimpleUser `json:"participants"`
|
||||
LastMessage string `json:"lastMessage"`
|
||||
UnreadCount int `json:"unreadCount"`
|
||||
}
|
||||
|
||||
ChatSessionListResp {
|
||||
Items []ChatSession `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
ChatMessage {
|
||||
Id string `json:"id"`
|
||||
SessionId string `json:"sessionId"`
|
||||
SenderId string `json:"senderId"`
|
||||
Type string `json:"type"` // text, image, system
|
||||
Content string `json:"content"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
ChatMessageListResp {
|
||||
Items []ChatMessage `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
SendMessageReq {
|
||||
Type string `json:"type"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
prefix: api/v1/chat
|
||||
group: chat
|
||||
jwt: Auth
|
||||
)
|
||||
service juwan-api {
|
||||
@doc "获取会话列表"
|
||||
@handler ListSessions
|
||||
get /sessions (PageReq) returns (ChatSessionListResp)
|
||||
|
||||
@doc "获取会话详情"
|
||||
@handler GetSession
|
||||
get /sessions/:id (EmptyResp) returns (ChatSession)
|
||||
|
||||
@doc "获取消息历史"
|
||||
@handler ListMessages
|
||||
get /sessions/:id/messages (PageReq) returns (ChatMessageListResp)
|
||||
|
||||
@doc "发送消息"
|
||||
@handler SendMessage
|
||||
post /sessions/:id/messages (SendMessageReq) returns (ChatMessage)
|
||||
|
||||
@doc "创建/获取订单会话"
|
||||
@handler EnsureOrderSession
|
||||
post /sessions/order (EmptyResp) returns (ChatSession)
|
||||
|
||||
@doc "创建咨询会话"
|
||||
@handler CreateConsultation
|
||||
post /sessions/consultation (EmptyResp) returns (ChatSession)
|
||||
}
|
||||
Reference in New Issue
Block a user