style: 自动格式化

This commit is contained in:
zetaloop
2026-04-25 04:53:15 +08:00
parent e9bb8fd8e3
commit 111c2f59dd
15 changed files with 333 additions and 337 deletions
+57 -63
View File
@@ -1,76 +1,70 @@
syntax = "v1"
import "common.api"
type (
SessionIdReq {
Id int64 `path:"id"`
}
CreateGroupReq {
Name string `json:"name"`
Participants []int64 `json:"participants,optional"`
}
CreateDMReq {
TargetId int64 `json:"targetId"`
}
ChatSession {
Id int64 `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
CreatorId int64 `json:"creatorId"`
Participants []int64 `json:"participants"`
LastMessage string `json:"lastMessage"`
LastMessageAt int64 `json:"lastMessageAt"`
CreatedAt int64 `json:"createdAt"`
}
ChatSessionListResp {
Items []ChatSession `json:"items"`
}
ChatMessage {
Id int64 `json:"id"`
SessionId int64 `json:"sessionId"`
SenderId int64 `json:"senderId"`
Type string `json:"type"`
Content string `json:"content"`
CreatedAt int64 `json:"createdAt"`
}
ChatMessageListResp {
Items []ChatMessage `json:"items"`
}
ListMessageReq {
SessionIdReq
PageReq
}
SessionIdReq {
Id int64 `path:"id"`
}
CreateGroupReq {
Name string `json:"name"`
Participants []int64 `json:"participants,optional"`
}
CreateDMReq {
TargetId int64 `json:"targetId"`
}
ChatSession {
Id int64 `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
CreatorId int64 `json:"creatorId"`
Participants []int64 `json:"participants"`
LastMessage string `json:"lastMessage"`
LastMessageAt int64 `json:"lastMessageAt"`
CreatedAt int64 `json:"createdAt"`
}
ChatSessionListResp {
Items []ChatSession `json:"items"`
}
ChatMessage {
Id int64 `json:"id"`
SessionId int64 `json:"sessionId"`
SenderId int64 `json:"senderId"`
Type string `json:"type"`
Content string `json:"content"`
CreatedAt int64 `json:"createdAt"`
}
ChatMessageListResp {
Items []ChatMessage `json:"items"`
}
ListMessageReq {
SessionIdReq
PageReq
}
)
@server(
prefix: api/v1/chat
group: chat
@server (
prefix: api/v1/chat
group: chat
)
service chat-api {
@doc "create group session"
@handler CreateGroup
post /sessions/group (CreateGroupReq) returns (ChatSession)
@doc "create group session"
@handler CreateGroup
post /sessions/group (CreateGroupReq) returns (ChatSession)
@doc "create dm session"
@handler CreateDM
post /sessions/dm (CreateDMReq) returns (ChatSession)
@doc "create dm session"
@handler CreateDM
post /sessions/dm (CreateDMReq) returns (ChatSession)
@doc "list user sessions"
@handler ListSessions
get /sessions (PageReq) returns (ChatSessionListResp)
@doc "list user sessions"
@handler ListSessions
get /sessions (PageReq) returns (ChatSessionListResp)
@doc "get session detail"
@handler GetSession
get /sessions/:id (SessionIdReq) returns (ChatSession)
@doc "get session detail"
@handler GetSession
get /sessions/:id (SessionIdReq) returns (ChatSession)
@doc "get message history"
@handler ListMessages
get /sessions/:id/messages (ListMessageReq) returns (ChatMessageListResp)
@doc "get message history"
@handler ListMessages
get /sessions/:id/messages (ListMessageReq) returns (ChatMessageListResp)
}