chat/internal/types/types.go

84 lines
2.0 KiB
Go
Raw Normal View History

2025-12-31 09:36:02 +00:00
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
package types
type AnonLoginReq struct {
Name string `json:"name" required:"required"`
}
type AnonLoginResp struct {
UID string `json:"uid"`
Token string `json:"token"`
CentrifugoToken string `json:"centrifugo_token"` // Centrifugo WebSocket 連線用的 token
RefreshToken string `json:"refresh_token"`
ExpireAt int64 `json:"expire_at"`
}
type AuthHeader struct {
Authorization string `header:"Authorization" binding:"required"`
}
type BaseReq struct {
}
type BaseResp struct {
}
type BaseResponse struct {
Code string `json:"code"` // 狀態碼
Message string `json:"message"` // 訊息
Data interface{} `json:"data,omitempty"` // 資料
Error interface{} `json:"error,omitempty"` // 可選的錯誤信息
}
type ListMessageReq struct {
AuthHeader
RoomID string `path:"room_id"`
PageSize int64 `form:"page_size,default=20"`
PageIndex int64 `form:"page_index,default=1"`
}
type ListMessageResp struct {
Pager Pagination `json:"pager"`
Data []Message `json:"data"`
}
type MatchJoinReq struct {
AuthHeader
}
type MatchJoinResp struct {
Status string `json:"status"` // waiting | matched
}
type MatchStatusResp struct {
Status string `json:"status"` // waiting | matched
RoomID string `json:"room_id,omitempty"`
}
type Message struct {
MessageID string `json:"message_id"`
UID string `json:"uid"`
Content string `json:"content"`
Timestamp int64 `json:"timestamp"`
}
type Pagination struct {
Total int64 `json:"total,example=100"`
Page int64 `json:"page,example=1"`
PageSize int64 `json:"pageSize,example=10"`
TotalPages int64 `json:"totalPages,example=10"`
}
type RefreshTokenReq struct {
Token string `json:"token"` // 舊的 token可以是已過期的
}
type SendMessageReq struct {
AuthHeader
RoomID string `path:"room_id"`
Content string `json:"content"`
ClientMsgID string `json:"client_msg_id"`
}