mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 13:12:12 +08:00
rpc client
This commit is contained in:
parent
fc6569b719
commit
a53fe0bfc4
10
go.mod
10
go.mod
@ -14,8 +14,8 @@ require (
|
|||||||
github.com/gorilla/websocket v1.5.1
|
github.com/gorilla/websocket v1.5.1
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||||
github.com/mitchellh/mapstructure v1.5.0
|
github.com/mitchellh/mapstructure v1.5.0
|
||||||
github.com/openimsdk/protocol v0.0.72-alpha.67
|
github.com/openimsdk/protocol v0.0.72-alpha.68
|
||||||
github.com/openimsdk/tools v0.0.50-alpha.58
|
github.com/openimsdk/tools v0.0.50-alpha.60
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/prometheus/client_golang v1.18.0
|
github.com/prometheus/client_golang v1.18.0
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
@ -221,9 +221,3 @@ require (
|
|||||||
golang.org/x/crypto v0.27.0 // indirect
|
golang.org/x/crypto v0.27.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
replace (
|
|
||||||
github.com/openimsdk/protocol => /Users/chao/Desktop/code/protocol
|
|
||||||
github.com/openimsdk/tools => /Users/chao/Desktop/code/tools
|
|
||||||
)
|
|
||||||
8
go.sum
8
go.sum
@ -347,10 +347,10 @@ github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y=
|
|||||||
github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
|
github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
|
||||||
github.com/openimsdk/gomake v0.0.15-alpha.2 h1:5Q8yl8ezy2yx+q8/ucU/t4kJnDfCzNOrkXcDACCqtyM=
|
github.com/openimsdk/gomake v0.0.15-alpha.2 h1:5Q8yl8ezy2yx+q8/ucU/t4kJnDfCzNOrkXcDACCqtyM=
|
||||||
github.com/openimsdk/gomake v0.0.15-alpha.2/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
|
github.com/openimsdk/gomake v0.0.15-alpha.2/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
|
||||||
github.com/openimsdk/protocol v0.0.72-alpha.67 h1:zlLbVkoT0OYsjO2RCutQuDFllcfNvZfdYchvlR6UIe0=
|
github.com/openimsdk/protocol v0.0.72-alpha.68 h1:Ekn6S9Ftt12Xs/p9kJ39RDr2gSwIczz+MmSHQE4lAek=
|
||||||
github.com/openimsdk/protocol v0.0.72-alpha.67/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M=
|
github.com/openimsdk/protocol v0.0.72-alpha.68/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M=
|
||||||
github.com/openimsdk/tools v0.0.50-alpha.58 h1:hkFL02Bzzp/l5x+tb7kJ9zes7hilh65EQ4qEIthsQX4=
|
github.com/openimsdk/tools v0.0.50-alpha.60 h1:dYqYpSdSN5o6CxlEjua2USfwfUiG0tUWFBpqghTjbWE=
|
||||||
github.com/openimsdk/tools v0.0.50-alpha.58/go.mod h1:muCtxguNJv8lFwLei27UASu2Nvg4ERSeN0R4K5tivk0=
|
github.com/openimsdk/tools v0.0.50-alpha.60/go.mod h1:muCtxguNJv8lFwLei27UASu2Nvg4ERSeN0R4K5tivk0=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||||
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
|
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
|
||||||
|
|||||||
@ -126,6 +126,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
|
|||||||
config: config,
|
config: config,
|
||||||
webhookClient: webhook.NewWebhookClient(config.WebhooksConfig.URL),
|
webhookClient: webhook.NewWebhookClient(config.WebhooksConfig.URL),
|
||||||
queue: memamq.NewMemoryQueue(16, 1024*1024),
|
queue: memamq.NewMemoryQueue(16, 1024*1024),
|
||||||
|
userClient: userClient,
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,7 @@ func (c *ConversationLocalCache) GetConversation(ctx context.Context, userID, co
|
|||||||
var cache cacheProto[pbconversation.Conversation]
|
var cache cacheProto[pbconversation.Conversation]
|
||||||
return cache.Unmarshal(c.local.Get(ctx, cachekey.GetConversationKey(userID, conversationID), func(ctx context.Context) ([]byte, error) {
|
return cache.Unmarshal(c.local.Get(ctx, cachekey.GetConversationKey(userID, conversationID), func(ctx context.Context) ([]byte, error) {
|
||||||
log.ZDebug(ctx, "ConversationLocalCache GetConversation rpc", "userID", userID, "conversationID", conversationID)
|
log.ZDebug(ctx, "ConversationLocalCache GetConversation rpc", "userID", userID, "conversationID", conversationID)
|
||||||
return cache.Marshal(c.client.GetConversation(ctx, userID, conversationID))
|
return cache.Marshal(c.client.GetConversation(ctx, conversationID, userID))
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,9 @@ type AuthClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *AuthClient) KickTokens(ctx context.Context, tokens []string) error {
|
func (x *AuthClient) KickTokens(ctx context.Context, tokens []string) error {
|
||||||
|
if len(tokens) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return ignoreResp(x.AuthClient.KickTokens(ctx, &auth.KickTokensReq{Tokens: tokens}))
|
return ignoreResp(x.AuthClient.KickTokens(ctx, &auth.KickTokensReq{Tokens: tokens}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,16 +15,25 @@ type ConversationClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConversationClient) SetConversationMaxSeq(ctx context.Context, conversationID string, ownerUserIDs []string, maxSeq int64) error {
|
func (x *ConversationClient) SetConversationMaxSeq(ctx context.Context, conversationID string, ownerUserIDs []string, maxSeq int64) error {
|
||||||
|
if len(ownerUserIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
req := &conversation.SetConversationMaxSeqReq{ConversationID: conversationID, OwnerUserID: ownerUserIDs, MaxSeq: maxSeq}
|
req := &conversation.SetConversationMaxSeqReq{ConversationID: conversationID, OwnerUserID: ownerUserIDs, MaxSeq: maxSeq}
|
||||||
return ignoreResp(x.ConversationClient.SetConversationMaxSeq(ctx, req))
|
return ignoreResp(x.ConversationClient.SetConversationMaxSeq(ctx, req))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConversationClient) SetConversations(ctx context.Context, userIDs []string, info *conversation.ConversationReq) error {
|
func (x *ConversationClient) SetConversations(ctx context.Context, ownerUserIDs []string, info *conversation.ConversationReq) error {
|
||||||
req := &conversation.SetConversationsReq{UserIDs: userIDs, Conversation: info}
|
if len(ownerUserIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
req := &conversation.SetConversationsReq{UserIDs: ownerUserIDs, Conversation: info}
|
||||||
return ignoreResp(x.ConversationClient.SetConversations(ctx, req))
|
return ignoreResp(x.ConversationClient.SetConversations(ctx, req))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConversationClient) GetConversationsByConversationIDs(ctx context.Context, conversationIDs []string) ([]*conversation.Conversation, error) {
|
func (x *ConversationClient) GetConversationsByConversationIDs(ctx context.Context, conversationIDs []string) ([]*conversation.Conversation, error) {
|
||||||
|
if len(conversationIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &conversation.GetConversationsByConversationIDReq{ConversationIDs: conversationIDs}
|
req := &conversation.GetConversationsByConversationIDReq{ConversationIDs: conversationIDs}
|
||||||
return extractField(ctx, x.ConversationClient.GetConversationsByConversationID, req, (*conversation.GetConversationsByConversationIDResp).GetConversations)
|
return extractField(ctx, x.ConversationClient.GetConversationsByConversationID, req, (*conversation.GetConversationsByConversationIDResp).GetConversations)
|
||||||
}
|
}
|
||||||
@ -34,6 +43,9 @@ func (x *ConversationClient) GetConversationsByConversationID(ctx context.Contex
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConversationClient) SetConversationMinSeq(ctx context.Context, conversationID string, ownerUserIDs []string, minSeq int64) error {
|
func (x *ConversationClient) SetConversationMinSeq(ctx context.Context, conversationID string, ownerUserIDs []string, minSeq int64) error {
|
||||||
|
if len(ownerUserIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
req := &conversation.SetConversationMinSeqReq{ConversationID: conversationID, OwnerUserID: ownerUserIDs, MinSeq: minSeq}
|
req := &conversation.SetConversationMinSeqReq{ConversationID: conversationID, OwnerUserID: ownerUserIDs, MinSeq: minSeq}
|
||||||
return ignoreResp(x.ConversationClient.SetConversationMinSeq(ctx, req))
|
return ignoreResp(x.ConversationClient.SetConversationMinSeq(ctx, req))
|
||||||
}
|
}
|
||||||
@ -44,6 +56,9 @@ func (x *ConversationClient) GetConversation(ctx context.Context, conversationID
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConversationClient) GetConversations(ctx context.Context, conversationIDs []string, ownerUserID string) ([]*conversation.Conversation, error) {
|
func (x *ConversationClient) GetConversations(ctx context.Context, conversationIDs []string, ownerUserID string) ([]*conversation.Conversation, error) {
|
||||||
|
if len(conversationIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &conversation.GetConversationsReq{ConversationIDs: conversationIDs, OwnerUserID: ownerUserID}
|
req := &conversation.GetConversationsReq{ConversationIDs: conversationIDs, OwnerUserID: ownerUserID}
|
||||||
return extractField(ctx, x.ConversationClient.GetConversations, req, (*conversation.GetConversationsResp).GetConversations)
|
return extractField(ctx, x.ConversationClient.GetConversations, req, (*conversation.GetConversationsResp).GetConversations)
|
||||||
}
|
}
|
||||||
@ -59,6 +74,9 @@ func (x *ConversationClient) GetPinnedConversationIDs(ctx context.Context, owner
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConversationClient) CreateGroupChatConversations(ctx context.Context, groupID string, userIDs []string) error {
|
func (x *ConversationClient) CreateGroupChatConversations(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
|
if len(userIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
req := &conversation.CreateGroupChatConversationsReq{GroupID: groupID, UserIDs: userIDs}
|
req := &conversation.CreateGroupChatConversationsReq{GroupID: groupID, UserIDs: userIDs}
|
||||||
return ignoreResp(x.ConversationClient.CreateGroupChatConversations(ctx, req))
|
return ignoreResp(x.ConversationClient.CreateGroupChatConversations(ctx, req))
|
||||||
}
|
}
|
||||||
@ -68,6 +86,9 @@ func (x *ConversationClient) CreateSingleChatConversations(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConversationClient) GetConversationOfflinePushUserIDs(ctx context.Context, conversationID string, userIDs []string) ([]string, error) {
|
func (x *ConversationClient) GetConversationOfflinePushUserIDs(ctx context.Context, conversationID string, userIDs []string) ([]string, error) {
|
||||||
|
if len(userIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &conversation.GetConversationOfflinePushUserIDsReq{ConversationID: conversationID, UserIDs: userIDs}
|
req := &conversation.GetConversationOfflinePushUserIDsReq{ConversationID: conversationID, UserIDs: userIDs}
|
||||||
return extractField(ctx, x.ConversationClient.GetConversationOfflinePushUserIDs, req, (*conversation.GetConversationOfflinePushUserIDsResp).GetUserIDs)
|
return extractField(ctx, x.ConversationClient.GetConversationOfflinePushUserIDs, req, (*conversation.GetConversationOfflinePushUserIDsResp).GetUserIDs)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,9 @@ type GroupClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *GroupClient) GetGroupsInfo(ctx context.Context, groupIDs []string) ([]*sdkws.GroupInfo, error) {
|
func (x *GroupClient) GetGroupsInfo(ctx context.Context, groupIDs []string) ([]*sdkws.GroupInfo, error) {
|
||||||
|
if len(groupIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &group.GetGroupsInfoReq{GroupIDs: groupIDs}
|
req := &group.GetGroupsInfoReq{GroupIDs: groupIDs}
|
||||||
return extractField(ctx, x.GroupClient.GetGroupsInfo, req, (*group.GetGroupsInfoResp).GetGroupInfos)
|
return extractField(ctx, x.GroupClient.GetGroupsInfo, req, (*group.GetGroupsInfoResp).GetGroupInfos)
|
||||||
}
|
}
|
||||||
@ -30,7 +33,7 @@ func (x *GroupClient) GetGroupInfoCache(ctx context.Context, groupID string) (*s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *GroupClient) GetGroupMemberCache(ctx context.Context, groupID string, userID string) (*sdkws.GroupMemberFullInfo, error) {
|
func (x *GroupClient) GetGroupMemberCache(ctx context.Context, groupID string, userID string) (*sdkws.GroupMemberFullInfo, error) {
|
||||||
req := &group.GetGroupMemberCacheReq{GroupID: groupID}
|
req := &group.GetGroupMemberCacheReq{GroupID: groupID, GroupMemberID: userID}
|
||||||
return extractField(ctx, x.GroupClient.GetGroupMemberCache, req, (*group.GetGroupMemberCacheResp).GetMember)
|
return extractField(ctx, x.GroupClient.GetGroupMemberCache, req, (*group.GetGroupMemberCacheResp).GetMember)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,26 +16,41 @@ type MsgClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) GetMaxSeqs(ctx context.Context, conversationIDs []string) (map[string]int64, error) {
|
func (x *MsgClient) GetMaxSeqs(ctx context.Context, conversationIDs []string) (map[string]int64, error) {
|
||||||
|
if len(conversationIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &msg.GetMaxSeqsReq{ConversationIDs: conversationIDs}
|
req := &msg.GetMaxSeqsReq{ConversationIDs: conversationIDs}
|
||||||
return extractField(ctx, x.MsgClient.GetMaxSeqs, req, (*msg.SeqsInfoResp).GetMaxSeqs)
|
return extractField(ctx, x.MsgClient.GetMaxSeqs, req, (*msg.SeqsInfoResp).GetMaxSeqs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) GetMsgByConversationIDs(ctx context.Context, conversationIDs []string, maxSeqs map[string]int64) (map[string]*sdkws.MsgData, error) {
|
func (x *MsgClient) GetMsgByConversationIDs(ctx context.Context, conversationIDs []string, maxSeqs map[string]int64) (map[string]*sdkws.MsgData, error) {
|
||||||
|
if len(conversationIDs) == 0 || len(maxSeqs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &msg.GetMsgByConversationIDsReq{ConversationIDs: conversationIDs, MaxSeqs: maxSeqs}
|
req := &msg.GetMsgByConversationIDsReq{ConversationIDs: conversationIDs, MaxSeqs: maxSeqs}
|
||||||
return extractField(ctx, x.MsgClient.GetMsgByConversationIDs, req, (*msg.GetMsgByConversationIDsResp).GetMsgDatas)
|
return extractField(ctx, x.MsgClient.GetMsgByConversationIDs, req, (*msg.GetMsgByConversationIDsResp).GetMsgDatas)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) GetHasReadSeqs(ctx context.Context, conversationIDs []string, userID string) (map[string]int64, error) {
|
func (x *MsgClient) GetHasReadSeqs(ctx context.Context, conversationIDs []string, userID string) (map[string]int64, error) {
|
||||||
|
if len(conversationIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &msg.GetHasReadSeqsReq{ConversationIDs: conversationIDs, UserID: userID}
|
req := &msg.GetHasReadSeqsReq{ConversationIDs: conversationIDs, UserID: userID}
|
||||||
return extractField(ctx, x.MsgClient.GetHasReadSeqs, req, (*msg.SeqsInfoResp).GetMaxSeqs)
|
return extractField(ctx, x.MsgClient.GetHasReadSeqs, req, (*msg.SeqsInfoResp).GetMaxSeqs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) SetUserConversationMaxSeq(ctx context.Context, conversationID string, ownerUserIDs []string, maxSeq int64) error {
|
func (x *MsgClient) SetUserConversationMaxSeq(ctx context.Context, conversationID string, ownerUserIDs []string, maxSeq int64) error {
|
||||||
|
if len(ownerUserIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
req := &msg.SetUserConversationMaxSeqReq{ConversationID: conversationID, OwnerUserID: ownerUserIDs, MaxSeq: maxSeq}
|
req := &msg.SetUserConversationMaxSeqReq{ConversationID: conversationID, OwnerUserID: ownerUserIDs, MaxSeq: maxSeq}
|
||||||
return ignoreResp(x.MsgClient.SetUserConversationMaxSeq(ctx, req))
|
return ignoreResp(x.MsgClient.SetUserConversationMaxSeq(ctx, req))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) SetUserConversationMin(ctx context.Context, conversationID string, ownerUserIDs []string, minSeq int64) error {
|
func (x *MsgClient) SetUserConversationMin(ctx context.Context, conversationID string, ownerUserIDs []string, minSeq int64) error {
|
||||||
|
if len(ownerUserIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
req := &msg.SetUserConversationsMinSeqReq{ConversationID: conversationID, UserIDs: ownerUserIDs, Seq: minSeq}
|
req := &msg.SetUserConversationsMinSeqReq{ConversationID: conversationID, UserIDs: ownerUserIDs, Seq: minSeq}
|
||||||
return ignoreResp(x.MsgClient.SetUserConversationsMinSeq(ctx, req))
|
return ignoreResp(x.MsgClient.SetUserConversationsMinSeq(ctx, req))
|
||||||
}
|
}
|
||||||
@ -51,16 +66,25 @@ func (x *MsgClient) GetConversationMaxSeq(ctx context.Context, conversationID st
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) GetActiveConversation(ctx context.Context, conversationIDs []string) ([]*msg.ActiveConversation, error) {
|
func (x *MsgClient) GetActiveConversation(ctx context.Context, conversationIDs []string) ([]*msg.ActiveConversation, error) {
|
||||||
|
if len(conversationIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &msg.GetActiveConversationReq{ConversationIDs: conversationIDs}
|
req := &msg.GetActiveConversationReq{ConversationIDs: conversationIDs}
|
||||||
return extractField(ctx, x.MsgClient.GetActiveConversation, req, (*msg.GetActiveConversationResp).GetConversations)
|
return extractField(ctx, x.MsgClient.GetActiveConversation, req, (*msg.GetActiveConversationResp).GetConversations)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) GetSeqMessage(ctx context.Context, userID string, conversations []*msg.ConversationSeqs) (map[string]*sdkws.PullMsgs, error) {
|
func (x *MsgClient) GetSeqMessage(ctx context.Context, userID string, conversations []*msg.ConversationSeqs) (map[string]*sdkws.PullMsgs, error) {
|
||||||
|
if len(conversations) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &msg.GetSeqMessageReq{UserID: userID, Conversations: conversations}
|
req := &msg.GetSeqMessageReq{UserID: userID, Conversations: conversations}
|
||||||
return extractField(ctx, x.MsgClient.GetSeqMessage, req, (*msg.GetSeqMessageResp).GetMsgs)
|
return extractField(ctx, x.MsgClient.GetSeqMessage, req, (*msg.GetSeqMessageResp).GetMsgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MsgClient) SetUserConversationsMinSeq(ctx context.Context, conversationID string, userIDs []string, seq int64) error {
|
func (x *MsgClient) SetUserConversationsMinSeq(ctx context.Context, conversationID string, userIDs []string, seq int64) error {
|
||||||
|
if len(userIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
req := &msg.SetUserConversationsMinSeqReq{ConversationID: conversationID, UserIDs: userIDs, Seq: seq}
|
req := &msg.SetUserConversationsMinSeqReq{ConversationID: conversationID, UserIDs: userIDs, Seq: seq}
|
||||||
return ignoreResp(x.MsgClient.SetUserConversationsMinSeq(ctx, req))
|
return ignoreResp(x.MsgClient.SetUserConversationsMinSeq(ctx, req))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,9 @@ type RelationClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *RelationClient) GetFriendsInfo(ctx context.Context, ownerUserID string, friendUserIDs []string) ([]*relation.FriendInfoOnly, error) {
|
func (x *RelationClient) GetFriendsInfo(ctx context.Context, ownerUserID string, friendUserIDs []string) ([]*relation.FriendInfoOnly, error) {
|
||||||
|
if len(friendUserIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &relation.GetFriendInfoReq{OwnerUserID: ownerUserID, FriendUserIDs: friendUserIDs}
|
req := &relation.GetFriendInfoReq{OwnerUserID: ownerUserID, FriendUserIDs: friendUserIDs}
|
||||||
return extractField(ctx, x.FriendClient.GetFriendInfo, req, (*relation.GetFriendInfoResp).GetFriendInfos)
|
return extractField(ctx, x.FriendClient.GetFriendInfo, req, (*relation.GetFriendInfoResp).GetFriendInfos)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,9 @@ type UserClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserClient) GetUsersInfo(ctx context.Context, userIDs []string) ([]*sdkws.UserInfo, error) {
|
func (x *UserClient) GetUsersInfo(ctx context.Context, userIDs []string) ([]*sdkws.UserInfo, error) {
|
||||||
|
if len(userIDs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
req := &user.GetDesignateUsersReq{UserIDs: userIDs}
|
req := &user.GetDesignateUsersReq{UserIDs: userIDs}
|
||||||
return extractField(ctx, x.UserClient.GetDesignateUsers, req, (*user.GetDesignateUsersResp).GetUsersInfo)
|
return extractField(ctx, x.UserClient.GetDesignateUsers, req, (*user.GetDesignateUsersResp).GetUsersInfo)
|
||||||
}
|
}
|
||||||
@ -27,6 +30,9 @@ func (x *UserClient) GetUserInfo(ctx context.Context, userID string) (*sdkws.Use
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserClient) CheckUser(ctx context.Context, userIDs []string) error {
|
func (x *UserClient) CheckUser(ctx context.Context, userIDs []string) error {
|
||||||
|
if len(userIDs) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
users, err := x.GetUsersInfo(ctx, userIDs)
|
users, err := x.GetUsersInfo(ctx, userIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -73,14 +79,14 @@ func (x *UserClient) GetUserOnlinePlatform(ctx context.Context, userID string) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserClient) SetUserOnlineStatus(ctx context.Context, req *user.SetUserOnlineStatusReq) error {
|
func (x *UserClient) SetUserOnlineStatus(ctx context.Context, req *user.SetUserOnlineStatusReq) error {
|
||||||
|
if len(req.Status) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return ignoreResp(x.UserClient.SetUserOnlineStatus(ctx, req))
|
return ignoreResp(x.UserClient.SetUserOnlineStatus(ctx, req))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserClient) GetNotificationByID(ctx context.Context, userID string) error {
|
func (x *UserClient) GetNotificationByID(ctx context.Context, userID string) error {
|
||||||
_, err := x.UserClient.GetNotificationAccount(ctx, &user.GetNotificationAccountReq{
|
return ignoreResp(x.UserClient.GetNotificationAccount(ctx, &user.GetNotificationAccountReq{UserID: userID}))
|
||||||
UserID: userID,
|
|
||||||
})
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *UserClient) GetAllUserIDs(ctx context.Context, pageNumber, showNumber int32) ([]string, error) {
|
func (x *UserClient) GetAllUserIDs(ctx context.Context, pageNumber, showNumber int32) ([]string, error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user