From 0435915df1702611864caf224139a577ce4df9d0 Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Thu, 12 Dec 2024 12:13:04 +0800 Subject: [PATCH] feat: support quote ContentType in SendMsg. (#2819) --- internal/api/msg.go | 2 ++ pkg/apistruct/msg.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/internal/api/msg.go b/internal/api/msg.go index ce94b5f4f..9f79067a8 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -173,6 +173,8 @@ func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendM data = apistruct.AtElem{} case constant.Custom: data = apistruct.CustomElem{} + case constant.Quote: + data = apistruct.QuoteElem{} case constant.Stream: data = apistruct.StreamMsgElem{} case constant.OANotification: diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index dda3ff317..44f157b6d 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -14,6 +14,8 @@ package apistruct +import "github.com/openimsdk/protocol/sdkws" + type PictureBaseInfo struct { UUID string `mapstructure:"uuid"` Type string `mapstructure:"type" validate:"required"` @@ -90,6 +92,11 @@ type RevokeElem struct { RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"` } +type QuoteElem struct { + Text string `json:"text,omitempty"` + QuoteMessage *MsgStruct `json:"quoteMessage,omitempty"` +} + type OANotificationElem struct { NotificationName string `mapstructure:"notificationName" json:"notificationName" validate:"required"` NotificationFaceURL string `mapstructure:"notificationFaceURL" json:"notificationFaceURL"` @@ -103,6 +110,7 @@ type OANotificationElem struct { FileElem *FileElem `mapstructure:"fileElem" json:"fileElem"` Ex string `mapstructure:"ex" json:"ex"` } + type MessageRevoked struct { RevokerID string `mapstructure:"revokerID" json:"revokerID" validate:"required"` RevokerRole int32 `mapstructure:"revokerRole" json:"revokerRole" validate:"required"` @@ -111,3 +119,38 @@ type MessageRevoked struct { SessionType int32 `mapstructure:"sessionType" json:"sessionType" validate:"required"` Seq uint32 `mapstructure:"seq" json:"seq" validate:"required"` } + +type MsgStruct struct { + ClientMsgID string `json:"clientMsgID,omitempty"` + ServerMsgID string `json:"serverMsgID,omitempty"` + CreateTime int64 `json:"createTime"` + SendTime int64 `json:"sendTime"` + SessionType int32 `json:"sessionType"` + SendID string `json:"sendID,omitempty"` + RecvID string `json:"recvID,omitempty"` + MsgFrom int32 `json:"msgFrom"` + ContentType int32 `json:"contentType"` + SenderPlatformID int32 `json:"senderPlatformID"` + SenderNickname string `json:"senderNickname,omitempty"` + SenderFaceURL string `json:"senderFaceUrl,omitempty"` + GroupID string `json:"groupID,omitempty"` + Content string `json:"content,omitempty"` + Seq int64 `json:"seq"` + IsRead bool `json:"isRead"` + Status int32 `json:"status"` + IsReact bool `json:"isReact,omitempty"` + IsExternalExtensions bool `json:"isExternalExtensions,omitempty"` + OfflinePush *sdkws.OfflinePushInfo `json:"offlinePush,omitempty"` + AttachedInfo string `json:"attachedInfo,omitempty"` + Ex string `json:"ex,omitempty"` + LocalEx string `json:"localEx,omitempty"` + TextElem *TextElem `json:"textElem,omitempty"` + PictureElem *PictureElem `json:"pictureElem,omitempty"` + SoundElem *SoundElem `json:"soundElem,omitempty"` + VideoElem *VideoElem `json:"videoElem,omitempty"` + FileElem *FileElem `json:"fileElem,omitempty"` + AtTextElem *AtElem `json:"atTextElem,omitempty"` + LocationElem *LocationElem `json:"locationElem,omitempty"` + CustomElem *CustomElem `json:"customElem,omitempty"` + QuoteElem *QuoteElem `json:"quoteElem,omitempty"` +}