feat: incr sync version.
This commit is contained in:
428
go/chao-sdk-core/pkg/constant/constant.go
Normal file
428
go/chao-sdk-core/pkg/constant/constant.go
Normal file
@@ -0,0 +1,428 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
CmdFriend = "001"
|
||||
CmdBlackList = "002"
|
||||
CmdNotification = "003"
|
||||
CmdDeleteConversation = "004"
|
||||
CmdNewMsgCome = "005"
|
||||
CmdSuperGroupMsgCome = "006"
|
||||
CmdUpdateConversation = "007"
|
||||
CmSyncReactionExtensions = "008"
|
||||
CmdFroceSyncBlackList = "009"
|
||||
CmdForceSyncFriendApplication = "010"
|
||||
CmdForceSyncMsg = "011"
|
||||
CmdForceSyncLoginUerInfo = "012"
|
||||
CmdReLogin = "013"
|
||||
CmdUnInit = "014"
|
||||
CmdAcceptFriend = "015"
|
||||
CmdRefuseFriend = "016"
|
||||
CmdAddFriend = "017"
|
||||
|
||||
CmdJoinedSuperGroup = "018"
|
||||
CmdUpdateMessage = "019"
|
||||
|
||||
CmdReconnect = "020"
|
||||
CmdInit = "021"
|
||||
|
||||
CmdMaxSeq = "maxSeq"
|
||||
CmdPushMsg = "pushMsg"
|
||||
CmdConnSuccesss = "connSuccess"
|
||||
CmdWakeUp = "wakeUp"
|
||||
CmdLogOut = "loginOut"
|
||||
)
|
||||
|
||||
const (
|
||||
//ContentType
|
||||
Text = 101
|
||||
Picture = 102
|
||||
Sound = 103
|
||||
Video = 104
|
||||
File = 105
|
||||
AtText = 106
|
||||
Merger = 107
|
||||
Card = 108
|
||||
Location = 109
|
||||
Custom = 110
|
||||
Typing = 113
|
||||
Quote = 114
|
||||
Face = 115
|
||||
AdvancedText = 117
|
||||
CustomMsgNotTriggerConversation = 119
|
||||
CustomMsgOnlineOnly = 120
|
||||
ReactionMessageModifier = 121
|
||||
ReactionMessageDeleter = 122
|
||||
|
||||
//////////////////////////////////////////
|
||||
NotificationBegin = 1000
|
||||
FriendNotificationBegin = 1200
|
||||
|
||||
FriendApplicationApprovedNotification = 1201 //add_friend_response
|
||||
FriendApplicationRejectedNotification = 1202 //add_friend_response
|
||||
FriendApplicationNotification = 1203 //add_friend
|
||||
FriendAddedNotification = 1204
|
||||
FriendDeletedNotification = 1205 //delete_friend
|
||||
FriendRemarkSetNotification = 1206 //set_friend_remark?
|
||||
BlackAddedNotification = 1207 //add_black
|
||||
BlackDeletedNotification = 1208 //remove_black
|
||||
FriendInfoUpdatedNotification = 1209
|
||||
FriendsInfoUpdateNotification = 1210
|
||||
FriendNotificationEnd = 1299
|
||||
ConversationChangeNotification = 1300
|
||||
|
||||
UserNotificationBegin = 1301
|
||||
UserInfoUpdatedNotification = 1303 //SetSelfInfoTip = 204
|
||||
UserStatusChangeNotification = 1304
|
||||
UserCommandAddNotification = 1305
|
||||
UserCommandDeleteNotification = 1306
|
||||
UserCommandUpdateNotification = 1307
|
||||
|
||||
UserNotificationEnd = 1399
|
||||
OANotification = 1400
|
||||
|
||||
GroupNotificationBegin = 1500
|
||||
|
||||
GroupCreatedNotification = 1501
|
||||
GroupInfoSetNotification = 1502
|
||||
JoinGroupApplicationNotification = 1503
|
||||
MemberQuitNotification = 1504
|
||||
GroupApplicationAcceptedNotification = 1505
|
||||
GroupApplicationRejectedNotification = 1506
|
||||
GroupOwnerTransferredNotification = 1507
|
||||
MemberKickedNotification = 1508
|
||||
MemberInvitedNotification = 1509
|
||||
MemberEnterNotification = 1510
|
||||
GroupDismissedNotification = 1511
|
||||
GroupMemberMutedNotification = 1512
|
||||
GroupMemberCancelMutedNotification = 1513
|
||||
GroupMutedNotification = 1514
|
||||
GroupCancelMutedNotification = 1515
|
||||
GroupMemberInfoSetNotification = 1516
|
||||
GroupMemberSetToAdminNotification = 1517
|
||||
GroupMemberSetToOrdinaryUserNotification = 1518
|
||||
GroupInfoSetAnnouncementNotification = 1519
|
||||
GroupInfoSetNameNotification = 1520
|
||||
GroupNotificationEnd = 1599
|
||||
|
||||
SignalingNotificationBegin = 1600
|
||||
SignalingNotification = 1601
|
||||
SignalingNotificationEnd = 1649
|
||||
|
||||
SuperGroupNotificationBegin = 1650
|
||||
SuperGroupUpdateNotification = 1651
|
||||
MsgDeleteNotification = 1652
|
||||
ReactionMessageModifierNotification = 1653
|
||||
ReactionMessageDeleteNotification = 1654
|
||||
SuperGroupNotificationEnd = 1699
|
||||
|
||||
ConversationPrivateChatNotification = 1701
|
||||
ConversationUnreadNotification = 1702
|
||||
|
||||
WorkMomentNotificationBegin = 1900
|
||||
WorkMomentNotification = 1901
|
||||
|
||||
BusinessNotificationBegin = 2000
|
||||
BusinessNotification = 2001
|
||||
BusinessNotificationEnd = 2099
|
||||
|
||||
RevokeNotification = 2101
|
||||
|
||||
HasReadReceiptNotification = 2150
|
||||
GroupHasReadReceiptNotification = 2155
|
||||
ClearConversationNotification = 2101
|
||||
DeleteMsgsNotification = 2102
|
||||
|
||||
HasReadReceipt = 2200
|
||||
|
||||
NotificationEnd = 5000
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
//MsgFrom
|
||||
UserMsgType = 100
|
||||
SysMsgType = 200
|
||||
|
||||
/////////////////////////////////////
|
||||
//SessionType
|
||||
SingleChatType = 1
|
||||
GroupChatType = 2
|
||||
SuperGroupChatType = 3
|
||||
NotificationChatType = 4
|
||||
|
||||
//MsgStatus
|
||||
MsgStatusDefault = 0
|
||||
|
||||
MsgStatusSending = 1
|
||||
MsgStatusSendSuccess = 2
|
||||
MsgStatusSendFailed = 3
|
||||
MsgStatusHasDeleted = 4
|
||||
MsgStatusFiltered = 5
|
||||
|
||||
//OptionsKey
|
||||
IsHistory = "history"
|
||||
IsPersistent = "persistent"
|
||||
IsUnreadCount = "unreadCount"
|
||||
IsConversationUpdate = "conversationUpdate"
|
||||
IsOfflinePush = "offlinePush"
|
||||
IsSenderSync = "senderSync"
|
||||
IsNotPrivate = "notPrivate"
|
||||
IsSenderConversationUpdate = "senderConversationUpdate"
|
||||
|
||||
//GroupStatus
|
||||
GroupOk = 0
|
||||
GroupBanChat = 1
|
||||
GroupStatusDismissed = 2
|
||||
GroupStatusMuted = 3
|
||||
|
||||
// workMoment permission
|
||||
WorkMomentPublic = 0
|
||||
WorkMomentPrivate = 1
|
||||
WorkMomentPermissionCanSee = 2
|
||||
WorkMomentPermissionCantSee = 3
|
||||
|
||||
// workMoment sdk notification type
|
||||
WorkMomentCommentNotification = 0
|
||||
WorkMomentLikeNotification = 1
|
||||
WorkMomentAtUserNotification = 2
|
||||
)
|
||||
|
||||
const (
|
||||
ckWsInitConnection string = "ws-init-connection"
|
||||
ckWsLoginConnection string = "ws-login-connection"
|
||||
ckWsClose string = "ws-close"
|
||||
ckWsKickOffLine string = "ws-kick-off-line"
|
||||
ckTokenExpired string = "token-expired"
|
||||
ckSelfInfoUpdate string = "self-info-update"
|
||||
)
|
||||
const (
|
||||
BlackRelationship = 0
|
||||
FriendRelationship = 1
|
||||
)
|
||||
|
||||
// const (
|
||||
//
|
||||
// ErrCodeInitLogin = 1001
|
||||
// ErrCodeFriend = 2001
|
||||
// ErrCodeConversation = 3001
|
||||
// ErrCodeUserInfo = 4001
|
||||
// ErrCodeGroup = 5001
|
||||
//
|
||||
// )
|
||||
const (
|
||||
NormalGroup = 0
|
||||
SuperGroup = 1
|
||||
WorkingGroup = 2
|
||||
SuperGroupTableName = "local_super_groups"
|
||||
SuperGroupErrChatLogsTableNamePre = "local_sg_err_chat_logs_"
|
||||
ChatLogsTableNamePre = "chat_logs_"
|
||||
)
|
||||
|
||||
const (
|
||||
SdkInit = 0
|
||||
|
||||
LoginSuccess = 101
|
||||
Logining = 102
|
||||
LoginFailed = 103
|
||||
|
||||
Logout = 201
|
||||
|
||||
TokenFailedExpired = 701
|
||||
TokenFailedInvalid = 702
|
||||
TokenFailedKickedOffline = 703
|
||||
)
|
||||
|
||||
const (
|
||||
DeFaultSuccessMsg = "ok"
|
||||
)
|
||||
|
||||
const (
|
||||
AddConOrUpLatMsg = 2
|
||||
UnreadCountSetZero = 3
|
||||
IncrUnread = 5
|
||||
TotalUnreadMessageChanged = 6
|
||||
UpdateConFaceUrlAndNickName = 7
|
||||
UpdateLatestMessageChange = 8
|
||||
ConChange = 9
|
||||
NewCon = 10
|
||||
ConChangeDirect = 11
|
||||
NewConDirect = 12
|
||||
ConversationLatestMsgHasRead = 13
|
||||
UpdateMsgFaceUrlAndNickName = 14
|
||||
SyncConversation = 15
|
||||
SyncMessageListReactionExtensions = 16
|
||||
SyncMessageListTypeKeyInfo = 17
|
||||
UpdateUserCommand = 18
|
||||
|
||||
HasRead = 1
|
||||
NotRead = 0
|
||||
|
||||
IsFilter = 1
|
||||
NotFilter = 0
|
||||
)
|
||||
|
||||
const (
|
||||
GroupActionCreateGroup = 1
|
||||
GroupActionApplyJoinGroup = 2
|
||||
GroupActionQuitGroup = 3
|
||||
GroupActionSetGroupInfo = 4
|
||||
GroupActionKickGroupMember = 5
|
||||
GroupActionTransferGroupOwner = 6
|
||||
GroupActionInviteUserToGroup = 7
|
||||
GroupActionAcceptGroupApplication = 8
|
||||
GroupActionRefuseGroupApplication = 9
|
||||
)
|
||||
const ZoomScale = "200"
|
||||
const MaxTotalMsgLen = 51200
|
||||
|
||||
// const MaxTotalMsgLen = 20480
|
||||
const (
|
||||
FriendAcceptTip = "You have successfully become friends, so start chatting"
|
||||
TransferGroupTip = "The owner of the group is transferred!"
|
||||
AcceptGroupTip = "%s join the group"
|
||||
)
|
||||
|
||||
const (
|
||||
GetNewestSeq = 1001
|
||||
PullMsgBySeqList = 1002
|
||||
SendMsg = 1003
|
||||
SendSignalMsg = 1004
|
||||
DelMsg = 1005
|
||||
PushMsg = 2001
|
||||
KickOnlineMsg = 2002
|
||||
LogoutMsg = 2003
|
||||
SetBackgroundStatus = 2004
|
||||
|
||||
WSDataError = 3001
|
||||
)
|
||||
|
||||
// conversation
|
||||
const (
|
||||
//MsgReceiveOpt
|
||||
ReceiveMessage = 0
|
||||
NotReceiveMessage = 1
|
||||
ReceiveNotNotifyMessage = 2
|
||||
|
||||
Online = 1
|
||||
Offline = 0
|
||||
|
||||
//pinned
|
||||
Pinned = 1
|
||||
NotPinned = 0
|
||||
|
||||
//privateChat
|
||||
IsPrivateChat = true
|
||||
NotPrivateChat = false
|
||||
)
|
||||
|
||||
const SuccessCallbackDefault = "" // Default value for success callback
|
||||
|
||||
const (
|
||||
AppOrdinaryUsers = 1 // Application user type: ordinary user
|
||||
AppAdmin = 2 // Application user type: administrator
|
||||
|
||||
GroupOwner = 100 // Group member type: owner
|
||||
GroupAdmin = 60 // Group member type: administrator
|
||||
GroupOrdinaryUsers = 20 // Group member type: ordinary user
|
||||
|
||||
GroupFilterAll = 0
|
||||
GroupFilterOwner = 1
|
||||
GroupFilterAdmin = 2
|
||||
GroupFilterOrdinaryUsers = 3
|
||||
GroupFilterAdminAndOrdinaryUsers = 4
|
||||
GroupFilterOwnerAndAdmin = 5
|
||||
|
||||
GroupResponseAgree = 1 // Response to group application: agree
|
||||
GroupResponseRefuse = -1 // Response to group application: refuse
|
||||
|
||||
FriendResponseAgree = 1 // Response to friend request: agree
|
||||
FriendResponseRefuse = -1 // Response to friend request: refuse
|
||||
FriendResponseDefault = 0
|
||||
|
||||
Male = 1 // Gender: male
|
||||
Female = 2 // Gender: female
|
||||
)
|
||||
const (
|
||||
AtAllString = "AtAllTag" // String for 'all people' mention tag
|
||||
AtNormal = 0 // Mention mode: normal
|
||||
AtMe = 1 // Mention mode: mention sender only
|
||||
AtAll = 2 // Mention mode: mention all people
|
||||
AtAllAtMe = 3 // Mention mode: mention all people and sender
|
||||
|
||||
)
|
||||
const (
|
||||
FieldRecvMsgOpt = 1 // Field type: message receiving options
|
||||
FieldIsPinned = 2 // Field type: whether a message is pinned
|
||||
FieldAttachedInfo = 3 // Field type: attached information
|
||||
FieldIsPrivateChat = 4 // Field type: whether a message is from a private chat
|
||||
FieldGroupAtType = 5 // Field type: group mention mode
|
||||
FieldIsNotInGroup = 6 // Field type: whether a message is not in a group
|
||||
FieldEx = 7 // Field type: extension field
|
||||
FieldUnread = 8 // Field type: whether a message is unread
|
||||
FieldBurnDuration = 9 // Field type: message burn duration
|
||||
)
|
||||
const (
|
||||
SetMessageExtensions = 1 // Message extension operation type: set extension
|
||||
AddMessageExtensions = 2 // Message extension operation type: add extension
|
||||
)
|
||||
const (
|
||||
KeywordMatchOr = 0 // Keyword match mode: match any keyword
|
||||
KeywordMatchAnd = 1 // Keyword match mode: match all keywords
|
||||
)
|
||||
|
||||
const BigVersion = "v3"
|
||||
const UpdateVersion = ".0.0"
|
||||
const SdkVersion = "openim-sdk-core-"
|
||||
const LogFileName = "sdk"
|
||||
|
||||
func GetSdkVersion() string {
|
||||
return SdkVersion + BigVersion + UpdateVersion
|
||||
}
|
||||
|
||||
var HeartbeatInterval = 5
|
||||
|
||||
const (
|
||||
MsgSyncModelDefault = 0 //SyncFlag
|
||||
MsgSyncModelLogin = 1 //SyncFlag
|
||||
SyncOrderStartLatest = 101 //PullMsgOrder
|
||||
|
||||
MsgSyncBegin = 1001 //
|
||||
MsgSyncProcessing = 1002 //
|
||||
MsgSyncEnd = 1003 //
|
||||
MsgSyncFailed = 1004
|
||||
)
|
||||
|
||||
const (
|
||||
JoinByInvitation = 2
|
||||
JoinBySearch = 3
|
||||
JoinByQRCode = 4
|
||||
)
|
||||
const (
|
||||
SplitPullMsgNum = 100
|
||||
PullMsgNumWhenLogin = 10000
|
||||
PullMsgNumForReadDiffusion = 50
|
||||
NormalMsgMinNumReadDiffusion = 100
|
||||
)
|
||||
|
||||
const SplitGetGroupMemberNum = 1000
|
||||
const UseHashGroupMemberNum = 1000
|
||||
|
||||
const (
|
||||
Uninitialized = -1001
|
||||
NoNetwork = 1 //有网络->无网络
|
||||
NetworkAvailable = 2 //无网络->有网络
|
||||
NetworkVariation = 3 //有网络,但状态有变化
|
||||
)
|
||||
112
go/chao-sdk-core/pkg/constant/error.go
Normal file
112
go/chao-sdk-core/pkg/constant/error.go
Normal file
@@ -0,0 +1,112 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package constant
|
||||
|
||||
// key = errCode, string = errMsg
|
||||
//type ErrInfo struct {
|
||||
// ErrCode int32
|
||||
// ErrMsg string
|
||||
//}
|
||||
//
|
||||
//var (
|
||||
// OK = ErrInfo{0, ""}
|
||||
//
|
||||
// ErrParseToken = ErrInfo{200, ParseTokenMsg.Error()}
|
||||
//
|
||||
// ErrTencentCredential = ErrInfo{400, ThirdPartyMsg.Error()}
|
||||
// ErrInBlackList = ErrInfo{ErrCode: 600, ErrMsg: InBlackList.Error()}
|
||||
// ErrNotFriend = ErrInfo{ErrCode: 601, ErrMsg: NotFriend.Error()}
|
||||
//
|
||||
// ErrTokenExpired = ErrInfo{701, TokenExpiredMsg.Error()}
|
||||
// ErrTokenInvalid = ErrInfo{702, TokenInvalidMsg.Error()}
|
||||
// ErrTokenMalformed = ErrInfo{703, TokenMalformedMsg.Error()}
|
||||
// ErrTokenNotValidYet = ErrInfo{704, TokenNotValidYetMsg.Error()}
|
||||
// ErrTokenUnknown = ErrInfo{705, TokenUnknownMsg.Error()}
|
||||
// ErrTokenKicked = ErrInfo{706, TokenUserKickedMsg.Error()}
|
||||
//
|
||||
// ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()}
|
||||
// ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()}
|
||||
// ErrArgs = ErrInfo{ErrCode: 803, ErrMsg: ArgsMsg.Error()}
|
||||
// ErrApi = ErrInfo{ErrCode: 804, ErrMsg: ApiMsg.Error()}
|
||||
// ErrData = ErrInfo{ErrCode: 805, ErrMsg: DataMsg.Error()}
|
||||
// ErrLogin = ErrInfo{ErrCode: 806, ErrMsg: LoginMsg.Error()}
|
||||
// ErrConfig = ErrInfo{ErrCode: 807, ErrMsg: ConfigMsg.Error()}
|
||||
// ErrThirdParty = ErrInfo{ErrCode: 808, ErrMsg: ThirdPartyMsg.Error()}
|
||||
// ErrServerReturn = ErrInfo{ErrCode: 809, ErrMsg: ServerReturn.Error()}
|
||||
//
|
||||
// ErrWsRecvConnDiff = ErrInfo{ErrCode: 901, ErrMsg: WsRecvConnDiff.Error()}
|
||||
// ErrWsRecvConnSame = ErrInfo{ErrCode: 902, ErrMsg: WsRecvConnSame.Error()}
|
||||
// ErrWsRecvCode = ErrInfo{ErrCode: 903, ErrMsg: WsRecvCode.Error()}
|
||||
// ErrWsSendTimeout = ErrInfo{ErrCode: 904, ErrMsg: WsSendTimeout.Error()}
|
||||
// ErrResourceLoadNotComplete = ErrInfo{ErrCode: 905, ErrMsg: ResourceLoadNotComplete.Error()}
|
||||
// ErrNotSupportFunction = ErrInfo{ErrCode: 906, ErrMsg: NotSupportFunction.Error()}
|
||||
//)
|
||||
//
|
||||
//var (
|
||||
// ParseTokenMsg = errors.New("parse token failed")
|
||||
// TokenExpiredMsg = errors.New("token is timed out, please log in again")
|
||||
// TokenInvalidMsg = errors.New("token has been invalidated")
|
||||
// TokenNotValidYetMsg = errors.New("token not active yet")
|
||||
// TokenMalformedMsg = errors.New("that's not even a token")
|
||||
// TokenUnknownMsg = errors.New("couldn't handle this token")
|
||||
// TokenUserKickedMsg = errors.New("user has been kicked")
|
||||
//
|
||||
// AccessMsg = errors.New("no permission")
|
||||
// DBMsg = errors.New("db failed")
|
||||
// ArgsMsg = errors.New("args failed")
|
||||
// ApiMsg = errors.New("api failed")
|
||||
// DataMsg = errors.New("data failed ")
|
||||
// LoginMsg = errors.New("you can only login once")
|
||||
// ConfigMsg = errors.New("config failed")
|
||||
//
|
||||
// ThirdPartyMsg = errors.New("third party error")
|
||||
// ServerReturn = errors.New("server return data err")
|
||||
//
|
||||
// WsRecvConnDiff = errors.New("recv timeout, conn diff")
|
||||
// WsRecvConnSame = errors.New("recv timeout, conn same")
|
||||
// WsRecvCode = errors.New("recv code err")
|
||||
// WsSendTimeout = errors.New("send timeout")
|
||||
// ResourceLoadNotComplete = errors.New("resource loading is not complete")
|
||||
// NotSupportFunction = errors.New("unsupported function")
|
||||
//
|
||||
// NotFriend = errors.New("not friend")
|
||||
// InBlackList = errors.New("in blackList")
|
||||
//)
|
||||
//
|
||||
//funcation (e *ErrInfo) Error() string {
|
||||
// return e.ErrMsg
|
||||
//}
|
||||
//
|
||||
//const (
|
||||
// StatusErrTokenExpired = 701
|
||||
// StatusErrTokenInvalid = 702
|
||||
// StatusErrTokenMalformed = 703
|
||||
// StatusErrTokenNotValidYet = 704
|
||||
// StatusErrTokenUnknown = 705
|
||||
// StatusErrTokenKicked = 706
|
||||
//)
|
||||
//
|
||||
//var statusText = map[int]*ErrInfo{
|
||||
// StatusErrTokenExpired: &ErrTokenExpired,
|
||||
// StatusErrTokenInvalid: &ErrTokenInvalid,
|
||||
// StatusErrTokenMalformed: &ErrTokenMalformed,
|
||||
// StatusErrTokenNotValidYet: &ErrTokenNotValidYet,
|
||||
// StatusErrTokenUnknown: &ErrTokenUnknown,
|
||||
// StatusErrTokenKicked: &ErrTokenKicked,
|
||||
//}
|
||||
//
|
||||
//funcation StatusText(code int) *ErrInfo {
|
||||
// return statusText[code]
|
||||
//}
|
||||
90
go/chao-sdk-core/pkg/constant/platform_number_id_to_name.go
Normal file
90
go/chao-sdk-core/pkg/constant/platform_number_id_to_name.go
Normal file
@@ -0,0 +1,90 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package constant
|
||||
|
||||
// fixme 1<--->IOS 2<--->Android 3<--->Windows
|
||||
//fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux
|
||||
|
||||
const (
|
||||
//Platform ID
|
||||
IOSPlatformID = 1
|
||||
AndroidPlatformID = 2
|
||||
WindowsPlatformID = 3
|
||||
OSXPlatformID = 4
|
||||
WebPlatformID = 5
|
||||
MiniWebPlatformID = 6
|
||||
LinuxPlatformID = 7
|
||||
AndroidPadPlatformID = 8
|
||||
IPadPlatformID = 9
|
||||
AdminPlatformID = 10
|
||||
|
||||
//Platform string match to Platform ID
|
||||
IOSPlatformStr = "IOS"
|
||||
AndroidPlatformStr = "Android"
|
||||
WindowsPlatformStr = "Windows"
|
||||
OSXPlatformStr = "OSX"
|
||||
WebPlatformStr = "Web"
|
||||
MiniWebPlatformStr = "MiniWeb"
|
||||
LinuxPlatformStr = "Linux"
|
||||
AndroidPadPlatformStr = "APad"
|
||||
IPadPlatformStr = "IPad"
|
||||
AdminPlatformStr = "Admin"
|
||||
|
||||
//terminal types
|
||||
TerminalPC = "PC"
|
||||
TerminalMobile = "Mobile"
|
||||
)
|
||||
|
||||
var PlatformID2Name = map[int]string{
|
||||
IOSPlatformID: IOSPlatformStr,
|
||||
AndroidPlatformID: AndroidPlatformStr,
|
||||
WindowsPlatformID: WindowsPlatformStr,
|
||||
OSXPlatformID: OSXPlatformStr,
|
||||
WebPlatformID: WebPlatformStr,
|
||||
MiniWebPlatformID: MiniWebPlatformStr,
|
||||
LinuxPlatformID: LinuxPlatformStr,
|
||||
AndroidPadPlatformID: AndroidPadPlatformStr,
|
||||
IPadPlatformID: IPadPlatformStr,
|
||||
}
|
||||
var PlatformName2ID = map[string]int{
|
||||
IOSPlatformStr: IOSPlatformID,
|
||||
AndroidPlatformStr: AndroidPlatformID,
|
||||
WindowsPlatformStr: WindowsPlatformID,
|
||||
OSXPlatformStr: OSXPlatformID,
|
||||
WebPlatformStr: WebPlatformID,
|
||||
MiniWebPlatformStr: MiniWebPlatformID,
|
||||
LinuxPlatformStr: LinuxPlatformID,
|
||||
AndroidPadPlatformStr: AndroidPadPlatformID,
|
||||
IPadPlatformStr: IPadPlatformID,
|
||||
}
|
||||
var Platform2class = map[string]string{
|
||||
IOSPlatformStr: TerminalMobile,
|
||||
AndroidPlatformStr: TerminalMobile,
|
||||
MiniWebPlatformStr: WebPlatformStr,
|
||||
WebPlatformStr: WebPlatformStr,
|
||||
WindowsPlatformStr: TerminalPC,
|
||||
OSXPlatformStr: TerminalPC,
|
||||
LinuxPlatformStr: TerminalPC,
|
||||
}
|
||||
|
||||
func PlatformIDToName(num int) string {
|
||||
return PlatformID2Name[num]
|
||||
}
|
||||
func PlatformNameToID(name string) int {
|
||||
return PlatformName2ID[name]
|
||||
}
|
||||
func PlatformNameToClass(name string) string {
|
||||
return Platform2class[name]
|
||||
}
|
||||
159
go/chao-sdk-core/pkg/constant/server_api_router.go
Normal file
159
go/chao-sdk-core/pkg/constant/server_api_router.go
Normal file
@@ -0,0 +1,159 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package constant
|
||||
|
||||
const (
|
||||
GetSelfUserInfoRouter = "/user/get_self_user_info"
|
||||
GetUsersInfoRouter = "/user/get_users_info"
|
||||
UpdateSelfUserInfoRouter = "/user/update_user_info"
|
||||
UpdateSelfUserInfoExRouter = "/user/update_user_info_ex"
|
||||
SetGlobalRecvMessageOptRouter = "/user/set_global_msg_recv_opt"
|
||||
ProcessUserCommandAdd = "/user/process_user_command_add"
|
||||
ProcessUserCommandDelete = "/user/process_user_command_delete"
|
||||
ProcessUserCommandUpdate = "/user/process_user_command_update"
|
||||
ProcessUserCommandGet = "/user/process_user_command_get"
|
||||
ProcessUserCommandGetAll = "/user/process_user_command_get_all"
|
||||
|
||||
GetUsersInfoFromCacheRouter = "/user/get_users_info_from_cache"
|
||||
AccountCheck = "/user/account_check"
|
||||
UserRegister = "/user/user_register"
|
||||
SubscribeUsersStatusRouter = "/user/subscribe_users_status"
|
||||
GetSubscribeUsersStatusRouter = "/user/get_subscribe_users_status"
|
||||
GetUserStatusRouter = "/user/get_users_status"
|
||||
|
||||
AddFriendRouter = "/friend/add_friend"
|
||||
DeleteFriendRouter = "/friend/delete_friend"
|
||||
GetFriendApplicationListRouter = "/friend/get_friend_apply_list" //recv
|
||||
GetSelfFriendApplicationListRouter = "/friend/get_self_friend_apply_list" //send
|
||||
ImportFriendListRouter = "/friend/import_friend"
|
||||
|
||||
GetDesignatedFriendsApplyRouter = "/friend/get_designated_friend_apply"
|
||||
GetFriendListRouter = "/friend/get_friend_list"
|
||||
GetDesignatedFriendsRouter = "/friend/get_designated_friends"
|
||||
AddFriendResponse = "/friend/add_friend_response"
|
||||
SetFriendRemark = "/friend/set_friend_remark"
|
||||
UpdateFriends = "/friend/update_friends"
|
||||
GetIncrementalFriends = "/friend/get_incremental_friends"
|
||||
GetFullFriendUserIDs = "/friend/get_full_friend_user_ids"
|
||||
|
||||
AddBlackRouter = "/friend/add_black"
|
||||
RemoveBlackRouter = "/friend/remove_black"
|
||||
GetBlackListRouter = "/friend/get_black_list"
|
||||
|
||||
PullUserMsgRouter = "/chat/pull_msg"
|
||||
PullUserMsgBySeqRouter = "/chat/pull_msg_by_seq"
|
||||
NewestSeqRouter = "/chat/newest_seq"
|
||||
|
||||
// msg
|
||||
ClearConversationMsgRouter = RouterMsg + "/clear_conversation_msg" // Clear the message of the specified conversation
|
||||
ClearAllMsgRouter = RouterMsg + "/user_clear_all_msg" // Clear all messages of the current user
|
||||
DeleteMsgsRouter = RouterMsg + "/delete_msgs" // Delete the specified message
|
||||
RevokeMsgRouter = RouterMsg + "/revoke_msg"
|
||||
SetMessageReactionExtensionsRouter = RouterMsg + "/set_message_reaction_extensions"
|
||||
AddMessageReactionExtensionsRouter = RouterMsg + "/add_message_reaction_extensions"
|
||||
MarkMsgsAsReadRouter = RouterMsg + "/mark_msgs_as_read"
|
||||
GetConversationsHasReadAndMaxSeqRouter = RouterMsg + "/get_conversations_has_read_and_max_seq"
|
||||
|
||||
MarkConversationAsRead = RouterMsg + "/mark_conversation_as_read"
|
||||
MarkMsgsAsRead = RouterMsg + "/mark_msgs_as_read"
|
||||
SetConversationHasReadSeq = RouterMsg + "/set_conversation_has_read_seq"
|
||||
SendMsgRouter = RouterMsg + "/send_msg"
|
||||
GetServerTimeRouter = RouterMsg + "/get_server_time"
|
||||
|
||||
GetMessageListReactionExtensionsRouter = RouterMsg + "/get_message_list_reaction_extensions"
|
||||
DeleteMessageReactionExtensionsRouter = RouterMsg + "/delete_message_reaction_extensions"
|
||||
|
||||
TencentCloudStorageCredentialRouter = "/third/tencent_cloud_storage_credential"
|
||||
AliOSSCredentialRouter = "/third/ali_oss_credential"
|
||||
MinioStorageCredentialRouter = "/third/minio_storage_credential"
|
||||
AwsStorageCredentialRouter = "/third/aws_storage_credential"
|
||||
|
||||
// group
|
||||
CreateGroupRouter = RouterGroup + "/create_group"
|
||||
SetGroupInfoRouter = RouterGroup + "/set_group_info"
|
||||
JoinGroupRouter = RouterGroup + "/join_group"
|
||||
QuitGroupRouter = RouterGroup + "/quit_group"
|
||||
GetGroupsInfoRouter = RouterGroup + "/get_groups_info"
|
||||
GetGroupMemberListRouter = RouterGroup + "/get_group_member_list"
|
||||
GetGroupAllMemberListRouter = RouterGroup + "/get_group_all_member_list"
|
||||
GetGroupMembersInfoRouter = RouterGroup + "/get_group_members_info"
|
||||
InviteUserToGroupRouter = RouterGroup + "/invite_user_to_group"
|
||||
GetJoinedGroupListRouter = RouterGroup + "/get_joined_group_list"
|
||||
KickGroupMemberRouter = RouterGroup + "/kick_group"
|
||||
TransferGroupRouter = RouterGroup + "/transfer_group"
|
||||
GetRecvGroupApplicationListRouter = RouterGroup + "/get_recv_group_applicationList"
|
||||
GetSendGroupApplicationListRouter = RouterGroup + "/get_user_req_group_applicationList"
|
||||
AcceptGroupApplicationRouter = RouterGroup + "/group_application_response"
|
||||
RefuseGroupApplicationRouter = RouterGroup + "/group_application_response"
|
||||
DismissGroupRouter = RouterGroup + "/dismiss_group"
|
||||
MuteGroupMemberRouter = RouterGroup + "/mute_group_member"
|
||||
CancelMuteGroupMemberRouter = RouterGroup + "/cancel_mute_group_member"
|
||||
MuteGroupRouter = RouterGroup + "/mute_group"
|
||||
CancelMuteGroupRouter = RouterGroup + "/cancel_mute_group"
|
||||
SetGroupMemberNicknameRouter = RouterGroup + "/set_group_member_nickname"
|
||||
SetGroupMemberInfoRouter = RouterGroup + "/set_group_member_info"
|
||||
GetGroupAbstractInfoRouter = RouterGroup + "/get_group_abstract_info"
|
||||
//SearchGroupMember = RouterGroup + "/search_group_member"
|
||||
GetIncrementalJoinGroup = RouterGroup + "/get_incremental_join_group"
|
||||
GetIncrementalGroupMemberBatch = RouterGroup + "/get_incremental_group_member_batch"
|
||||
GetFullJoinedGroupIDs = RouterGroup + "/get_full_join_group_ids"
|
||||
GetFullGroupMemberUserIDs = RouterGroup + "/get_full_group_member_user_ids"
|
||||
|
||||
SetReceiveMessageOptRouter = "/conversation/set_receive_message_opt"
|
||||
GetReceiveMessageOptRouter = "/conversation/get_receive_message_opt"
|
||||
GetAllConversationMessageOptRouter = "/conversation/get_all_conversation_message_opt"
|
||||
SetConversationOptRouter = ConversationGroup + "/set_conversation"
|
||||
GetConversationsRouter = ConversationGroup + "/get_conversations"
|
||||
GetAllConversationsRouter = ConversationGroup + "/get_all_conversations"
|
||||
GetConversationRouter = ConversationGroup + "/get_conversation"
|
||||
BatchSetConversationRouter = ConversationGroup + "/batch_set_conversation"
|
||||
ModifyConversationFieldRouter = ConversationGroup + "/modify_conversation_field"
|
||||
SetConversationsRouter = ConversationGroup + "/set_conversations"
|
||||
|
||||
// organization
|
||||
GetSubDepartmentRouter = RouterOrganization + "/get_sub_department"
|
||||
GetDepartmentMemberRouter = RouterOrganization + "/get_department_member"
|
||||
ParseTokenRouter = RouterAuth + "/parse_token"
|
||||
|
||||
// super_group
|
||||
GetJoinedSuperGroupListRouter = RouterSuperGroup + "/get_joined_group_list"
|
||||
GetSuperGroupsInfoRouter = RouterSuperGroup + "/get_groups_info"
|
||||
|
||||
// third
|
||||
FcmUpdateTokenRouter = RouterThird + "/fcm_update_token"
|
||||
SetAppBadgeRouter = RouterThird + "/set_app_badge"
|
||||
UploadLogsRouter = RouterThird + "/logs/upload"
|
||||
|
||||
// auth
|
||||
GetUsersToken = RouterAuth + "/user_token"
|
||||
)
|
||||
const (
|
||||
RouterGroup = "/group"
|
||||
ConversationGroup = "/conversation"
|
||||
RouterOrganization = "/organization"
|
||||
RouterAuth = "/auth"
|
||||
RouterSuperGroup = "/super_group"
|
||||
RouterMsg = "/msg"
|
||||
RouterThird = "/third"
|
||||
)
|
||||
|
||||
const (
|
||||
ObjectPartLimit = "/object/part_limit"
|
||||
ObjectPartSize = "/object/part_size"
|
||||
ObjectInitiateMultipartUpload = "/object/initiate_multipart_upload"
|
||||
ObjectAuthSign = "/object/auth_sign"
|
||||
ObjectCompleteMultipartUpload = "/object/complete_multipart_upload"
|
||||
ObjectAccessURL = "/object/access_url"
|
||||
)
|
||||
62
go/chao-sdk-core/pkg/constant/server_error.go
Normal file
62
go/chao-sdk-core/pkg/constant/server_error.go
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package constant
|
||||
|
||||
//
|
||||
//var (
|
||||
// ErrServer = ErrInfo{500, "server error"}
|
||||
//
|
||||
// ErrTokenDifferentPlatformID = ErrInfo{707, TokenDifferentPlatformIDMsg.Error()}
|
||||
// ErrTokenDifferentUserID = ErrInfo{708, TokenDifferentUserIDMsg.Error()}
|
||||
//
|
||||
// ErrStatus = ErrInfo{ErrCode: 804, ErrMsg: StatusMsg.Error()}
|
||||
// ErrCallback = ErrInfo{ErrCode: 809, ErrMsg: CallBackMsg.Error()}
|
||||
// ErrSendLimit = ErrInfo{ErrCode: 810, ErrMsg: "send msg limit, to many request, try again later"}
|
||||
// ErrMessageHasReadDisable = ErrInfo{ErrCode: 811, ErrMsg: "message has read disable"}
|
||||
// ErrInternal = ErrInfo{ErrCode: 812, ErrMsg: "internal error"}
|
||||
//)
|
||||
//
|
||||
//var (
|
||||
// TokenDifferentPlatformIDMsg = errors.New("different platformID")
|
||||
// TokenDifferentUserIDMsg = errors.New("different userID")
|
||||
//
|
||||
// StatusMsg = errors.New("status is abnormal")
|
||||
//
|
||||
// CallBackMsg = errors.New("callback failed")
|
||||
//)
|
||||
//
|
||||
//const (
|
||||
// NoError = 0
|
||||
// FormattingError = 10001
|
||||
// HasRegistered = 10002
|
||||
// NotRegistered = 10003
|
||||
// PasswordErr = 10004
|
||||
// GetIMTokenErr = 10005
|
||||
// RepeatSendCode = 10006
|
||||
// MailSendCodeErr = 10007
|
||||
// SmsSendCodeErr = 10008
|
||||
// CodeInvalidOrExpired = 10009
|
||||
// RegisterFailed = 10010
|
||||
// ResetPasswordFailed = 10011
|
||||
// DatabaseError = 10002
|
||||
// ServerError = 10004
|
||||
// HttpError = 10005
|
||||
// IoError = 10006
|
||||
// IntentionalError = 10007
|
||||
//)
|
||||
//
|
||||
//funcation (e *ErrInfo) Code() int32 {
|
||||
// return e.ErrCode
|
||||
//}
|
||||
Reference in New Issue
Block a user