This commit is contained in:
wangchuxiao
2023-02-09 16:11:18 +08:00
parent 1075754458
commit ccc7e6b3c8
73 changed files with 153 additions and 160 deletions
+65
View File
@@ -0,0 +1,65 @@
package callbackstruct
import (
"Open_IM/pkg/common/constant"
"fmt"
)
type CommonCallbackReq struct {
SendID string `json:"sendID"`
CallbackCommand string `json:"callbackCommand"`
ServerMsgID string `json:"serverMsgID"`
ClientMsgID string `json:"clientMsgID"`
OperationID string `json:"operationID"`
SenderPlatformID int32 `json:"senderPlatformID"`
SenderNickname string `json:"senderNickname"`
SessionType int32 `json:"sessionType"`
MsgFrom int32 `json:"msgFrom"`
ContentType int32 `json:"contentType"`
Status int32 `json:"status"`
CreateTime int64 `json:"createTime"`
Content string `json:"content"`
Seq uint32 `json:"seq"`
AtUserIDList []string `json:"atUserList"`
SenderFaceURL string `json:"faceURL"`
Ex string `json:"ex"`
}
type CallbackResp interface {
Parse() (err error)
}
type CommonCallbackResp struct {
ActionCode int `json:"actionCode"`
ErrCode int32 `json:"errCode"`
ErrMsg string `json:"errMsg"`
OperationID string `json:"operationID"`
}
func (c *CommonCallbackResp) Parse() (err error) {
if c.ActionCode != constant.NoError || c.ErrCode != constant.NoError {
newErr := constant.ErrCallback
newErr.ErrCode = c.ErrCode
newErr.DetailErrMsg = fmt.Sprintf("callback response error actionCode is %d, errCode is %d, errMsg is %s", c.ActionCode, c.ErrCode, c.ErrMsg)
err = newErr
return
}
return
}
type UserStatusBaseCallback struct {
CallbackCommand string `json:"callbackCommand"`
OperationID string `json:"operationID"`
PlatformID int32 `json:"platformID"`
Platform string `json:"platform"`
}
type UserStatusCallbackReq struct {
UserStatusBaseCallback
UserID string `json:"userID"`
}
type UserStatusBatchCallbackReq struct {
UserStatusBaseCallback
UserIDList []string `json:"userIDList"`
}
+13
View File
@@ -0,0 +1,13 @@
package callbackstruct
type CallbackBeforeAddFriendReq struct {
CallbackCommand string `json:"callbackCommand"`
FromUserID string `json:"fromUserID" `
ToUserID string `json:"toUserID"`
ReqMsg string `json:"reqMsg"`
OperationID string `json:"operationID"`
}
type CallbackBeforeAddFriendResp struct {
*CommonCallbackResp
}
+67
View File
@@ -0,0 +1,67 @@
package callbackstruct
import (
"Open_IM/pkg/proto/group"
common "Open_IM/pkg/proto/sdk_ws"
)
type CallbackBeforeCreateGroupReq struct {
CallbackCommand string `json:"callbackCommand"`
OperationID string `json:"operationID"`
common.GroupInfo
InitMemberList []*group.GroupAddMemberInfo `json:"initMemberList"`
}
type CallbackBeforeCreateGroupResp struct {
*CommonCallbackResp
GroupID *string `json:"groupID"`
GroupName *string `json:"groupName"`
Notification *string `json:"notification"`
Introduction *string `json:"introduction"`
FaceURL *string `json:"faceURL"`
OwnerUserID *string `json:"ownerUserID"`
Ex *string `json:"ex"`
Status *int32 `json:"status"`
CreatorUserID *string `json:"creatorUserID"`
GroupType *int32 `json:"groupType"`
NeedVerification *int32 `json:"needVerification"`
LookMemberInfo *int32 `json:"lookMemberInfo"`
ApplyMemberFriend *int32 `json:"applyMemberFriend"`
}
type CallbackBeforeMemberJoinGroupReq struct {
CallbackCommand string `json:"callbackCommand"`
OperationID string `json:"operationID"`
GroupID string `json:"groupID"`
UserID string `json:"userID"`
Ex string `json:"ex"`
GroupEx string `json:"groupEx"`
}
type CallbackBeforeMemberJoinGroupResp struct {
*CommonCallbackResp
NickName *string `json:"nickName"`
FaceURL *string `json:"faceURL"`
RoleLevel *int32 `json:"roleLevel"`
MuteEndTime *int64 `json:"muteEndTime"`
Ex *string `json:"ex"`
}
type CallbackBeforeSetGroupMemberInfoReq struct {
CallbackCommand string `json:"callbackCommand"`
OperationID string `json:"operationID"`
GroupID string `json:"groupID"`
UserID string `json:"userID"`
Nickname string `json:"nickName"`
FaceURL string `json:"faceURL"`
RoleLevel int32 `json:"roleLevel"`
Ex string `json:"ex"`
}
type CallbackBeforeSetGroupMemberInfoResp struct {
*CommonCallbackResp
Ex *string `json:"ex"`
Nickname *string `json:"nickName"`
FaceURL *string `json:"faceURL"`
RoleLevel *int32 `json:"roleLevel"`
}
+101
View File
@@ -0,0 +1,101 @@
package callbackstruct
import (
"Open_IM/pkg/proto/msg"
sdk_ws "Open_IM/pkg/proto/sdk_ws"
)
type CallbackBeforeSendSingleMsgReq struct {
CommonCallbackReq
RecvID string `json:"recvID"`
}
type CallbackBeforeSendSingleMsgResp struct {
*CommonCallbackResp
}
type CallbackAfterSendSingleMsgReq struct {
CommonCallbackReq
RecvID string `json:"recvID"`
}
type CallbackAfterSendSingleMsgResp struct {
*CommonCallbackResp
}
type CallbackBeforeSendGroupMsgReq struct {
CommonCallbackReq
GroupID string `json:"groupID"`
}
type CallbackBeforeSendGroupMsgResp struct {
*CommonCallbackResp
}
type CallbackAfterSendGroupMsgReq struct {
CommonCallbackReq
GroupID string `json:"groupID"`
}
type CallbackAfterSendGroupMsgResp struct {
*CommonCallbackResp
}
type CallbackMsgModifyCommandReq struct {
CommonCallbackReq
}
type CallbackMsgModifyCommandResp struct {
*CommonCallbackResp
Content *string `json:"content"`
RecvID *string `json:"recvID"`
GroupID *string `json:"groupID"`
ClientMsgID *string `json:"clientMsgID"`
ServerMsgID *string `json:"serverMsgID"`
SenderPlatformID *int32 `json:"senderPlatformID"`
SenderNickname *string `json:"senderNickname"`
SenderFaceURL *string `json:"senderFaceURL"`
SessionType *int32 `json:"sessionType"`
MsgFrom *int32 `json:"msgFrom"`
ContentType *int32 `json:"contentType"`
Status *int32 `json:"status"`
Options *map[string]bool `json:"options"`
OfflinePushInfo *sdk_ws.OfflinePushInfo `json:"offlinePushInfo"`
AtUserIDList *[]string `json:"atUserIDList"`
MsgDataList *[]byte `json:"msgDataList"`
AttachedInfo *string `json:"attachedInfo"`
Ex *string `json:"ex"`
}
type CallbackBeforeSetMessageReactionExtReq struct {
OperationID string `json:"operationID"`
CallbackCommand string `json:"callbackCommand"`
SourceID string `json:"sourceID"`
OpUserID string `json:"opUserID"`
SessionType int32 `json:"sessionType"`
ReactionExtensionList map[string]*sdk_ws.KeyValue `json:"reactionExtensionList"`
ClientMsgID string `json:"clientMsgID"`
IsReact bool `json:"isReact"`
IsExternalExtensions bool `json:"isExternalExtensions"`
MsgFirstModifyTime int64 `json:"msgFirstModifyTime"`
}
type CallbackBeforeSetMessageReactionExtResp struct {
*CommonCallbackResp
ResultReactionExtensionList []*msg.KeyValueResp `json:"resultReactionExtensionList"`
MsgFirstModifyTime int64 `json:"msgFirstModifyTime"`
}
type CallbackDeleteMessageReactionExtReq struct {
OperationID string `json:"operationID"`
CallbackCommand string `json:"callbackCommand"`
SourceID string `json:"sourceID"`
OpUserID string `json:"opUserID"`
SessionType int32 `json:"sessionType"`
ReactionExtensionList []*sdk_ws.KeyValue `json:"reactionExtensionList"`
ClientMsgID string `json:"clientMsgID"`
IsExternalExtensions bool `json:"isExternalExtensions"`
MsgFirstModifyTime int64 `json:"msgFirstModifyTime"`
}
type CallbackDeleteMessageReactionExtResp struct {
*CommonCallbackResp
ResultReactionExtensionList []*msg.KeyValueResp `json:"resultReactionExtensionList"`
MsgFirstModifyTime int64 `json:"msgFirstModifyTime"`
}
+32
View File
@@ -0,0 +1,32 @@
package callbackstruct
type CallbackUserOnlineReq struct {
UserStatusCallbackReq
Token string `json:"token"`
Seq int `json:"seq"`
IsAppBackground bool `json:"isAppBackground"`
ConnID string `json:"connID"`
}
type CallbackUserOnlineResp struct {
*CommonCallbackResp
}
type CallbackUserOfflineReq struct {
UserStatusCallbackReq
Seq int `json:"seq"`
ConnID string `json:"connID"`
}
type CallbackUserOfflineResp struct {
*CommonCallbackResp
}
type CallbackUserKickOffReq struct {
UserStatusCallbackReq
Seq int `json:"seq"`
}
type CallbackUserKickOffResp struct {
*CommonCallbackResp
}
+40
View File
@@ -0,0 +1,40 @@
package callbackstruct
import common "Open_IM/pkg/proto/sdk_ws"
type CallbackBeforePushReq struct {
UserStatusBatchCallbackReq
*common.OfflinePushInfo
ClientMsgID string `json:"clientMsgID"`
SendID string `json:"sendID"`
GroupID string `json:"groupID"`
ContentType int32 `json:"contentType"`
SessionType int32 `json:"sessionType"`
AtUserIDList []string `json:"atUserIDList"`
Content string `json:"content"`
}
type CallbackBeforePushResp struct {
*CommonCallbackResp
UserIDList []string `json:"userIDList"`
OfflinePushInfo *common.OfflinePushInfo `json:"offlinePushInfo"`
}
type CallbackBeforeSuperGroupOnlinePushReq struct {
//*common.OfflinePushInfo
UserStatusBaseCallback
ClientMsgID string `json:"clientMsgID"`
SendID string `json:"sendID"`
GroupID string `json:"groupID"`
ContentType int32 `json:"contentType"`
SessionType int32 `json:"sessionType"`
AtUserIDList []string `json:"atUserIDList"`
Content string `json:"content"`
Seq uint32 `json:"seq"`
}
type CallbackBeforeSuperGroupOnlinePushResp struct {
*CommonCallbackResp
UserIDList []string `json:"userIDList"`
OfflinePushInfo *common.OfflinePushInfo `json:"offlinePushInfo"`
}