diff --git a/pkg/api_struct/aws.go b/pkg/api_struct/aws.go new file mode 100644 index 000000000..0479080e4 --- /dev/null +++ b/pkg/api_struct/aws.go @@ -0,0 +1,20 @@ +package api_struct + +type AwsStorageCredentialReq struct { + OperationID string `json:"operationID"` +} + +type AwsStorageCredentialRespData struct { + AccessKeyId string `json:"accessKeyID"` + SecretAccessKey string `json:"secretAccessKey"` + SessionToken string `json:"sessionToken"` + RegionID string `json:"regionId"` + Bucket string `json:"bucket"` + FinalHost string `json:"FinalHost"` +} + +type AwsStorageCredentialResp struct { + CommResp + CosData AwsStorageCredentialRespData + Data map[string]interface{} `json:"data"` +} diff --git a/pkg/api_struct/conversation.go b/pkg/api_struct/conversation.go new file mode 100644 index 000000000..da4b5ced9 --- /dev/null +++ b/pkg/api_struct/conversation.go @@ -0,0 +1,130 @@ +package api_struct + +type OptResult struct { + ConversationID string `json:"conversationID"` + Result *int32 `json:"result"` +} +type GetAllConversationMessageOptReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetAllConversationMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} +type GetReceiveMessageOptReq struct { + ConversationIDList []string `json:"conversationIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetReceiveMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} +type SetReceiveMessageOptReq struct { + FromUserID string `json:"fromUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + Opt *int32 `json:"opt" binding:"required"` + ConversationIDList []string `json:"conversationIDList" binding:"required"` +} +type SetReceiveMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} + +type Conversation struct { + OwnerUserID string `json:"ownerUserID" binding:"required"` + ConversationID string `json:"conversationID" binding:"required"` + ConversationType int32 `json:"conversationType" binding:"required"` + UserID string `json:"userID"` + GroupID string `json:"groupID"` + RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` + UnreadCount int32 `json:"unreadCount" binding:"omitempty"` + DraftTextTime int64 `json:"draftTextTime"` + IsPinned bool `json:"isPinned" binding:"omitempty"` + IsPrivateChat bool `json:"isPrivateChat"` + BurnDuration int32 `json:"burnDuration"` + GroupAtType int32 `json:"groupAtType"` + IsNotInGroup bool `json:"isNotInGroup"` + UpdateUnreadCountTime int64 `json:"updateUnreadCountTime"` + AttachedInfo string `json:"attachedInfo"` + Ex string `json:"ex"` +} + +type SetConversationReq struct { + Conversation + NotificationType int32 `json:"notificationType"` + OperationID string `json:"operationID" binding:"required"` +} + +type SetConversationResp struct { + CommResp +} +type ModifyConversationFieldReq struct { + Conversation + FieldType int32 `json:"fieldType" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type ModifyConversationFieldResp struct { + CommResp +} + +type BatchSetConversationsReq struct { + Conversations []Conversation `json:"conversations" binding:"required"` + NotificationType int32 `json:"notificationType"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type BatchSetConversationsResp struct { + CommResp + Data struct { + Success []string `json:"success"` + Failed []string `json:"failed"` + } `json:"data"` +} + +type GetConversationReq struct { + ConversationID string `json:"conversationID" binding:"required"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetConversationResp struct { + CommResp + Conversation Conversation `json:"data"` +} + +type GetAllConversationsReq struct { + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetAllConversationsResp struct { + CommResp + Conversations []Conversation `json:"data"` +} + +type GetConversationsReq struct { + ConversationIDs []string `json:"conversationIDs" binding:"required"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetConversationsResp struct { + CommResp + Conversations []Conversation `json:"data"` +} + +type SetRecvMsgOptReq struct { + OwnerUserID string `json:"ownerUserID" binding:"required"` + ConversationID string `json:"conversationID"` + RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` + OperationID string `json:"operationID" binding:"required"` + NotificationType int32 `json:"notificationType"` +} + +type SetRecvMsgOptResp struct { + CommResp +} diff --git a/pkg/api_struct/cos.go b/pkg/api_struct/cos.go new file mode 100644 index 000000000..0c9e92a5b --- /dev/null +++ b/pkg/api_struct/cos.go @@ -0,0 +1,20 @@ +package api_struct + +import sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" + +type TencentCloudStorageCredentialReq struct { + OperationID string `json:"operationID"` +} + +type TencentCloudStorageCredentialRespData struct { + *sts.CredentialResult + Region string `json:"region"` + Bucket string `json:"bucket"` +} + +type TencentCloudStorageCredentialResp struct { + CommResp + CosData TencentCloudStorageCredentialRespData `json:"-"` + + Data map[string]interface{} `json:"data"` +} diff --git a/pkg/api_struct/friend.go b/pkg/api_struct/friend.go new file mode 100644 index 000000000..b89ba3208 --- /dev/null +++ b/pkg/api_struct/friend.go @@ -0,0 +1,273 @@ +package api_struct + +//type ParamsCommFriend struct { +// OperationID string `json:"operationID" binding:"required"` +// ToUserID string `json:"toUserID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +// +//type AddBlacklistReq struct { +// ParamsCommFriend +//} +//type AddBlacklistResp struct { +// CommResp +//} +// +//type ImportFriendReq struct { +// FriendUserIDList []string `json:"friendUserIDList" binding:"required"` +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type UserIDResult struct { +// UserID string `json:"userID"` +// Result int32 `json:"result"` +//} +//type ImportFriendResp struct { +// CommResp +// UserIDResultList []UserIDResult `json:"data"` +//} +// +//type AddFriendReq struct { +// ParamsCommFriend +// ReqMsg string `json:"reqMsg"` +//} +//type AddFriendResp struct { +// CommResp +//} +// +//type AddFriendResponseReq struct { +// ParamsCommFriend +// Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` +// HandleMsg string `json:"handleMsg"` +//} +//type AddFriendResponseResp struct { +// CommResp +//} +// +//type DeleteFriendReq struct { +// ParamsCommFriend +//} +//type DeleteFriendResp struct { +// CommResp +//} +// +//type GetBlackListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetBlackListResp struct { +// CommResp +// BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +////type PublicUserInfo struct { +//// UserID string `json:"userID"` +//// Nickname string `json:"nickname"` +//// FaceUrl string `json:"faceUrl"` +//// Gender int32 `json:"gender"` +////} +// +//type SetFriendRemarkReq struct { +// ParamsCommFriend +// Remark string `json:"remark"` +//} +//type SetFriendRemarkResp struct { +// CommResp +//} +// +//type RemoveBlacklistReq struct { +// ParamsCommFriend +//} +//type RemoveBlacklistResp struct { +// CommResp +//} +// +//type IsFriendReq struct { +// ParamsCommFriend +//} +//type Response struct { +// Friend bool `json:"isFriend"` +//} +//type IsFriendResp struct { +// CommResp +// Response Response `json:"data"` +//} +// +//type GetFriendsInfoReq struct { +// ParamsCommFriend +//} +//type GetFriendsInfoResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendListResp struct { +// CommResp +// FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetFriendApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetFriendApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} +// +//type GetSelfApplyListReq struct { +// OperationID string `json:"operationID" binding:"required"` +// FromUserID string `json:"fromUserID" binding:"required"` +//} +//type GetSelfApplyListResp struct { +// CommResp +// FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} + +type FriendInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type PublicUserInfo struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + Ex string `json:"ex"` +} + +type FriendRequest struct { + FromUserID string `json:"fromUserID"` + FromNickname string `json:"fromNickname"` + FromFaceURL string `json:"fromFaceURL"` + FromGender int32 `json:"fromGender"` + ToUserID string `json:"toUserID"` + ToNickname string `json:"toNickname"` + ToFaceURL string `json:"toFaceURL"` + ToGender int32 `json:"toGender"` + HandleResult int32 `json:"handleResult"` + ReqMsg string `json:"reqMsg"` + CreateTime uint32 `json:"createTime"` + HandlerUserID string `json:"handlerUserID"` + HandleMsg string `json:"handleMsg"` + HandleTime uint32 `json:"handleTime"` + Ex string `json:"ex"` +} + +type AddBlacklistReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type AddBlacklistResp struct { +} + +type ImportFriendReq struct { + FriendUserIDList []string `json:"friendUserIDList" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} + +type ImportFriendResp struct { + //CommResp +} + +type AddFriendReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + ReqMsg string `json:"reqMsg"` +} +type AddFriendResp struct { + //CommResp +} + +type AddFriendResponseReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"` + HandleMsg string `json:"handleMsg"` +} +type AddFriendResponseResp struct { +} + +type DeleteFriendReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type DeleteFriendResp struct { +} + +type GetBlackListReq struct { + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetBlackListResp struct { + BlackUserInfoList []PublicUserInfo `json:"blackUserInfoList"` +} + +type SetFriendRemarkReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + Remark string `json:"remark"` +} +type SetFriendRemarkResp struct { +} + +type RemoveBlacklistReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type RemoveBlacklistResp struct { +} + +type IsFriendReq struct { + ToUserID string `json:"toUserID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type Response struct { + Friend bool `json:"isFriend"` +} +type IsFriendResp struct { + Response Response `json:"data"` +} + +type GetFriendListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetFriendListResp struct { + OwnerUserID string `json:"ownerUserID"` + Remark string `json:"remark"` + CreateTime uint32 `json:"createTime"` + AddSource int32 `json:"addSource"` + OperatorUserID string `json:"operatorUserID"` + Ex string `json:"ex"` + //FriendUser *UserInfo // TODO +} + +type GetFriendApplyListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} + +type GetFriendApplyListResp struct { + FriendRequestList []FriendRequest `json:"friendRequestList"` +} + +type GetSelfApplyListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetSelfApplyListResp struct { + FriendRequestList []FriendRequest `json:"friendRequestList"` +} diff --git a/pkg/api_struct/group.go b/pkg/api_struct/group.go new file mode 100644 index 000000000..b15458d79 --- /dev/null +++ b/pkg/api_struct/group.go @@ -0,0 +1,301 @@ +package api_struct + +import ( + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +type CommResp struct { + ErrCode int32 `json:"errCode"` + ErrMsg string `json:"errMsg"` +} + +type CommDataResp struct { + CommResp + Data []map[string]interface{} `json:"data"` +} + +type KickGroupMemberReq struct { + GroupID string `json:"groupID" binding:"required"` + KickedUserIDList []string `json:"kickedUserIDList" binding:"required"` + Reason string `json:"reason"` + OperationID string `json:"operationID" binding:"required"` +} +type KickGroupMemberResp struct { + CommResp + UserIDResultList []*UserIDResult `json:"data"` +} + +type GetGroupMembersInfoReq struct { + GroupID string `json:"groupID" binding:"required"` + MemberList []string `json:"memberList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetGroupMembersInfoResp struct { + CommResp + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type InviteUserToGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + InvitedUserIDList []string `json:"invitedUserIDList" binding:"required"` + Reason string `json:"reason"` + OperationID string `json:"operationID" binding:"required"` +} +type InviteUserToGroupResp struct { + CommResp + UserIDResultList []*UserIDResult `json:"data"` +} + +type GetJoinedGroupListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetJoinedGroupListResp struct { + CommResp + GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetGroupMemberListReq struct { + GroupID string `json:"groupID"` + Filter int32 `json:"filter"` + NextSeq int32 `json:"nextSeq"` + OperationID string `json:"operationID"` +} +type GetGroupMemberListResp struct { + CommResp + NextSeq int32 `json:"nextSeq"` + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetGroupAllMemberReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + Offset int32 `json:"offset"` + Count int32 `json:"count"` +} +type GetGroupAllMemberResp struct { + CommResp + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +// +//type GetGroupAllMemberListBySplitReq struct { +// GroupID string `json:"groupID" binding:"required"` +// OperationID string `json:"operationID" binding:"required"` +// Offset int32 `json:"offset" binding:"required"` +// Count int32 `json:"count" binding:"required"` +//} +//type GetGroupAllMemberListBySplitResp struct { +// CommResp +// MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` +// Data []map[string]interface{} `json:"data" swaggerignore:"true"` +//} + +type CreateGroupReq struct { + MemberList []*GroupAddMemberInfo `json:"memberList"` + OwnerUserID string `json:"ownerUserID"` + GroupType int32 `json:"groupType"` + GroupName string `json:"groupName"` + Notification string `json:"notification"` + Introduction string `json:"introduction"` + FaceURL string `json:"faceURL"` + Ex string `json:"ex"` + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID"` +} +type CreateGroupResp struct { + CommResp + GroupInfo open_im_sdk.GroupInfo `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetGroupApplicationListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` //作为管理员或群主收到的 进群申请 +} +type GetGroupApplicationListResp struct { + CommResp + GroupRequestList []*open_im_sdk.GroupRequest `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetUserReqGroupApplicationListReq struct { + OperationID string `json:"operationID" binding:"required"` + UserID string `json:"userID" binding:"required"` +} + +type GetUserRespGroupApplicationResp struct { + GroupRequestList []*open_im_sdk.GroupRequest `json:"data"` +} + +type GetGroupInfoReq struct { + GroupIDList []string `json:"groupIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetGroupInfoResp struct { + CommResp + GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +//type GroupInfoAlias struct { +// open_im_sdk.GroupInfo +// NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"` +//} + +//type GroupInfoAlias struct { +// GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` +// GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` +// Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"` +// Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"` +// FaceURL string `protobuf:"bytes,5,opt,name=faceURL" json:"faceURL,omitempty"` +// OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID" json:"ownerUserID,omitempty"` +// CreateTime uint32 `protobuf:"varint,7,opt,name=createTime" json:"createTime,omitempty"` +// MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount" json:"memberCount,omitempty"` +// Ex string `protobuf:"bytes,9,opt,name=ex" json:"ex,omitempty"` +// Status int32 `protobuf:"varint,10,opt,name=status" json:"status,omitempty"` +// CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID" json:"creatorUserID,omitempty"` +// GroupType int32 `protobuf:"varint,12,opt,name=groupType" json:"groupType,omitempty"` +// NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"` +//} + +type ApplicationGroupResponseReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` //application from FromUserID + HandledMsg string `json:"handledMsg"` + HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"` +} +type ApplicationGroupResponseResp struct { + CommResp +} + +type JoinGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + ReqMessage string `json:"reqMessage"` + OperationID string `json:"operationID" binding:"required"` + JoinSource int32 `json:"joinSource"` + InviterUserID string `json:"inviterUserID"` +} + +type JoinGroupResp struct { + CommResp +} + +type QuitGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type QuitGroupResp struct { + CommResp +} + +type SetGroupInfoReq struct { + GroupID string `json:"groupID" binding:"required"` + GroupName string `json:"groupName"` + Notification string `json:"notification"` + Introduction string `json:"introduction"` + FaceURL string `json:"faceURL"` + Ex string `json:"ex"` + OperationID string `json:"operationID" binding:"required"` + NeedVerification *int32 `json:"needVerification"` + LookMemberInfo *int32 `json:"lookMemberInfo"` + ApplyMemberFriend *int32 `json:"applyMemberFriend"` +} + +type SetGroupInfoResp struct { + CommResp +} + +type TransferGroupOwnerReq struct { + GroupID string `json:"groupID" binding:"required"` + OldOwnerUserID string `json:"oldOwnerUserID" binding:"required"` + NewOwnerUserID string `json:"newOwnerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type TransferGroupOwnerResp struct { + CommResp +} + +type DismissGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type DismissGroupResp struct { + CommResp +} + +type MuteGroupMemberReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` + MutedSeconds uint32 `json:"mutedSeconds" binding:"required"` +} +type MuteGroupMemberResp struct { + CommResp +} + +type CancelMuteGroupMemberReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` +} +type CancelMuteGroupMemberResp struct { + CommResp +} + +type MuteGroupReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` +} +type MuteGroupResp struct { + CommResp +} + +type CancelMuteGroupReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` +} +type CancelMuteGroupResp struct { + CommResp +} + +type SetGroupMemberNicknameReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` + Nickname string `json:"nickname"` +} + +type SetGroupMemberNicknameResp struct { + CommResp +} + +type SetGroupMemberInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + UserID string `json:"userID" binding:"required"` + Nickname *string `json:"nickname"` + FaceURL *string `json:"userGroupFaceUrl"` + RoleLevel *int32 `json:"roleLevel" validate:"gte=1,lte=3"` + Ex *string `json:"ex"` +} + +type SetGroupMemberInfoResp struct { + CommResp +} + +type GetGroupAbstractInfoReq struct { + OperationID string `json:"operationID"` + GroupID string `json:"groupID"` +} + +type GetGroupAbstractInfoResp struct { + CommResp + GroupMemberNumber int32 `json:"groupMemberNumber"` + GroupMemberListHash uint64 `json:"groupMemberListHash"` +} diff --git a/pkg/api_struct/manage.go b/pkg/api_struct/manage.go new file mode 100644 index 000000000..4e6c6977b --- /dev/null +++ b/pkg/api_struct/manage.go @@ -0,0 +1,132 @@ +package api_struct + +import ( + pbRelay "Open_IM/pkg/proto/relay" + server_api_params "Open_IM/pkg/proto/sdk_ws" + pbUser "Open_IM/pkg/proto/user" +) + +type DeleteUsersReq struct { + OperationID string `json:"operationID" binding:"required"` + DeleteUserIDList []string `json:"deleteUserIDList" binding:"required"` +} +type DeleteUsersResp struct { + CommResp + FailedUserIDList []string `json:"data"` +} +type GetAllUsersUidReq struct { + OperationID string `json:"operationID" binding:"required"` +} +type GetAllUsersUidResp struct { + CommResp + UserIDList []string `json:"data"` +} +type GetUsersOnlineStatusReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required,lte=200"` +} +type GetUsersOnlineStatusResp struct { + CommResp + SuccessResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult `json:"data"` +} +type AccountCheckReq struct { + OperationID string `json:"operationID" binding:"required"` + CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"` +} +type AccountCheckResp struct { + CommResp + ResultList []*pbUser.AccountCheckResp_SingleUserStatus `json:"data"` +} + +type ManagementSendMsg struct { + OperationID string `json:"operationID" binding:"required"` + BusinessOperationID string `json:"businessOperationID"` + SendID string `json:"sendID" binding:"required"` + GroupID string `json:"groupID" ` + SenderNickname string `json:"senderNickname" ` + SenderFaceURL string `json:"senderFaceURL" ` + SenderPlatformID int32 `json:"senderPlatformID"` + //ForceList []string `json:"forceList" ` + Content map[string]interface{} `json:"content" binding:"required" swaggerignore:"true"` + ContentType int32 `json:"contentType" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + IsOnlineOnly bool `json:"isOnlineOnly"` + NotOfflinePush bool `json:"notOfflinePush"` + OfflinePushInfo *server_api_params.OfflinePushInfo `json:"offlinePushInfo"` +} + +type ManagementSendMsgReq struct { + ManagementSendMsg + RecvID string `json:"recvID" ` +} + +type ManagementSendMsgResp struct { + CommResp + ResultList server_api_params.UserSendMsgResp `json:"data"` +} + +type ManagementBatchSendMsgReq struct { + ManagementSendMsg + IsSendAll bool `json:"isSendAll"` + RecvIDList []string `json:"recvIDList"` +} + +type ManagementBatchSendMsgResp struct { + CommResp + Data struct { + ResultList []*SingleReturnResult `json:"resultList"` + FailedIDList []string + } `json:"data"` +} +type SingleReturnResult struct { + ServerMsgID string `json:"serverMsgID"` + ClientMsgID string `json:"clientMsgID"` + SendTime int64 `json:"sendTime"` + RecvID string `json:"recvID" ` +} + +type CheckMsgIsSendSuccessReq struct { + OperationID string `json:"operationID"` +} + +type CheckMsgIsSendSuccessResp struct { + CommResp + Status int32 `json:"status"` +} + +type GetUsersReq struct { + OperationID string `json:"operationID" binding:"required"` + UserName string `json:"userName"` + UserID string `json:"userID"` + Content string `json:"content"` + PageNumber int32 `json:"pageNumber" binding:"required"` + ShowNumber int32 `json:"showNumber" binding:"required"` +} + +type CMSUser struct { + UserID string `json:"userID"` + Nickname string `json:"nickname"` + FaceURL string `json:"faceURL"` + Gender int32 `json:"gender"` + PhoneNumber string `json:"phoneNumber"` + Birth uint32 `json:"birth"` + Email string `json:"email"` + Ex string `json:"ex"` + CreateIp string `json:"createIp"` + CreateTime uint32 `json:"createTime"` + LastLoginIp string `json:"LastLoginIp"` + LastLoginTime uint32 `json:"LastLoginTime"` + AppMangerLevel int32 `json:"appMangerLevel"` + GlobalRecvMsgOpt int32 `json:"globalRecvMsgOpt"` + IsBlock bool `json:"isBlock"` +} + +type GetUsersResp struct { + CommResp + Data struct { + UserList []*CMSUser `json:"userList"` + TotalNum int32 `json:"totalNum"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} diff --git a/pkg/api_struct/office.go b/pkg/api_struct/office.go new file mode 100644 index 000000000..3eeb1ed3f --- /dev/null +++ b/pkg/api_struct/office.go @@ -0,0 +1,88 @@ +package api_struct + +import ( + pbOffice "Open_IM/pkg/proto/office" +) + +type GetUserTagsReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetUserTagsResp struct { + CommResp + Data struct { + Tags []*pbOffice.Tag `json:"tags"` + } `json:"data"` +} + +type CreateTagReq struct { + TagName string `json:"tagName" binding:"required"` // tag名称 + UserIDList []string `json:"userIDList" binding:"required"` // 用户ID列表 + OperationID string `json:"operationID" binding:"required"` +} + +type CreateTagResp struct { + CommResp +} + +type DeleteTagReq struct { + TagID string `json:"tagID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type DeleteTagResp struct { + CommResp +} + +type SetTagReq struct { + TagID string `json:"tagID" binding:"required"` + NewName string `json:"newName"` + IncreaseUserIDList []string `json:"increaseUserIDList"` + ReduceUserIDList []string `json:"reduceUserIDList"` + OperationID string `json:"operationID" binding:"required"` +} + +type SetTagResp struct { + CommResp +} + +type SendMsg2TagReq struct { + TagList []string `json:"tagList"` + UserList []string `json:"userList"` + GroupList []string `json:"groupList"` + + SenderPlatformID int32 `json:"senderPlatformID" binding:"required"` + Content string `json:"content" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type SendMsg2TagResp struct { + CommResp +} + +type GetTagSendLogsReq struct { + PageNumber int32 `json:"pageNumber" binding:"required"` + ShowNumber int32 `json:"showNumber" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetTagSendLogsResp struct { + CommResp + Data struct { + Logs []*pbOffice.TagSendLog `json:"logs"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} + +type GetUserTagByIDReq struct { + TagID string `json:"tagID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetUserTagByIDResp struct { + CommResp + Data struct { + Tag *pbOffice.Tag `json:"tag"` + } `json:"data"` +} diff --git a/pkg/api_struct/organization.go b/pkg/api_struct/organization.go new file mode 100644 index 000000000..c6c1d8327 --- /dev/null +++ b/pkg/api_struct/organization.go @@ -0,0 +1,121 @@ +package api_struct + +import open_im_sdk "Open_IM/pkg/proto/sdk_ws" + +type CreateDepartmentReq struct { + *open_im_sdk.Department + OperationID string `json:"operationID" binding:"required"` +} +type CreateDepartmentResp struct { + CommResp + Department *open_im_sdk.Department `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type UpdateDepartmentReq struct { + *open_im_sdk.Department + DepartmentID string `json:"departmentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type UpdateDepartmentResp struct { + CommResp +} + +type GetSubDepartmentReq struct { + OperationID string `json:"operationID" binding:"required"` + DepartmentID string `json:"departmentID" binding:"required"` +} +type GetSubDepartmentResp struct { + CommResp + DepartmentList []*open_im_sdk.Department `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type DeleteDepartmentReq struct { + OperationID string `json:"operationID" binding:"required"` + DepartmentID string `json:"departmentID" binding:"required"` +} +type DeleteDepartmentResp struct { + CommResp +} + +type CreateOrganizationUserReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.OrganizationUser +} +type CreateOrganizationUserResp struct { + CommResp +} + +type UpdateOrganizationUserReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.OrganizationUser +} +type UpdateOrganizationUserResp struct { + CommResp +} + +type CreateDepartmentMemberReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.DepartmentMember +} + +type CreateDepartmentMemberResp struct { + CommResp +} + +type GetUserInDepartmentReq struct { + UserID string `json:"userID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetUserInDepartmentResp struct { + CommResp + UserInDepartment *open_im_sdk.UserInDepartment `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type UpdateUserInDepartmentReq struct { + OperationID string `json:"operationID" binding:"required"` + *open_im_sdk.DepartmentMember +} +type UpdateUserInDepartmentResp struct { + CommResp +} + +type DeleteOrganizationUserReq struct { + UserID string `json:"userID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type DeleteOrganizationUserResp struct { + CommResp +} + +type GetDepartmentMemberReq struct { + DepartmentID string `json:"departmentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetDepartmentMemberResp struct { + CommResp + UserInDepartmentList []*open_im_sdk.UserDepartmentMember `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type DeleteUserInDepartmentReq struct { + DepartmentID string `json:"departmentID" binding:"required"` + UserID string `json:"userID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type DeleteUserInDepartmentResp struct { + CommResp +} + +type GetUserInOrganizationReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` +} + +type GetUserInOrganizationResp struct { + CommResp + OrganizationUserList []*open_im_sdk.OrganizationUser `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} diff --git a/pkg/api_struct/oss.go b/pkg/api_struct/oss.go new file mode 100644 index 000000000..9cbac79f8 --- /dev/null +++ b/pkg/api_struct/oss.go @@ -0,0 +1,22 @@ +package api_struct + +type OSSCredentialReq struct { + OperationID string `json:"operationID"` + Filename string `json:"filename"` + FileType string `json:"file_type"` +} + +type OSSCredentialRespData struct { + Endpoint string `json:"endpoint"` + AccessKeyId string `json:"access_key_id"` + AccessKeySecret string `json:"access_key_secret"` + Token string `json:"token"` + Bucket string `json:"bucket"` + FinalHost string `json:"final_host"` +} + +type OSSCredentialResp struct { + CommResp + OssData OSSCredentialRespData `json:"-"` + Data map[string]interface{} `json:"data"` +} diff --git a/pkg/api_struct/public.go b/pkg/api_struct/public.go new file mode 100644 index 000000000..99109bf76 --- /dev/null +++ b/pkg/api_struct/public.go @@ -0,0 +1,30 @@ +package api_struct + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +type ApiUserInfo struct { + UserID string `json:"userID" binding:"required,min=1,max=64" swaggo:"true,用户ID,"` + Nickname string `json:"nickname" binding:"omitempty,min=1,max=64" swaggo:"true,my id,19"` + FaceURL string `json:"faceURL" binding:"omitempty,max=1024"` + Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"` + PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"` + Birth int64 `json:"birth" binding:"omitempty"` + Email string `json:"email" binding:"omitempty,max=64"` + CreateTime int64 `json:"createTime"` + Ex string `json:"ex" binding:"omitempty,max=1024"` +} + +type GroupAddMemberInfo struct { + UserID string `json:"userID" binding:"required"` + RoleLevel int32 `json:"roleLevel" binding:"required,oneof= 1 3"` +} + +func SetErrCodeMsg(c *gin.Context, status int) *CommResp { + resp := CommResp{ErrCode: int32(status), ErrMsg: http.StatusText(status)} + c.JSON(status, resp) + return &resp +} diff --git a/pkg/api_struct/third.go b/pkg/api_struct/third.go new file mode 100644 index 000000000..258c19a42 --- /dev/null +++ b/pkg/api_struct/third.go @@ -0,0 +1,123 @@ +package api_struct + +import "mime/multipart" + +type MinioStorageCredentialReq struct { + OperationID string `json:"operationID"` +} + +type MiniostorageCredentialResp struct { + SecretAccessKey string `json:"secretAccessKey"` + AccessKeyID string `json:"accessKeyID"` + SessionToken string `json:"sessionToken"` + BucketName string `json:"bucketName"` + StsEndpointURL string `json:"stsEndpointURL"` + StorageTime int `json:"storageTime"` + IsDistributedMod bool `json:"isDistributedMod"` +} + +type MinioUploadFileReq struct { + OperationID string `form:"operationID" binding:"required"` + FileType int `form:"fileType" binding:"required"` +} + +type MinioUploadFile struct { + URL string `json:"URL"` + NewName string `json:"newName"` + SnapshotURL string `json:"snapshotURL,omitempty"` + SnapshotNewName string `json:"snapshotName,omitempty"` +} + +type MinioUploadFileResp struct { + CommResp + Data struct { + MinioUploadFile + } `json:"data"` +} + +type UploadUpdateAppReq struct { + OperationID string `form:"operationID" binding:"required"` + Type int `form:"type" binding:"required"` + Version string `form:"version" binding:"required"` + File *multipart.FileHeader `form:"file" binding:"required"` + Yaml *multipart.FileHeader `form:"yaml"` + ForceUpdate bool `form:"forceUpdate"` + UpdateLog string `form:"updateLog" binding:"required"` +} + +type UploadUpdateAppResp struct { + CommResp +} + +type GetDownloadURLReq struct { + OperationID string `json:"operationID" binding:"required"` + Type int `json:"type" binding:"required"` + Version string `json:"version" binding:"required"` +} + +type GetDownloadURLResp struct { + CommResp + Data struct { + HasNewVersion bool `json:"hasNewVersion"` + ForceUpdate bool `json:"forceUpdate"` + FileURL string `json:"fileURL"` + YamlURL string `json:"yamlURL"` + Version string `json:"version"` + UpdateLog string `json:"update_log"` + } `json:"data"` +} + +type GetRTCInvitationInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + ClientMsgID string `json:"clientMsgID" binding:"required"` +} + +type GetRTCInvitationInfoResp struct { + CommResp + Data struct { + OpUserID string `json:"opUserID"` + Invitation struct { + InviterUserID string `json:"inviterUserID"` + InviteeUserIDList []string `json:"inviteeUserIDList"` + GroupID string `json:"groupID"` + RoomID string `json:"roomID"` + Timeout int32 `json:"timeout"` + MediaType string `json:"mediaType"` + SessionType int32 `json:"sessionType"` + InitiateTime int32 `json:"initiateTime"` + PlatformID int32 `json:"platformID"` + CustomData string `json:"customData"` + } `json:"invitation"` + OfflinePushInfo struct{} `json:"offlinePushInfo"` + } `json:"data"` +} + +type GetRTCInvitationInfoStartAppReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetRTCInvitationInfoStartAppResp struct { + GetRTCInvitationInfoResp +} + +/** + * FCM第三方上报Token + */ +type FcmUpdateTokenReq struct { + OperationID string `json:"operationID" binding:"required"` + Platform int `json:"platform" binding:"required,min=1,max=2"` //only for ios + android + FcmToken string `json:"fcmToken" binding:"required"` +} + +type FcmUpdateTokenResp struct { + CommResp +} +type SetAppBadgeReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` + AppUnreadCount int32 `json:"appUnreadCount"` +} + +type SetAppBadgeResp struct { + CommResp +} diff --git a/pkg/api_struct/user.go b/pkg/api_struct/user.go new file mode 100644 index 000000000..7cd165fbb --- /dev/null +++ b/pkg/api_struct/user.go @@ -0,0 +1,58 @@ +package api_struct + +import ( + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +type GetUsersInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` +} +type GetUsersInfoResp struct { + CommResp + UserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` + Data []map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type UpdateSelfUserInfoReq struct { + ApiUserInfo + OperationID string `json:"operationID" binding:"required"` +} +type SetGlobalRecvMessageOptReq struct { + OperationID string `json:"operationID" binding:"required"` + GlobalRecvMsgOpt *int32 `json:"globalRecvMsgOpt" binding:"omitempty,oneof=0 1 2"` +} +type SetGlobalRecvMessageOptResp struct { + CommResp +} +type UpdateUserInfoResp struct { + CommResp +} + +type GetSelfUserInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + UserID string `json:"userID" binding:"required"` +} +type GetSelfUserInfoResp struct { + CommResp + UserInfo *open_im_sdk.UserInfo `json:"-"` + Data map[string]interface{} `json:"data" swaggerignore:"true"` +} + +type GetFriendIDListFromCacheReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetFriendIDListFromCacheResp struct { + CommResp + UserIDList []string `json:"userIDList" binding:"required"` +} + +type GetBlackIDListFromCacheReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetBlackIDListFromCacheResp struct { + CommResp + UserIDList []string `json:"userIDList" binding:"required"` +} diff --git a/pkg/api_struct/work_moments.go b/pkg/api_struct/work_moments.go new file mode 100644 index 000000000..ce7fe59a4 --- /dev/null +++ b/pkg/api_struct/work_moments.go @@ -0,0 +1,138 @@ +package api_struct + +import "Open_IM/pkg/proto/office" + +type CreateOneWorkMomentReq struct { + office.CreateOneWorkMomentReq +} + +type CreateOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type DeleteOneWorkMomentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type DeleteOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type LikeOneWorkMomentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type LikeOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type CommentOneWorkMomentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + ReplyUserID string `json:"replyUserID"` + Content string `json:"content" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type CommentOneWorkMomentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type DeleteCommentReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + ContentID string `json:"contentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type DeleteCommentResp struct { + CommResp + Data struct{} `json:"data"` +} + +type WorkMomentsUserCommonReq struct { + PageNumber int32 `json:"pageNumber" binding:"required"` + ShowNumber int32 `json:"showNumber" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type GetWorkMomentByIDReq struct { + WorkMomentID string `json:"workMomentID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} + +type WorkMoment struct { + WorkMomentID string `json:"workMomentID"` + UserID string `json:"userID"` + Content string `json:"content"` + LikeUserList []*WorkMomentUser `json:"likeUsers"` + Comments []*Comment `json:"comments"` + FaceURL string `json:"faceURL"` + UserName string `json:"userName"` + AtUserList []*WorkMomentUser `json:"atUsers"` + PermissionUserList []*WorkMomentUser `json:"permissionUsers"` + CreateTime int32 `json:"createTime"` + Permission int32 `json:"permission"` +} + +type WorkMomentUser struct { + UserID string `json:"userID"` + UserName string `json:"userName"` +} + +type Comment struct { + UserID string `json:"userID"` + UserName string `json:"userName"` + ReplyUserID string `json:"replyUserID"` + ReplyUserName string `json:"replyUserName"` + ContentID string `json:"contentID"` + Content string `json:"content"` + CreateTime int32 `json:"createTime"` +} + +type GetWorkMomentByIDResp struct { + CommResp + Data struct { + WorkMoment *WorkMoment `json:"workMoment"` + } `json:"data"` +} + +type GetUserWorkMomentsReq struct { + WorkMomentsUserCommonReq + UserID string `json:"userID"` +} + +type GetUserWorkMomentsResp struct { + CommResp + Data struct { + WorkMoments []*WorkMoment `json:"workMoments"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} + +type GetUserFriendWorkMomentsReq struct { + WorkMomentsUserCommonReq +} + +type GetUserFriendWorkMomentsResp struct { + CommResp + Data struct { + WorkMoments []*WorkMoment `json:"workMoments"` + CurrentPage int32 `json:"currentPage"` + ShowNumber int32 `json:"showNumber"` + } `json:"data"` +} + +type SetUserWorkMomentsLevelReq struct { + office.SetUserWorkMomentsLevelReq +} + +type SetUserWorkMomentsLevelResp struct { + CommResp + Data struct{} `json:"data"` +}