mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-04 09:05:59 +08:00
style: add format
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
+38
-8
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||
@@ -11,7 +13,6 @@ import (
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type Group struct {
|
||||
@@ -35,7 +36,11 @@ func NewGroupRpcClient(discov discoveryregistry.SvcDiscoveryRegistry) GroupRpcCl
|
||||
return GroupRpcClient(*NewGroup(discov))
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) GetGroupInfos(ctx context.Context, groupIDs []string, complete bool) ([]*sdkws.GroupInfo, error) {
|
||||
func (g *GroupRpcClient) GetGroupInfos(
|
||||
ctx context.Context,
|
||||
groupIDs []string,
|
||||
complete bool,
|
||||
) ([]*sdkws.GroupInfo, error) {
|
||||
resp, err := g.Client.GetGroupsInfo(ctx, &group.GetGroupsInfoReq{
|
||||
GroupIDs: groupIDs,
|
||||
})
|
||||
@@ -60,7 +65,11 @@ func (g *GroupRpcClient) GetGroupInfo(ctx context.Context, groupID string) (*sdk
|
||||
return groups[0], nil
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) GetGroupInfoMap(ctx context.Context, groupIDs []string, complete bool) (map[string]*sdkws.GroupInfo, error) {
|
||||
func (g *GroupRpcClient) GetGroupInfoMap(
|
||||
ctx context.Context,
|
||||
groupIDs []string,
|
||||
complete bool,
|
||||
) (map[string]*sdkws.GroupInfo, error) {
|
||||
groups, err := g.GetGroupInfos(ctx, groupIDs, complete)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -70,7 +79,12 @@ func (g *GroupRpcClient) GetGroupInfoMap(ctx context.Context, groupIDs []string,
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) GetGroupMemberInfos(ctx context.Context, groupID string, userIDs []string, complete bool) ([]*sdkws.GroupMemberFullInfo, error) {
|
||||
func (g *GroupRpcClient) GetGroupMemberInfos(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
userIDs []string,
|
||||
complete bool,
|
||||
) ([]*sdkws.GroupMemberFullInfo, error) {
|
||||
resp, err := g.Client.GetGroupMembersInfo(ctx, &group.GetGroupMembersInfoReq{
|
||||
GroupID: groupID,
|
||||
UserIDs: userIDs,
|
||||
@@ -88,7 +102,11 @@ func (g *GroupRpcClient) GetGroupMemberInfos(ctx context.Context, groupID string
|
||||
return resp.Members, nil
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) GetGroupMemberInfo(ctx context.Context, groupID string, userID string) (*sdkws.GroupMemberFullInfo, error) {
|
||||
func (g *GroupRpcClient) GetGroupMemberInfo(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
userID string,
|
||||
) (*sdkws.GroupMemberFullInfo, error) {
|
||||
members, err := g.GetGroupMemberInfos(ctx, groupID, []string{userID}, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -96,7 +114,12 @@ func (g *GroupRpcClient) GetGroupMemberInfo(ctx context.Context, groupID string,
|
||||
return members[0], nil
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) GetGroupMemberInfoMap(ctx context.Context, groupID string, userIDs []string, complete bool) (map[string]*sdkws.GroupMemberFullInfo, error) {
|
||||
func (g *GroupRpcClient) GetGroupMemberInfoMap(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
userIDs []string,
|
||||
complete bool,
|
||||
) (map[string]*sdkws.GroupMemberFullInfo, error) {
|
||||
members, err := g.GetGroupMemberInfos(ctx, groupID, userIDs, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -106,7 +129,10 @@ func (g *GroupRpcClient) GetGroupMemberInfoMap(ctx context.Context, groupID stri
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) GetOwnerAndAdminInfos(ctx context.Context, groupID string) ([]*sdkws.GroupMemberFullInfo, error) {
|
||||
func (g *GroupRpcClient) GetOwnerAndAdminInfos(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
) ([]*sdkws.GroupMemberFullInfo, error) {
|
||||
resp, err := g.Client.GetGroupMemberRoleLevel(ctx, &group.GetGroupMemberRoleLevelReq{
|
||||
GroupID: groupID,
|
||||
RoleLevels: []int32{constant.GroupOwner, constant.GroupAdmin},
|
||||
@@ -145,7 +171,11 @@ func (g *GroupRpcClient) GetGroupInfoCache(ctx context.Context, groupID string)
|
||||
return resp.GroupInfo, nil
|
||||
}
|
||||
|
||||
func (g *GroupRpcClient) GetGroupMemberCache(ctx context.Context, groupID string, groupMemberID string) (*sdkws.GroupMemberFullInfo, error) {
|
||||
func (g *GroupRpcClient) GetGroupMemberCache(
|
||||
ctx context.Context,
|
||||
groupID string,
|
||||
groupMemberID string,
|
||||
) (*sdkws.GroupMemberFullInfo, error) {
|
||||
resp, err := g.Client.GetGroupMemberCache(ctx, &group.GetGroupMemberCacheReq{
|
||||
GroupID: groupID,
|
||||
GroupMemberID: groupMemberID,
|
||||
|
||||
Reference in New Issue
Block a user