diff --git a/go.mod b/go.mod index 21e6e2241..9fcf500a5 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,6 @@ require ( github.com/robfig/cron/v3 v3.0.1 github.com/sirupsen/logrus v1.9.2 // indirect github.com/stretchr/testify v1.8.3 - github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca go.mongodb.org/mongo-driver v1.8.3 golang.org/x/image v0.3.0 google.golang.org/api v0.114.0 diff --git a/go.sum b/go.sum index e95d2e81e..9acc8ff8f 100644 --- a/go.sum +++ b/go.sum @@ -426,8 +426,6 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.194/go.mod h1:yrBKWhChnDqNz1xuXdSbWXG56XawEq0G5j1lg4VwBD4= github.com/tencentyun/cos-go-sdk-v5 v0.7.41 h1:iU0Li/Np78H4SBna0ECQoF3mpgi6ImLXU+doGzPFXGc= github.com/tencentyun/cos-go-sdk-v5 v0.7.41/go.mod h1:4dCEtLHGh8QPxHEkgq+nFaky7yZxQuYwgSJM87icDaw= -github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca h1:G/aIr3WiUesWHL2YGYgEqjM5tCAJ43Ml+0C18wDkWWs= -github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= diff --git a/install_im_compose.sh b/install_im_compose.sh new file mode 100755 index 000000000..687a827d1 --- /dev/null +++ b/install_im_compose.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +internet_ip=`curl ifconfig.me -s` +echo $internet_ip + +source .env +echo $MINIO_ENDPOINT +if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then + sed -i "s/127.0.0.1/${internet_ip}/" .env + +fi + +cd scripts ; +chmod +x *.sh ; +./init_pwd.sh +./env_check.sh; +cd .. ; +docker-compose -f im-compose.yaml up -d +docker ps + + + diff --git a/install_im_server.sh b/install_im_server.sh new file mode 100755 index 000000000..c526d43db --- /dev/null +++ b/install_im_server.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# Get the public internet IP address +internet_ip=$(curl ifconfig.me -s) +echo $internet_ip + +# Load environment variables from .env file +source .env +echo $MINIO_ENDPOINT + +# Replace local IP address with the public IP address in .env file +if [ $API_URL == "http://127.0.0.1:10002/object/" ]; then + sed -i "s/127.0.0.1/${internet_ip}/" .env +fi + +if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then + sed -i "s/127.0.0.1/${internet_ip}/" .env +fi + +# Change directory to scripts folder +cd scripts +chmod +x *.sh + +# Execute necessary scripts +./init_pwd.sh +./env_check.sh + +# Go back to the previous directory +cd .. + +# Check if docker-compose command is available +if command -v docker-compose &> /dev/null +then + docker-compose up -d +else + docker compose up -d +fi + +# Change directory to scripts folder again +cd scripts + +# Check docker services +./docker_check_service.sh \ No newline at end of file diff --git a/internal/api/user.go b/internal/api/user.go index 67c042ea4..604238965 100644 --- a/internal/api/user.go +++ b/internal/api/user.go @@ -86,7 +86,6 @@ func (u *UserApi) GetUsersOnlineStatus(c *gin.Context) { log.ZWarn(c, "GetUsersOnlineStatus rpc err", err) parseError := apiresp.ParseError(err) - log.ZDebug(c, "errcode bantanger", "errcode", parseError.ErrCode) if parseError.ErrCode == errs.NoPermissionError { apiresp.GinError(c, err) return diff --git a/internal/push/offlinepush/offlinepush_interface.go b/internal/push/offlinepush/offlinepush_interface.go index a5d4051f9..5aa7e089f 100644 --- a/internal/push/offlinepush/offlinepush_interface.go +++ b/internal/push/offlinepush/offlinepush_interface.go @@ -18,12 +18,12 @@ import ( "context" ) -// OfflinePusher Offline Pusher. +// OfflinePusher Offline Pusher type OfflinePusher interface { Push(ctx context.Context, userIDs []string, title, content string, opts *Opts) error } -// Opts opts. +// Opts opts type Opts struct { Signal *Signal IOSPushSound string @@ -31,7 +31,7 @@ type Opts struct { Ex string } -// Signal message id. +// Signal message id type Signal struct { ClientMsgID string } diff --git a/pkg/apistruct/manage.go b/pkg/apistruct/manage.go index 6a92f40aa..d3c24d544 100644 --- a/pkg/apistruct/manage.go +++ b/pkg/apistruct/manage.go @@ -33,7 +33,7 @@ type SendMsg struct { } type SendMsgReq struct { - RecvID string `json:"recvID" binding:"required_if" message:"recvID is required if sessionType is SingleChatType or NotificationChatType"` + RecvID string `json:"recvID" binding:"required_if" message:"recvID is required if sessionType is SingleChatType or NotificationChatType"` SendMsg } diff --git a/pkg/common/mw/rpc_server_interceptor.go b/pkg/common/mw/rpc_server_interceptor.go index ec43069da..0dba76103 100644 --- a/pkg/common/mw/rpc_server_interceptor.go +++ b/pkg/common/mw/rpc_server_interceptor.go @@ -38,6 +38,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/errinfo" ) +// rpcString func rpcString(v interface{}) string { if s, ok := v.(interface{ String() string }); ok { return s.String() @@ -45,6 +46,7 @@ func rpcString(v interface{}) string { return fmt.Sprintf("%+v", v) } +// RpcServerInterceptor func RpcServerInterceptor( ctx context.Context, req interface{}, @@ -52,7 +54,7 @@ func RpcServerInterceptor( handler grpc.UnaryHandler, ) (resp interface{}, err error) { log.ZDebug(ctx, "rpc server req", "req", rpcString(req)) - //defer func() { + // defer func() { // if r := recover(); r != nil { // log.ZError(ctx, "rpc panic", nil, "FullMethod", info.FullMethod, "type:", fmt.Sprintf("%T", r), "panic:", r) // fmt.Printf("panic: %+v\nstack info: %s\n", r, string(debug.Stack())) @@ -74,7 +76,7 @@ func RpcServerInterceptor( // } // err = sta.Err() // } - //}() + // }() funcName := info.FullMethod md, ok := metadata.FromIncomingContext(ctx) if !ok { @@ -133,8 +135,8 @@ func RpcServerInterceptor( var errInfo *errinfo.ErrorInfo if config.Config.Log.WithStack { if unwrap != err { - sti, ok := err.(interface{ StackTrace() errors.StackTrace }) - if ok { + var sti interface{ StackTrace() errors.StackTrace } + if errors.As(err, &sti) { log.ZWarn( ctx, "rpc server resp", @@ -173,9 +175,11 @@ func RpcServerInterceptor( return nil, errs.Wrap(err) } log.ZWarn(ctx, "rpc server resp", err, "funcName", funcName) + return nil, details.Err() } +// GrpcServer func GrpcServer() grpc.ServerOption { return grpc.ChainUnaryInterceptor(RpcServerInterceptor) } diff --git a/pkg/common/mw/specialerror/error.go b/pkg/common/mw/specialerror/error.go index b8b8d27ae..c2c6de0fe 100644 --- a/pkg/common/mw/specialerror/error.go +++ b/pkg/common/mw/specialerror/error.go @@ -14,10 +14,15 @@ package specialerror -import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +import ( + "errors" + + "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +) var handlers []func(err error) errs.CodeError +// AddErrHandler func AddErrHandler(h func(err error) errs.CodeError) { if h == nil { panic("nil handler") @@ -27,13 +32,15 @@ func AddErrHandler(h func(err error) errs.CodeError) { func AddReplace(target error, codeErr errs.CodeError) { AddErrHandler(func(err error) errs.CodeError { - if err == target { + if errors.Is(err, target) { return codeErr } + return nil }) } +// ErrCode func ErrCode(err error) errs.CodeError { if codeErr, ok := err.(errs.CodeError); ok { return codeErr @@ -43,5 +50,6 @@ func ErrCode(err error) errs.CodeError { return codeErr } } + return nil } diff --git a/pkg/common/prome/gather.go b/pkg/common/prome/gather.go index eb4bc6c3b..58305396d 100644 --- a/pkg/common/prome/gather.go +++ b/pkg/common/prome/gather.go @@ -79,6 +79,7 @@ var ( ConversationCreateFailedCounter prometheus.Counter ) +// NewUserLoginCounter func NewUserLoginCounter() { if UserLoginCounter != nil { return @@ -89,6 +90,7 @@ func NewUserLoginCounter() { }) } +// NewUserRegisterCounter func NewUserRegisterCounter() { if UserRegisterCounter != nil { return @@ -99,6 +101,7 @@ func NewUserRegisterCounter() { }) } +// NewSeqGetSuccessCounter func NewSeqGetSuccessCounter() { if SeqGetSuccessCounter != nil { return @@ -109,6 +112,7 @@ func NewSeqGetSuccessCounter() { }) } +// NewSeqGetFailedCounter func NewSeqGetFailedCounter() { if SeqGetFailedCounter != nil { return @@ -119,6 +123,7 @@ func NewSeqGetFailedCounter() { }) } +// NewSeqSetSuccessCounter func NewSeqSetSuccessCounter() { if SeqSetSuccessCounter != nil { return @@ -129,6 +134,7 @@ func NewSeqSetSuccessCounter() { }) } +// NewSeqSetFailedCounter func NewSeqSetFailedCounter() { if SeqSetFailedCounter != nil { return @@ -139,6 +145,7 @@ func NewSeqSetFailedCounter() { }) } +// NewApiRequestCounter func NewApiRequestCounter() { if ApiRequestCounter != nil { return @@ -149,6 +156,7 @@ func NewApiRequestCounter() { }) } +// NewApiRequestSuccessCounter func NewApiRequestSuccessCounter() { if ApiRequestSuccessCounter != nil { return @@ -159,6 +167,7 @@ func NewApiRequestSuccessCounter() { }) } +// NewApiRequestFailedCounter func NewApiRequestFailedCounter() { if ApiRequestFailedCounter != nil { return @@ -169,6 +178,7 @@ func NewApiRequestFailedCounter() { }) } +// NewGrpcRequestCounter func NewGrpcRequestCounter() { if GrpcRequestCounter != nil { return @@ -179,6 +189,7 @@ func NewGrpcRequestCounter() { }) } +// NewGrpcRequestSuccessCounter func NewGrpcRequestSuccessCounter() { if GrpcRequestSuccessCounter != nil { return @@ -189,6 +200,7 @@ func NewGrpcRequestSuccessCounter() { }) } +// NewGrpcRequestFailedCounter func NewGrpcRequestFailedCounter() { if GrpcRequestFailedCounter != nil { return @@ -199,6 +211,7 @@ func NewGrpcRequestFailedCounter() { }) } +// NewSendMsgCount func NewSendMsgCount() { if SendMsgCounter != nil { return @@ -209,6 +222,7 @@ func NewSendMsgCount() { }) } +// NewMsgInsertRedisSuccessCounter func NewMsgInsertRedisSuccessCounter() { if MsgInsertRedisSuccessCounter != nil { return @@ -219,6 +233,7 @@ func NewMsgInsertRedisSuccessCounter() { }) } +// NewMsgInsertRedisFailedCounter func NewMsgInsertRedisFailedCounter() { if MsgInsertRedisFailedCounter != nil { return @@ -229,6 +244,7 @@ func NewMsgInsertRedisFailedCounter() { }) } +// NewMsgInsertMongoSuccessCounter func NewMsgInsertMongoSuccessCounter() { if MsgInsertMongoSuccessCounter != nil { return @@ -239,6 +255,7 @@ func NewMsgInsertMongoSuccessCounter() { }) } +// NewMsgInsertMongoFailedCounter func NewMsgInsertMongoFailedCounter() { if MsgInsertMongoFailedCounter != nil { return @@ -249,6 +266,7 @@ func NewMsgInsertMongoFailedCounter() { }) } +// NewMsgPullFromRedisSuccessCounter func NewMsgPullFromRedisSuccessCounter() { if MsgPullFromRedisSuccessCounter != nil { return @@ -259,6 +277,7 @@ func NewMsgPullFromRedisSuccessCounter() { }) } +// NewMsgPullFromRedisFailedCounter func NewMsgPullFromRedisFailedCounter() { if MsgPullFromRedisFailedCounter != nil { return @@ -269,6 +288,7 @@ func NewMsgPullFromRedisFailedCounter() { }) } +// NewMsgPullFromMongoSuccessCounter func NewMsgPullFromMongoSuccessCounter() { if MsgPullFromMongoSuccessCounter != nil { return @@ -279,6 +299,7 @@ func NewMsgPullFromMongoSuccessCounter() { }) } +// NewMsgPullFromMongoFailedCounter func NewMsgPullFromMongoFailedCounter() { if MsgPullFromMongoFailedCounter != nil { return @@ -289,6 +310,7 @@ func NewMsgPullFromMongoFailedCounter() { }) } +// NewMsgRecvTotalCounter func NewMsgRecvTotalCounter() { if MsgRecvTotalCounter != nil { return @@ -299,6 +321,7 @@ func NewMsgRecvTotalCounter() { }) } +// NewGetNewestSeqTotalCounter func NewGetNewestSeqTotalCounter() { if GetNewestSeqTotalCounter != nil { return @@ -309,6 +332,7 @@ func NewGetNewestSeqTotalCounter() { }) } +// NewPullMsgBySeqListTotalCounter func NewPullMsgBySeqListTotalCounter() { if PullMsgBySeqListTotalCounter != nil { return @@ -319,6 +343,7 @@ func NewPullMsgBySeqListTotalCounter() { }) } +// NewSingleChatMsgRecvSuccessCounter func NewSingleChatMsgRecvSuccessCounter() { if SingleChatMsgRecvSuccessCounter != nil { return @@ -329,6 +354,7 @@ func NewSingleChatMsgRecvSuccessCounter() { }) } +// NewGroupChatMsgRecvSuccessCounter func NewGroupChatMsgRecvSuccessCounter() { if GroupChatMsgRecvSuccessCounter != nil { return @@ -339,6 +365,7 @@ func NewGroupChatMsgRecvSuccessCounter() { }) } +// NewWorkSuperGroupChatMsgRecvSuccessCounter func NewWorkSuperGroupChatMsgRecvSuccessCounter() { if WorkSuperGroupChatMsgRecvSuccessCounter != nil { return @@ -349,6 +376,7 @@ func NewWorkSuperGroupChatMsgRecvSuccessCounter() { }) } +// NewOnlineUserGauges func NewOnlineUserGauges() { if OnlineUserGauge != nil { return @@ -359,6 +387,7 @@ func NewOnlineUserGauges() { }) } +// NewSingleChatMsgProcessSuccessCounter func NewSingleChatMsgProcessSuccessCounter() { if SingleChatMsgProcessSuccessCounter != nil { return @@ -369,6 +398,7 @@ func NewSingleChatMsgProcessSuccessCounter() { }) } +// NewSingleChatMsgProcessFailedCounter func NewSingleChatMsgProcessFailedCounter() { if SingleChatMsgProcessFailedCounter != nil { return @@ -379,6 +409,7 @@ func NewSingleChatMsgProcessFailedCounter() { }) } +// NewGroupChatMsgProcessSuccessCounter func NewGroupChatMsgProcessSuccessCounter() { if GroupChatMsgProcessSuccessCounter != nil { return @@ -389,6 +420,7 @@ func NewGroupChatMsgProcessSuccessCounter() { }) } +// NewGroupChatMsgProcessFailedCounter func NewGroupChatMsgProcessFailedCounter() { if GroupChatMsgProcessFailedCounter != nil { return @@ -399,6 +431,7 @@ func NewGroupChatMsgProcessFailedCounter() { }) } +// NewWorkSuperGroupChatMsgProcessSuccessCounter func NewWorkSuperGroupChatMsgProcessSuccessCounter() { if WorkSuperGroupChatMsgProcessSuccessCounter != nil { return @@ -409,6 +442,7 @@ func NewWorkSuperGroupChatMsgProcessSuccessCounter() { }) } +// NewWorkSuperGroupChatMsgProcessFailedCounter func NewWorkSuperGroupChatMsgProcessFailedCounter() { if WorkSuperGroupChatMsgProcessFailedCounter != nil { return @@ -419,6 +453,7 @@ func NewWorkSuperGroupChatMsgProcessFailedCounter() { }) } +// NewMsgOnlinePushSuccessCounter func NewMsgOnlinePushSuccessCounter() { if MsgOnlinePushSuccessCounter != nil { return @@ -429,6 +464,7 @@ func NewMsgOnlinePushSuccessCounter() { }) } +// NewMsgOfflinePushSuccessCounter func NewMsgOfflinePushSuccessCounter() { if MsgOfflinePushSuccessCounter != nil { return @@ -439,6 +475,7 @@ func NewMsgOfflinePushSuccessCounter() { }) } +// NewMsgOfflinePushFailedCounter func NewMsgOfflinePushFailedCounter() { if MsgOfflinePushFailedCounter != nil { return @@ -449,6 +486,7 @@ func NewMsgOfflinePushFailedCounter() { }) } +// NewConversationCreateSuccessCounter func NewConversationCreateSuccessCounter() { if ConversationCreateSuccessCounter != nil { return @@ -459,6 +497,7 @@ func NewConversationCreateSuccessCounter() { }) } +// NewConversationCreateFailedCounter func NewConversationCreateFailedCounter() { if ConversationCreateFailedCounter != nil { return diff --git a/pkg/common/prome/prometheus.go b/pkg/common/prome/prometheus.go index d66b1df70..dbaa3f10d 100644 --- a/pkg/common/prome/prometheus.go +++ b/pkg/common/prome/prometheus.go @@ -26,6 +26,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" ) +// StartPrometheusSrv func StartPrometheusSrv(prometheusPort int) error { if config.Config.Prometheus.Enable { http.Handle("/metrics", promhttp.Handler()) @@ -35,6 +36,7 @@ func StartPrometheusSrv(prometheusPort int) error { return nil } +// PrometheusHandler func PrometheusHandler() gin.HandlerFunc { h := promhttp.Handler() return func(c *gin.Context) { @@ -42,16 +44,19 @@ func PrometheusHandler() gin.HandlerFunc { } } +// responseBodyWriter type responseBodyWriter struct { gin.ResponseWriter body *bytes.Buffer } +// Write func (r responseBodyWriter) Write(b []byte) (int, error) { r.body.Write(b) return r.ResponseWriter.Write(b) } +// PrometheusMiddleware func PrometheusMiddleware(c *gin.Context) { Inc(ApiRequestCounter) w := &responseBodyWriter{body: &bytes.Buffer{}, ResponseWriter: c.Writer} @@ -64,6 +69,7 @@ func PrometheusMiddleware(c *gin.Context) { } } +// Inc func Inc(counter prometheus.Counter) { if config.Config.Prometheus.Enable { if counter != nil { @@ -72,6 +78,7 @@ func Inc(counter prometheus.Counter) { } } +// Add func Add(counter prometheus.Counter, add int) { if config.Config.Prometheus.Enable { if counter != nil { @@ -80,6 +87,7 @@ func Add(counter prometheus.Counter, add int) { } } +// GaugeInc func GaugeInc(gauges prometheus.Gauge) { if config.Config.Prometheus.Enable { if gauges != nil { @@ -88,6 +96,7 @@ func GaugeInc(gauges prometheus.Gauge) { } } +// GaugeDec func GaugeDec(gauges prometheus.Gauge) { if config.Config.Prometheus.Enable { if gauges != nil { diff --git a/pkg/common/tokenverify/jwt_token.go b/pkg/common/tokenverify/jwt_token.go index 317347b1d..798f3699a 100644 --- a/pkg/common/tokenverify/jwt_token.go +++ b/pkg/common/tokenverify/jwt_token.go @@ -27,15 +27,18 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" ) +// Claims type Claims struct { UserID string PlatformID int // login platform jwt.RegisteredClaims } +// BuildClaims func BuildClaims(uid string, platformID int, ttl int64) Claims { now := time.Now() before := now.Add(-time.Minute * 5) + return Claims{ UserID: uid, PlatformID: platformID, @@ -47,12 +50,14 @@ func BuildClaims(uid string, platformID int, ttl int64) Claims { } } +// secret func secret() jwt.Keyfunc { return func(token *jwt.Token) (interface{}, error) { return []byte(config.Config.Secret), nil } } +// GetClaimFromToken func GetClaimFromToken(tokensString string) (*Claims, error) { token, err := jwt.ParseWithClaims(tokensString, &Claims{}, secret()) if err != nil { @@ -73,10 +78,12 @@ func GetClaimFromToken(tokensString string) (*Claims, error) { if claims, ok := token.Claims.(*Claims); ok && token.Valid { return claims, nil } + return nil, utils.Wrap(errs.ErrTokenUnknown, "") } } +// CheckAccessV3 func CheckAccessV3(ctx context.Context, ownerUserID string) (err error) { opUserID := mcontext.GetOpUserID(ctx) if utils.IsContain(opUserID, config.Config.Manager.UserID) { @@ -85,28 +92,35 @@ func CheckAccessV3(ctx context.Context, ownerUserID string) (err error) { if opUserID == ownerUserID { return nil } + return errs.ErrNoPermission.Wrap(utils.GetSelfFuncName()) } +// IsAppManagerUid func IsAppManagerUid(ctx context.Context) bool { return utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) } +// CheckAdmin func CheckAdmin(ctx context.Context) error { if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) { return nil } + return errs.ErrNoPermission.Wrap(fmt.Sprintf("user %s is not admin userID", mcontext.GetOpUserID(ctx))) } +// ParseRedisInterfaceToken func ParseRedisInterfaceToken(redisToken interface{}) (*Claims, error) { return GetClaimFromToken(string(redisToken.([]uint8))) } +// IsManagerUserID func IsManagerUserID(opUserID string) bool { return utils.IsContain(opUserID, config.Config.Manager.UserID) } +// WsVerifyToken func WsVerifyToken(token, userID string, platformID int) error { claim, err := GetClaimFromToken(token) if err != nil { @@ -118,5 +132,6 @@ func WsVerifyToken(token, userID string, platformID int) error { if claim.PlatformID != platformID { return errs.ErrTokenInvalid.Wrap(fmt.Sprintf("token platform %d != %d", claim.PlatformID, platformID)) } + return nil } diff --git a/pkg/discoveryregistry/discovery_register.go b/pkg/discoveryregistry/discovery_register.go index 4ebabe7a8..f81a91c7b 100644 --- a/pkg/discoveryregistry/discovery_register.go +++ b/pkg/discoveryregistry/discovery_register.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" ) +// Conn type Conn interface { GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]grpc.ClientConnInterface, error) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (grpc.ClientConnInterface, error) @@ -29,6 +30,7 @@ type Conn interface { GetClientLocalConns() map[string][]grpc.ClientConnInterface } +// SvcDiscoveryRegistry type SvcDiscoveryRegistry interface { Conn Register(serviceName, host string, port int, opts ...grpc.DialOption) error diff --git a/pkg/discoveryregistry/zookeeper/conf.go b/pkg/discoveryregistry/zookeeper/conf.go index 034c525ba..8cfb504c1 100644 --- a/pkg/discoveryregistry/zookeeper/conf.go +++ b/pkg/discoveryregistry/zookeeper/conf.go @@ -18,6 +18,7 @@ import ( "github.com/go-zookeeper/zk" ) +// RegisterConf2Registry func (s *ZkClient) RegisterConf2Registry(key string, conf []byte) error { exists, _, err := s.conn.Exists(s.getPath(key)) if err != nil { @@ -32,10 +33,13 @@ func (s *ZkClient) RegisterConf2Registry(key string, conf []byte) error { if err != zk.ErrNodeExists { return err } + return nil } +// GetConfFromRegistry func (s *ZkClient) GetConfFromRegistry(key string) ([]byte, error) { bytes, _, err := s.conn.Get(s.getPath(key)) + return bytes, err } diff --git a/pkg/discoveryregistry/zookeeper/discover.go b/pkg/discoveryregistry/zookeeper/discover.go index 94cf1f84a..fc28dd388 100644 --- a/pkg/discoveryregistry/zookeeper/discover.go +++ b/pkg/discoveryregistry/zookeeper/discover.go @@ -35,6 +35,7 @@ var ( ErrConnIsNilButLocalNotNil = errors.New("conn is nil, but local is not nil") ) +// watch func (s *ZkClient) watch() { for { event := <-s.eventChan @@ -69,6 +70,7 @@ func (s *ZkClient) watch() { } } +// GetConnsRemote func (s *ZkClient) GetConnsRemote(serviceName string) (conns []resolver.Address, err error) { path := s.getPath(serviceName) _, _, _, err = s.conn.ChildrenW(path) @@ -86,15 +88,18 @@ func (s *ZkClient) GetConnsRemote(serviceName string) (conns []resolver.Address, if err == zk.ErrNoNode { return nil, errors.Wrap(err, "this is zk ErrNoNode") } + return nil, errors.Wrap(err, "get children error") } log.ZDebug(context.Background(), "get addrs from remote", "conn", string(data)) conns = append(conns, resolver.Address{Addr: string(data), ServerName: serviceName}) } } + return conns, nil } +// GetConns func (s *ZkClient) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]grpc.ClientConnInterface, error) { s.logger.Printf("get conns from client, serviceName: %s", serviceName) s.lock.Lock() @@ -114,21 +119,26 @@ func (s *ZkClient) GetConns(ctx context.Context, serviceName string, opts ...grp cc, err := grpc.DialContext(ctx, addr.Addr, append(s.options, opts...)...) if err != nil { log.ZError(context.Background(), "dialContext failed", err, "addr", addr.Addr, "opts", append(s.options, opts...)) + return nil, errs.Wrap(err) } conns = append(conns, cc) } s.localConns[serviceName] = conns } + return conns, nil } +// GetConn func (s *ZkClient) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (grpc.ClientConnInterface, error) { newOpts := append(s.options, grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, s.balancerName))) s.logger.Printf("get conn from client, serviceName: %s", serviceName) + return grpc.DialContext(ctx, fmt.Sprintf("%s:///%s", s.scheme, serviceName), append(newOpts, opts...)...) } +// CloseConn func (s *ZkClient) CloseConn(conn grpc.ClientConnInterface) { if closer, ok := conn.(io.Closer); ok { closer.Close() diff --git a/pkg/discoveryregistry/zookeeper/register.go b/pkg/discoveryregistry/zookeeper/register.go index 8fc5fa34e..dfdc567ee 100644 --- a/pkg/discoveryregistry/zookeeper/register.go +++ b/pkg/discoveryregistry/zookeeper/register.go @@ -21,16 +21,20 @@ import ( "google.golang.org/grpc" ) +// CreateRpcRootNodes func (s *ZkClient) CreateRpcRootNodes(serviceNames []string) error { for _, serviceName := range serviceNames { if err := s.ensureName(serviceName); err != nil && err != zk.ErrNodeExists { return err } } + return nil } +// CreateTempNode func (s *ZkClient) CreateTempNode(rpcRegisterName, addr string) (node string, err error) { + return s.conn.CreateProtectedEphemeralSequential( s.getPath(rpcRegisterName)+"/"+addr+"_", []byte(addr), @@ -38,6 +42,7 @@ func (s *ZkClient) CreateTempNode(rpcRegisterName, addr string) (node string, er ) } +// Register func (s *ZkClient) Register(rpcRegisterName, host string, port int, opts ...grpc.DialOption) error { if err := s.ensureName(rpcRegisterName); err != nil { return err @@ -55,9 +60,11 @@ func (s *ZkClient) Register(rpcRegisterName, host string, port int, opts ...grpc s.rpcRegisterAddr = addr s.node = node s.isRegistered = true + return nil } +// UnRegister func (s *ZkClient) UnRegister() error { s.lock.Lock() defer s.lock.Unlock() @@ -72,5 +79,6 @@ func (s *ZkClient) UnRegister() error { s.isRegistered = false s.localConns = make(map[string][]grpc.ClientConnInterface) s.resolvers = make(map[string]*Resolver) + return nil } diff --git a/pkg/discoveryregistry/zookeeper/resolver.go b/pkg/discoveryregistry/zookeeper/resolver.go index 7e9c8c125..792d904ba 100644 --- a/pkg/discoveryregistry/zookeeper/resolver.go +++ b/pkg/discoveryregistry/zookeeper/resolver.go @@ -23,6 +23,7 @@ import ( "google.golang.org/grpc/resolver" ) +// Resolver type Resolver struct { target resolver.Target cc resolver.ClientConn @@ -31,6 +32,7 @@ type Resolver struct { getConnsRemote func(serviceName string) (conns []resolver.Address, err error) } +// ResolveNowZK func (r *Resolver) ResolveNowZK(o resolver.ResolveNowOptions) { log.ZDebug( context.Background(), @@ -45,6 +47,7 @@ func (r *Resolver) ResolveNowZK(o resolver.ResolveNowOptions) { newConns, err := r.getConnsRemote(strings.TrimLeft(r.target.URL.Path, "/")) if err != nil { log.ZError(context.Background(), "resolve now error", err, "target", r.target) + return } r.addrs = newConns @@ -58,15 +61,19 @@ func (r *Resolver) ResolveNowZK(o resolver.ResolveNowOptions) { "zk path", r.target.URL.Path, ) + return } log.ZDebug(context.Background(), "resolve now finished", "target", r.target, "conns", r.addrs) } +// ResolveNow func (r *Resolver) ResolveNow(o resolver.ResolveNowOptions) {} +// Close func (s *Resolver) Close() {} +// Build func (s *ZkClient) Build( target resolver.Target, cc resolver.ClientConn, @@ -76,6 +83,7 @@ func (s *ZkClient) Build( serviceName := strings.TrimLeft(target.URL.Path, "/") if oldResolver, ok := s.resolvers[serviceName]; ok { s.logger.Printf("rpc resolver exist: %+v, cc: %+v, key: %s", target, cc.UpdateState, serviceName) + return oldResolver, nil } r := &Resolver{} @@ -87,7 +95,9 @@ func (s *ZkClient) Build( defer s.lock.Unlock() s.resolvers[serviceName] = r s.logger.Printf("build resolver finished: %+v, cc: %+v, key: %s", target, cc.UpdateState, serviceName) + return r, nil } +// Scheme func (s *ZkClient) Scheme() string { return s.scheme } diff --git a/pkg/discoveryregistry/zookeeper/zk.go b/pkg/discoveryregistry/zookeeper/zk.go index cc333c4b6..6237c0b02 100644 --- a/pkg/discoveryregistry/zookeeper/zk.go +++ b/pkg/discoveryregistry/zookeeper/zk.go @@ -30,10 +30,12 @@ const ( timeout = 5 ) +// Logger type Logger interface { Printf(string, ...interface{}) } +// ZkClient type ZkClient struct { zkServers []string zkRoot string @@ -62,14 +64,17 @@ type ZkClient struct { logger Logger } +// ZkOption type ZkOption func(*ZkClient) +// WithRoundRobin func WithRoundRobin() ZkOption { return func(client *ZkClient) { client.balancerName = "round_robin" } } +// WithUserNameAndPassword func WithUserNameAndPassword(userName, password string) ZkOption { return func(client *ZkClient) { client.userName = userName @@ -83,24 +88,28 @@ func WithOptions(opts ...grpc.DialOption) ZkOption { } } +// WithFreq func WithFreq(freq time.Duration) ZkOption { return func(client *ZkClient) { client.ticker = time.NewTicker(freq) } } +// WithTimeout func WithTimeout(timeout int) ZkOption { return func(client *ZkClient) { client.timeout = timeout } } +// WithLogger func WithLogger(logger Logger) ZkOption { return func(client *ZkClient) { client.logger = logger } } +// NewClient func NewClient(zkServers []string, zkRoot string, options ...ZkOption) (*ZkClient, error) { client := &ZkClient{ zkServers: zkServers, @@ -134,15 +143,18 @@ func NewClient(zkServers []string, zkRoot string, options ...ZkOption) (*ZkClien client.conn = conn if err := client.ensureRoot(); err != nil { client.CloseZK() + return nil, err } resolver.Register(client) go client.refresh() go client.watch() time.Sleep(time.Millisecond * 50) + return client, nil } +// CloseZK func (s *ZkClient) CloseZK() { s.conn.Close() } @@ -158,6 +170,7 @@ func (s *ZkClient) ensureAndCreate(node string) error { return err } } + return nil } @@ -189,14 +202,17 @@ func (s *ZkClient) flushResolver(serviceName string) { } } +// GetZkConn func (s *ZkClient) GetZkConn() *zk.Conn { return s.conn } +// GetRootPath func (s *ZkClient) GetRootPath() string { return s.zkRoot } +// GetNode func (s *ZkClient) GetNode() string { return s.node } @@ -217,10 +233,12 @@ func (s *ZkClient) getAddr(host string, port int) string { return net.JoinHostPort(host, strconv.Itoa(port)) } +// AddOption func (s *ZkClient) AddOption(opts ...grpc.DialOption) { s.options = append(s.options, opts...) } +// GetClientLocalConns func (s *ZkClient) GetClientLocalConns() map[string][]grpc.ClientConnInterface { return s.localConns } diff --git a/pkg/errs/coderr.go b/pkg/errs/coderr.go index af88a6353..5bd878922 100644 --- a/pkg/errs/coderr.go +++ b/pkg/errs/coderr.go @@ -15,12 +15,12 @@ package errs import ( - "fmt" "strings" "github.com/pkg/errors" ) +// CodeError type CodeError interface { Code() int Msg() string @@ -32,6 +32,7 @@ type CodeError interface { error } +// NewCodeError func NewCodeError(code int, msg string) CodeError { return &codeError{ code: code, @@ -64,6 +65,7 @@ func (e *codeError) WithDetail(detail string) CodeError { } else { d = e.detail + ", " + detail } + return &codeError{ code: e.code, msg: e.msg, @@ -93,13 +95,15 @@ func (e *codeError) Is(err error, loose ...bool) bool { return codeErr.Code() == e.code } } + return false } func (e *codeError) Error() string { - return fmt.Sprintf("%s", e.msg) + return e.msg } +// Unwrap func Unwrap(err error) error { for err != nil { unwrap, ok := err.(interface { @@ -110,9 +114,11 @@ func Unwrap(err error) error { } err = unwrap.Unwrap() } + return err } +// Wrap func Wrap(err error, msg ...string) error { if err == nil { return nil @@ -120,5 +126,6 @@ func Wrap(err error, msg ...string) error { if len(msg) == 0 { return errors.WithStack(err) } + return errors.Wrap(err, strings.Join(msg, ", ")) } diff --git a/pkg/errs/relation.go b/pkg/errs/relation.go index 0a7ad4997..d5e9c6345 100644 --- a/pkg/errs/relation.go +++ b/pkg/errs/relation.go @@ -14,6 +14,7 @@ package errs +// Relation var Relation = &relation{m: make(map[int]map[int]struct{})} func init() { @@ -52,5 +53,6 @@ func (r *relation) Is(parent, child int) bool { return false } _, ok = s[child] + return ok } diff --git a/pkg/proto/auth/auth.go b/pkg/proto/auth/auth.go index 9b8fdd988..db2019a67 100644 --- a/pkg/proto/auth/auth.go +++ b/pkg/proto/auth/auth.go @@ -19,6 +19,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" ) +// Check func (x *UserTokenReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") @@ -26,9 +27,11 @@ func (x *UserTokenReq) Check() error { if x.PlatformID > constant.AdminPlatformID || x.PlatformID < constant.IOSPlatformID { return errs.ErrArgs.Wrap("platform is invalidate") } + return nil } +// Check func (x *ForceLogoutReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") @@ -36,12 +39,15 @@ func (x *ForceLogoutReq) Check() error { if x.PlatformID > constant.AdminPlatformID || x.PlatformID < constant.IOSPlatformID { return errs.ErrArgs.Wrap("platformID is invalidate") } + return nil } +// Check func (x *ParseTokenReq) Check() error { if x.Token == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } diff --git a/pkg/proto/auth/auth.pb.go b/pkg/proto/auth/auth.pb.go index 2d1e0493c..238d12975 100644 --- a/pkg/proto/auth/auth.pb.go +++ b/pkg/proto/auth/auth.pb.go @@ -22,13 +22,14 @@ package auth import ( context "context" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( @@ -43,9 +44,9 @@ type UserTokenReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret"` + Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret"` PlatformID int32 `protobuf:"varint,2,opt,name=platformID,proto3" json:"platformID"` - UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` } func (x *UserTokenReq) Reset() { @@ -106,7 +107,7 @@ type UserTokenResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token"` ExpireTimeSeconds int64 `protobuf:"varint,3,opt,name=expireTimeSeconds,proto3" json:"expireTimeSeconds"` } @@ -162,7 +163,7 @@ type ForceLogoutReq struct { unknownFields protoimpl.UnknownFields PlatformID int32 `protobuf:"varint,1,opt,name=platformID,proto3" json:"platformID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` } func (x *ForceLogoutReq) Reset() { @@ -301,8 +302,8 @@ type ParseTokenResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` - Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform"` ExpireTimeSeconds int64 `protobuf:"varint,4,opt,name=expireTimeSeconds,proto3" json:"expireTimeSeconds"` } diff --git a/pkg/proto/conversation/conversation.go b/pkg/proto/conversation/conversation.go index 7e8f62bbc..ad6c6a623 100644 --- a/pkg/proto/conversation/conversation.go +++ b/pkg/proto/conversation/conversation.go @@ -16,13 +16,16 @@ package conversation import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +// Check func (x *ConversationReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversation is empty") } + return nil } +// Check func (x *Conversation) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("OwnerUserID is empty") @@ -36,19 +39,23 @@ func (x *Conversation) Check() error { if x.RecvMsgOpt < 0 || x.RecvMsgOpt > 2 { return errs.ErrArgs.Wrap("RecvMsgOpt is invalid") } + return nil } -//func (x *ModifyConversationFieldReq) Check() error { +// // Check +// func (x *ModifyConversationFieldReq) Check() error { // if x.UserIDList == nil { // return errs.ErrArgs.Wrap("userIDList is empty") // } // if x.Conversation == nil { // return errs.ErrArgs.Wrap("conversation is empty") // } -// return nil -//} +// +// return nil +// } +// Check func (x *SetConversationReq) Check() error { if x.Conversation == nil { return errs.ErrArgs.Wrap("Conversation is empty") @@ -56,10 +63,12 @@ func (x *SetConversationReq) Check() error { if x.Conversation.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") } + return nil } -//func (x *SetRecvMsgOptReq) Check() error { +// // Check +// func (x *SetRecvMsgOptReq) Check() error { // if x.OwnerUserID == "" { // return errs.ErrArgs.Wrap("ownerUserID is empty") // } @@ -69,9 +78,11 @@ func (x *SetConversationReq) Check() error { // if x.RecvMsgOpt > 2 || x.RecvMsgOpt < 0 { // return errs.ErrArgs.Wrap("MsgReceiveOpt is invalid") // } -// return nil -//} +// +// return nil +// } +// Check func (x *GetConversationReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") @@ -79,9 +90,11 @@ func (x *GetConversationReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") } + return nil } +// Check func (x *GetConversationsReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") @@ -89,41 +102,51 @@ func (x *GetConversationsReq) Check() error { if x.ConversationIDs == nil { return errs.ErrArgs.Wrap("conversationIDs is empty") } + return nil } +// Check func (x *GetAllConversationsReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") } + return nil } // -//func (x *BatchSetConversationsReq) Check() error { +// // Check +// func (x *BatchSetConversationsReq) Check() error { // if x.Conversations == nil { // return errs.ErrArgs.Wrap("conversations is empty") // } // if x.OwnerUserID == "" { // return errs.ErrArgs.Wrap("conversation is empty") // } -// return nil -//} +// +// return nil +// } +// Check func (x *GetRecvMsgNotNotifyUserIDsReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") } + return nil } +// Check func (x *CreateGroupChatConversationsReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") } + return nil } +// Check func (x *SetConversationMaxSeqReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") @@ -134,9 +157,11 @@ func (x *SetConversationMaxSeqReq) Check() error { if x.MaxSeq <= 0 { return errs.ErrArgs.Wrap("maxSeq is invalid") } + return nil } +// Check func (x *SetConversationsReq) Check() error { if x.UserIDs == nil { return errs.ErrArgs.Wrap("userID is empty") @@ -144,19 +169,24 @@ func (x *SetConversationsReq) Check() error { if x.Conversation == nil { return errs.ErrArgs.Wrap("conversation is empty") } + return nil } +// Check func (x *GetUserConversationIDsHashReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") } + return nil } +// Check func (x *GetConversationsByConversationIDReq) Check() error { if x.ConversationIDs == nil { return errs.ErrArgs.Wrap("conversationIDs is empty") } + return nil } diff --git a/pkg/proto/conversation/conversation.pb.go b/pkg/proto/conversation/conversation.pb.go index cf5de48a7..568948379 100644 --- a/pkg/proto/conversation/conversation.pb.go +++ b/pkg/proto/conversation/conversation.pb.go @@ -22,14 +22,16 @@ package conversation import ( context "context" - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" ) const ( @@ -44,23 +46,23 @@ type Conversation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` - ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` - RecvMsgOpt int32 `protobuf:"varint,3,opt,name=recvMsgOpt,proto3" json:"recvMsgOpt"` - ConversationType int32 `protobuf:"varint,4,opt,name=conversationType,proto3" json:"conversationType"` - UserID string `protobuf:"bytes,5,opt,name=userID,proto3" json:"userID"` - GroupID string `protobuf:"bytes,6,opt,name=groupID,proto3" json:"groupID"` - IsPinned bool `protobuf:"varint,7,opt,name=isPinned,proto3" json:"isPinned"` - AttachedInfo string `protobuf:"bytes,8,opt,name=attachedInfo,proto3" json:"attachedInfo"` - IsPrivateChat bool `protobuf:"varint,9,opt,name=isPrivateChat,proto3" json:"isPrivateChat"` - GroupAtType int32 `protobuf:"varint,10,opt,name=groupAtType,proto3" json:"groupAtType"` - Ex string `protobuf:"bytes,11,opt,name=ex,proto3" json:"ex"` - BurnDuration int32 `protobuf:"varint,12,opt,name=burnDuration,proto3" json:"burnDuration"` - MinSeq int64 `protobuf:"varint,13,opt,name=minSeq,proto3" json:"minSeq"` - MaxSeq int64 `protobuf:"varint,14,opt,name=maxSeq,proto3" json:"maxSeq"` - MsgDestructTime int64 `protobuf:"varint,15,opt,name=msgDestructTime,proto3" json:"msgDestructTime"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` + RecvMsgOpt int32 `protobuf:"varint,3,opt,name=recvMsgOpt,proto3" json:"recvMsgOpt"` + ConversationType int32 `protobuf:"varint,4,opt,name=conversationType,proto3" json:"conversationType"` + UserID string `protobuf:"bytes,5,opt,name=userID,proto3" json:"userID"` + GroupID string `protobuf:"bytes,6,opt,name=groupID,proto3" json:"groupID"` + IsPinned bool `protobuf:"varint,7,opt,name=isPinned,proto3" json:"isPinned"` + AttachedInfo string `protobuf:"bytes,8,opt,name=attachedInfo,proto3" json:"attachedInfo"` + IsPrivateChat bool `protobuf:"varint,9,opt,name=isPrivateChat,proto3" json:"isPrivateChat"` + GroupAtType int32 `protobuf:"varint,10,opt,name=groupAtType,proto3" json:"groupAtType"` + Ex string `protobuf:"bytes,11,opt,name=ex,proto3" json:"ex"` + BurnDuration int32 `protobuf:"varint,12,opt,name=burnDuration,proto3" json:"burnDuration"` + MinSeq int64 `protobuf:"varint,13,opt,name=minSeq,proto3" json:"minSeq"` + MaxSeq int64 `protobuf:"varint,14,opt,name=maxSeq,proto3" json:"maxSeq"` + MsgDestructTime int64 `protobuf:"varint,15,opt,name=msgDestructTime,proto3" json:"msgDestructTime"` LatestMsgDestructTime int64 `protobuf:"varint,16,opt,name=latestMsgDestructTime,proto3" json:"latestMsgDestructTime"` - IsMsgDestruct bool `protobuf:"varint,17,opt,name=isMsgDestruct,proto3" json:"isMsgDestruct"` + IsMsgDestruct bool `protobuf:"varint,17,opt,name=isMsgDestruct,proto3" json:"isMsgDestruct"` } func (x *Conversation) Reset() { @@ -219,21 +221,21 @@ type ConversationReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` + ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` ConversationType int32 `protobuf:"varint,2,opt,name=conversationType,proto3" json:"conversationType"` - UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` - GroupID string `protobuf:"bytes,4,opt,name=groupID,proto3" json:"groupID"` - RecvMsgOpt *wrapperspb.Int32Value `protobuf:"bytes,5,opt,name=recvMsgOpt,proto3" json:"recvMsgOpt"` - IsPinned *wrapperspb.BoolValue `protobuf:"bytes,6,opt,name=isPinned,proto3" json:"isPinned"` - AttachedInfo *wrapperspb.StringValue `protobuf:"bytes,7,opt,name=attachedInfo,proto3" json:"attachedInfo"` - IsPrivateChat *wrapperspb.BoolValue `protobuf:"bytes,8,opt,name=isPrivateChat,proto3" json:"isPrivateChat"` - Ex *wrapperspb.StringValue `protobuf:"bytes,9,opt,name=ex,proto3" json:"ex"` - BurnDuration *wrapperspb.Int32Value `protobuf:"bytes,10,opt,name=burnDuration,proto3" json:"burnDuration"` - MinSeq *wrapperspb.Int64Value `protobuf:"bytes,11,opt,name=minSeq,proto3" json:"minSeq"` - MaxSeq *wrapperspb.Int64Value `protobuf:"bytes,12,opt,name=maxSeq,proto3" json:"maxSeq"` - GroupAtType *wrapperspb.Int32Value `protobuf:"bytes,13,opt,name=groupAtType,proto3" json:"groupAtType"` - MsgDestructTime *wrapperspb.Int64Value `protobuf:"bytes,14,opt,name=msgDestructTime,proto3" json:"msgDestructTime"` - IsMsgDestruct *wrapperspb.BoolValue `protobuf:"bytes,15,opt,name=isMsgDestruct,proto3" json:"isMsgDestruct"` + UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` + GroupID string `protobuf:"bytes,4,opt,name=groupID,proto3" json:"groupID"` + RecvMsgOpt *wrapperspb.Int32Value `protobuf:"bytes,5,opt,name=recvMsgOpt,proto3" json:"recvMsgOpt"` + IsPinned *wrapperspb.BoolValue `protobuf:"bytes,6,opt,name=isPinned,proto3" json:"isPinned"` + AttachedInfo *wrapperspb.StringValue `protobuf:"bytes,7,opt,name=attachedInfo,proto3" json:"attachedInfo"` + IsPrivateChat *wrapperspb.BoolValue `protobuf:"bytes,8,opt,name=isPrivateChat,proto3" json:"isPrivateChat"` + Ex *wrapperspb.StringValue `protobuf:"bytes,9,opt,name=ex,proto3" json:"ex"` + BurnDuration *wrapperspb.Int32Value `protobuf:"bytes,10,opt,name=burnDuration,proto3" json:"burnDuration"` + MinSeq *wrapperspb.Int64Value `protobuf:"bytes,11,opt,name=minSeq,proto3" json:"minSeq"` + MaxSeq *wrapperspb.Int64Value `protobuf:"bytes,12,opt,name=maxSeq,proto3" json:"maxSeq"` + GroupAtType *wrapperspb.Int32Value `protobuf:"bytes,13,opt,name=groupAtType,proto3" json:"groupAtType"` + MsgDestructTime *wrapperspb.Int64Value `protobuf:"bytes,14,opt,name=msgDestructTime,proto3" json:"msgDestructTime"` + IsMsgDestruct *wrapperspb.BoolValue `protobuf:"bytes,15,opt,name=isMsgDestruct,proto3" json:"isMsgDestruct"` } func (x *ConversationReq) Reset() { @@ -464,7 +466,7 @@ type GetConversationReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - OwnerUserID string `protobuf:"bytes,2,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OwnerUserID string `protobuf:"bytes,2,opt,name=ownerUserID,proto3" json:"ownerUserID"` } func (x *GetConversationReq) Reset() { @@ -565,7 +567,7 @@ type GetConversationsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` ConversationIDs []string `protobuf:"bytes,2,rep,name=conversationIDs,proto3" json:"conversationIDs"` } @@ -1042,8 +1044,8 @@ type SetConversationMaxSeqReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - OwnerUserID []string `protobuf:"bytes,2,rep,name=ownerUserID,proto3" json:"ownerUserID"` - MaxSeq int64 `protobuf:"varint,3,opt,name=maxSeq,proto3" json:"maxSeq"` + OwnerUserID []string `protobuf:"bytes,2,rep,name=ownerUserID,proto3" json:"ownerUserID"` + MaxSeq int64 `protobuf:"varint,3,opt,name=maxSeq,proto3" json:"maxSeq"` } func (x *SetConversationMaxSeqReq) Reset() { @@ -1236,7 +1238,7 @@ type SetConversationsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserIDs []string `protobuf:"bytes,1,rep,name=userIDs,proto3" json:"userIDs"` + UserIDs []string `protobuf:"bytes,1,rep,name=userIDs,proto3" json:"userIDs"` Conversation *ConversationReq `protobuf:"bytes,2,opt,name=conversation,proto3" json:"conversation"` } diff --git a/pkg/proto/errinfo/errinfo.pb.go b/pkg/proto/errinfo/errinfo.pb.go index 44f906d86..1beca5842 100644 --- a/pkg/proto/errinfo/errinfo.pb.go +++ b/pkg/proto/errinfo/errinfo.pb.go @@ -21,10 +21,11 @@ package errinfo import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -39,11 +40,11 @@ type ErrorInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path"` Line uint32 `protobuf:"varint,2,opt,name=line,proto3" json:"line"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` Cause string `protobuf:"bytes,4,opt,name=cause,proto3" json:"cause"` - Warp []string `protobuf:"bytes,5,rep,name=warp,proto3" json:"warp"` + Warp []string `protobuf:"bytes,5,rep,name=warp,proto3" json:"warp"` } func (x *ErrorInfo) Reset() { diff --git a/pkg/proto/friend/friend.go b/pkg/proto/friend/friend.go index 197fc753c..59d99ba38 100644 --- a/pkg/proto/friend/friend.go +++ b/pkg/proto/friend/friend.go @@ -16,6 +16,7 @@ package friend import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +// Check func (x *GetPaginationFriendsReq) Check() error { if x.Pagination == nil { return errs.ErrArgs.Wrap("pagination is empty") @@ -26,9 +27,11 @@ func (x *GetPaginationFriendsReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *ApplyToAddFriendReq) Check() error { if x.ToUserID == "" { return errs.ErrArgs.Wrap("toUserID is empty") @@ -36,9 +39,11 @@ func (x *ApplyToAddFriendReq) Check() error { if x.FromUserID == "" { return errs.ErrArgs.Wrap("fromUserID is empty") } + return nil } +// Check func (x *ImportFriendReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") @@ -46,9 +51,11 @@ func (x *ImportFriendReq) Check() error { if x.FriendUserIDs == nil { return errs.ErrArgs.Wrap("friendUserIDS is empty") } + return nil } +// Check func (x *GetPaginationFriendsApplyToReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") @@ -59,9 +66,11 @@ func (x *GetPaginationFriendsApplyToReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *GetDesignatedFriendsReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") @@ -69,9 +78,11 @@ func (x *GetDesignatedFriendsReq) Check() error { if x.FriendUserIDs == nil { return errs.ErrArgs.Wrap("friendUserIDS is empty") } + return nil } +// Check func (x *AddBlackReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") @@ -79,9 +90,11 @@ func (x *AddBlackReq) Check() error { if x.BlackUserID == "" { return errs.ErrArgs.Wrap("BlackUserID is empty") } + return nil } +// Check func (x *RemoveBlackReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") @@ -89,9 +102,11 @@ func (x *RemoveBlackReq) Check() error { if x.BlackUserID == "" { return errs.ErrArgs.Wrap("BlackUserID is empty") } + return nil } +// Check func (x *GetPaginationBlacksReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") @@ -102,9 +117,11 @@ func (x *GetPaginationBlacksReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *IsFriendReq) Check() error { if x.UserID1 == "" { return errs.ErrArgs.Wrap("userID1 is empty") @@ -112,9 +129,11 @@ func (x *IsFriendReq) Check() error { if x.UserID2 == "" { return errs.ErrArgs.Wrap("userID2 is empty") } + return nil } +// Check func (x *IsBlackReq) Check() error { if x.UserID1 == "" { return errs.ErrArgs.Wrap("userID1 is empty") @@ -122,9 +141,11 @@ func (x *IsBlackReq) Check() error { if x.UserID2 == "" { return errs.ErrArgs.Wrap("userID2 is empty") } + return nil } +// Check func (x *DeleteFriendReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("userID1 is empty") @@ -132,9 +153,11 @@ func (x *DeleteFriendReq) Check() error { if x.FriendUserID == "" { return errs.ErrArgs.Wrap("userID2 is empty") } + return nil } +// Check func (x *RespondFriendApplyReq) Check() error { if x.ToUserID == "" { return errs.ErrArgs.Wrap("toUserID is empty") @@ -142,9 +165,11 @@ func (x *RespondFriendApplyReq) Check() error { if x.FromUserID == "" { return errs.ErrArgs.Wrap("fromUserID is empty") } + return nil } +// Check func (x *SetFriendRemarkReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID is empty") @@ -152,9 +177,11 @@ func (x *SetFriendRemarkReq) Check() error { if x.FriendUserID == "" { return errs.ErrArgs.Wrap("fromUserID is empty") } + return nil } +// Check func (x *GetPaginationFriendsApplyFromReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") @@ -165,12 +192,15 @@ func (x *GetPaginationFriendsApplyFromReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *GetFriendIDsReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index 5745fcd3c..7439a475a 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -22,14 +22,16 @@ package friend import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( @@ -45,7 +47,7 @@ type GetPaginationFriendsReq struct { unknownFields protoimpl.UnknownFields Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` } func (x *GetPaginationFriendsReq) Reset() { @@ -100,7 +102,7 @@ type GetPaginationFriendsResp struct { unknownFields protoimpl.UnknownFields FriendsInfo []*sdkws.FriendInfo `protobuf:"bytes,1,rep,name=friendsInfo,proto3" json:"friendsInfo"` - Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` } func (x *GetPaginationFriendsResp) Reset() { @@ -155,9 +157,9 @@ type ApplyToAddFriendReq struct { unknownFields protoimpl.UnknownFields FromUserID string `protobuf:"bytes,1,opt,name=fromUserID,proto3" json:"fromUserID"` - ToUserID string `protobuf:"bytes,2,opt,name=toUserID,proto3" json:"toUserID"` - ReqMsg string `protobuf:"bytes,3,opt,name=reqMsg,proto3" json:"reqMsg"` - Ex string `protobuf:"bytes,4,opt,name=ex,proto3" json:"ex"` + ToUserID string `protobuf:"bytes,2,opt,name=toUserID,proto3" json:"toUserID"` + ReqMsg string `protobuf:"bytes,3,opt,name=reqMsg,proto3" json:"reqMsg"` + Ex string `protobuf:"bytes,4,opt,name=ex,proto3" json:"ex"` } func (x *ApplyToAddFriendReq) Reset() { @@ -263,7 +265,7 @@ type ImportFriendReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` FriendUserIDs []string `protobuf:"bytes,2,rep,name=friendUserIDs,proto3" json:"friendUserIDs"` } @@ -356,7 +358,7 @@ type GetPaginationFriendsApplyToReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination"` } @@ -412,7 +414,7 @@ type GetPaginationFriendsApplyToResp struct { unknownFields protoimpl.UnknownFields FriendRequests []*sdkws.FriendRequest `protobuf:"bytes,1,rep,name=FriendRequests,proto3" json:"FriendRequests"` - Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` } func (x *GetPaginationFriendsApplyToResp) Reset() { @@ -466,7 +468,7 @@ type GetDesignatedFriendsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` FriendUserIDs []string `protobuf:"bytes,2,rep,name=friendUserIDs,proto3" json:"friendUserIDs"` } @@ -754,7 +756,7 @@ type GetPaginationBlacksReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination"` } @@ -1084,7 +1086,7 @@ type DeleteFriendReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` FriendUserID string `protobuf:"bytes,2,opt,name=friendUserID,proto3" json:"friendUserID"` } @@ -1178,10 +1180,10 @@ type RespondFriendApplyReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FromUserID string `protobuf:"bytes,1,opt,name=fromUserID,proto3" json:"fromUserID"` //主动发起的申请者 - ToUserID string `protobuf:"bytes,2,opt,name=toUserID,proto3" json:"toUserID"` //被动添加者 + FromUserID string `protobuf:"bytes,1,opt,name=fromUserID,proto3" json:"fromUserID"` //主动发起的申请者 + ToUserID string `protobuf:"bytes,2,opt,name=toUserID,proto3" json:"toUserID"` //被动添加者 HandleResult int32 `protobuf:"varint,3,opt,name=handleResult,proto3" json:"handleResult"` - HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg,proto3" json:"handleMsg"` + HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg,proto3" json:"handleMsg"` } func (x *RespondFriendApplyReq) Reset() { @@ -1287,9 +1289,9 @@ type SetFriendRemarkReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` FriendUserID string `protobuf:"bytes,2,opt,name=friendUserID,proto3" json:"friendUserID"` - Remark string `protobuf:"bytes,3,opt,name=remark,proto3" json:"remark"` + Remark string `protobuf:"bytes,3,opt,name=remark,proto3" json:"remark"` } func (x *SetFriendRemarkReq) Reset() { @@ -1388,7 +1390,7 @@ type GetPaginationFriendsApplyFromReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` Pagination *sdkws.RequestPagination `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination"` } @@ -1444,7 +1446,7 @@ type GetPaginationFriendsApplyFromResp struct { unknownFields protoimpl.UnknownFields FriendRequests []*sdkws.FriendRequest `protobuf:"bytes,1,rep,name=friendRequests,proto3" json:"friendRequests"` - Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` } func (x *GetPaginationFriendsApplyFromResp) Reset() { diff --git a/pkg/proto/group/group.go b/pkg/proto/group/group.go index 2cebc0df0..78641df72 100644 --- a/pkg/proto/group/group.go +++ b/pkg/proto/group/group.go @@ -16,6 +16,7 @@ package group import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +// Check func (x *CreateGroupReq) Check() error { if x.MemberUserIDs == nil { return errs.ErrArgs.Wrap("memberUserIDS is empty") @@ -29,16 +30,20 @@ func (x *CreateGroupReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("ownerUserID") } + return nil } +// Check func (x *GetGroupsInfoReq) Check() error { if x.GroupIDs == nil { return errs.ErrArgs.Wrap("GroupIDs") } + return nil } +// Check func (x *SetGroupInfoReq) Check() error { if x.GroupInfoForSet == nil { return errs.ErrArgs.Wrap("GroupInfoForSets is empty") @@ -46,9 +51,11 @@ func (x *SetGroupInfoReq) Check() error { if x.GroupInfoForSet.GroupID == "" { return errs.ErrArgs.Wrap("GroupID is empty") } + return nil } +// Check func (x *GetGroupApplicationListReq) Check() error { if x.Pagination == nil { return errs.ErrArgs.Wrap("pagination is empty") @@ -59,9 +66,11 @@ func (x *GetGroupApplicationListReq) Check() error { if x.FromUserID == "" { return errs.ErrArgs.Wrap("fromUserID is empty") } + return nil } +// Check func (x *GetUserReqApplicationListReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("UserID is empty") @@ -72,9 +81,11 @@ func (x *GetUserReqApplicationListReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *TransferGroupOwnerReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -85,9 +96,11 @@ func (x *TransferGroupOwnerReq) Check() error { if x.NewOwnerUserID == "" { return errs.ErrArgs.Wrap("newOwnerUserID is empty") } + return nil } +// Check func (x *JoinGroupReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -100,9 +113,11 @@ func (x *JoinGroupReq) Check() error { return errs.ErrArgs.Wrap("inviterUserID is empty") } } + return nil } +// Check func (x *GroupApplicationResponseReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -113,16 +128,20 @@ func (x *GroupApplicationResponseReq) Check() error { if x.HandleResult > 1 || x.HandleResult < -1 { return errs.ErrArgs.Wrap("handleResult is invalid") } + return nil } +// Check func (x *QuitGroupReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") } + return nil } +// Check func (x *GetGroupMemberListReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -136,9 +155,11 @@ func (x *GetGroupMemberListReq) Check() error { if x.Filter < 0 || x.Filter > 5 { return errs.ErrArgs.Wrap("filter is invalid") } + return nil } +// Check func (x *GetGroupMembersInfoReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -146,9 +167,11 @@ func (x *GetGroupMembersInfoReq) Check() error { if x.UserIDs == nil { return errs.ErrArgs.Wrap("userIDs is empty") } + return nil } +// Check func (x *KickGroupMemberReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -156,9 +179,11 @@ func (x *KickGroupMemberReq) Check() error { if x.KickedUserIDs == nil { return errs.ErrArgs.Wrap("kickUserIDs is empty") } + return nil } +// Check func (x *GetJoinedGroupListReq) Check() error { if x.Pagination == nil { return errs.ErrArgs.Wrap("pagination is empty") @@ -169,9 +194,11 @@ func (x *GetJoinedGroupListReq) Check() error { if x.FromUserID == "" { return errs.ErrArgs.Wrap("fromUserID is empty") } + return nil } +// Check func (x *InviteUserToGroupReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -179,9 +206,11 @@ func (x *InviteUserToGroupReq) Check() error { if x.InvitedUserIDs == nil { return errs.ErrArgs.Wrap("invitedUserIDs is empty") } + return nil } +// Check func (x *GetGroupAllMemberReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -192,9 +221,11 @@ func (x *GetGroupAllMemberReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *GetGroupsReq) Check() error { if x.Pagination == nil { return errs.ErrArgs.Wrap("pagination is empty") @@ -202,16 +233,20 @@ func (x *GetGroupsReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *GetGroupMemberReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") } + return nil } +// Check func (x *GetGroupMembersCMSReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -222,16 +257,20 @@ func (x *GetGroupMembersCMSReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *DismissGroupReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") } + return nil } +// Check func (x *MuteGroupMemberReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -242,9 +281,11 @@ func (x *MuteGroupMemberReq) Check() error { if x.MutedSeconds <= 0 { return errs.ErrArgs.Wrap("mutedSeconds is empty") } + return nil } +// Check func (x *CancelMuteGroupMemberReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") @@ -252,37 +293,47 @@ func (x *CancelMuteGroupMemberReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *MuteGroupReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") } + return nil } +// Check func (x *CancelMuteGroupReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("groupID is empty") } + return nil } +// Check func (x *GetJoinedSuperGroupListReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *GetSuperGroupsInfoReq) Check() error { if x.GroupIDs == nil { return errs.ErrArgs.Wrap("GroupIDs is empty") } + return nil } +// Check func (x *SetGroupMemberInfo) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("GroupID is empty") @@ -290,23 +341,29 @@ func (x *SetGroupMemberInfo) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *SetGroupMemberInfoReq) Check() error { if x.Members == nil { return errs.ErrArgs.Wrap("Members is empty") } + return nil } +// Check func (x *GetGroupAbstractInfoReq) Check() error { if x.GroupIDs == nil { return errs.ErrArgs.Wrap("GroupID is empty") } + return nil } +// Check func (x *GetUserInGroupMembersReq) Check() error { if x.GroupIDs == nil { return errs.ErrArgs.Wrap("GroupID is empty") @@ -314,16 +371,20 @@ func (x *GetUserInGroupMembersReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *GetGroupMemberUserIDsReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("GroupID is empty") } + return nil } +// Check func (x *GetGroupMemberRoleLevelReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("GroupID is empty") @@ -331,16 +392,20 @@ func (x *GetGroupMemberRoleLevelReq) Check() error { if x.RoleLevels == nil { return errs.ErrArgs.Wrap("rolesLevel is empty") } + return nil } +// Check func (x *GetGroupInfoCacheReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("GroupID is empty") } + return nil } +// Check func (x *GetGroupMemberCacheReq) Check() error { if x.GroupID == "" { return errs.ErrArgs.Wrap("GroupID is empty") @@ -348,5 +413,6 @@ func (x *GetGroupMemberCacheReq) Check() error { if x.GroupMemberID == "" { return errs.ErrArgs.Wrap("GroupMemberID is empty") } + return nil } diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index f4230c794..32261fc7c 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -22,15 +22,17 @@ package group import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" ) const ( @@ -46,9 +48,9 @@ type CreateGroupReq struct { unknownFields protoimpl.UnknownFields MemberUserIDs []string `protobuf:"bytes,1,rep,name=memberUserIDs,proto3" json:"memberUserIDs"` - GroupInfo *sdkws.GroupInfo `protobuf:"bytes,2,opt,name=groupInfo,proto3" json:"groupInfo"` - AdminUserIDs []string `protobuf:"bytes,3,rep,name=adminUserIDs,proto3" json:"adminUserIDs"` - OwnerUserID string `protobuf:"bytes,4,opt,name=ownerUserID,proto3" json:"ownerUserID"` //owner + GroupInfo *sdkws.GroupInfo `protobuf:"bytes,2,opt,name=groupInfo,proto3" json:"groupInfo"` + AdminUserIDs []string `protobuf:"bytes,3,rep,name=adminUserIDs,proto3" json:"adminUserIDs"` + OwnerUserID string `protobuf:"bytes,4,opt,name=ownerUserID,proto3" json:"ownerUserID"` //owner } func (x *CreateGroupReq) Reset() { @@ -397,7 +399,7 @@ type GetGroupApplicationListResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` GroupRequests []*sdkws.GroupRequest `protobuf:"bytes,2,rep,name=groupRequests,proto3" json:"groupRequests"` } @@ -453,7 +455,7 @@ type GetUserReqApplicationListReq struct { unknownFields protoimpl.UnknownFields Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` } func (x *GetUserReqApplicationListReq) Reset() { @@ -507,7 +509,7 @@ type GetUserReqApplicationListResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` GroupRequests []*sdkws.GroupRequest `protobuf:"bytes,2,rep,name=groupRequests,proto3" json:"groupRequests"` } @@ -562,7 +564,7 @@ type TransferGroupOwnerReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` OldOwnerUserID string `protobuf:"bytes,2,opt,name=oldOwnerUserID,proto3" json:"oldOwnerUserID"` NewOwnerUserID string `protobuf:"bytes,3,opt,name=newOwnerUserID,proto3" json:"newOwnerUserID"` } @@ -663,9 +665,9 @@ type JoinGroupReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - ReqMessage string `protobuf:"bytes,2,opt,name=reqMessage,proto3" json:"reqMessage"` - JoinSource int32 `protobuf:"varint,3,opt,name=joinSource,proto3" json:"joinSource"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + ReqMessage string `protobuf:"bytes,2,opt,name=reqMessage,proto3" json:"reqMessage"` + JoinSource int32 `protobuf:"varint,3,opt,name=joinSource,proto3" json:"joinSource"` InviterUserID string `protobuf:"bytes,4,opt,name=inviterUserID,proto3" json:"inviterUserID"` } @@ -772,9 +774,9 @@ type GroupApplicationResponseReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - FromUserID string `protobuf:"bytes,2,opt,name=fromUserID,proto3" json:"fromUserID"` // - HandledMsg string `protobuf:"bytes,3,opt,name=handledMsg,proto3" json:"handledMsg"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + FromUserID string `protobuf:"bytes,2,opt,name=fromUserID,proto3" json:"fromUserID"` // + HandledMsg string `protobuf:"bytes,3,opt,name=handledMsg,proto3" json:"handledMsg"` HandleResult int32 `protobuf:"varint,4,opt,name=handleResult,proto3" json:"handleResult"` } @@ -967,8 +969,8 @@ type GetGroupMemberListReq struct { unknownFields protoimpl.UnknownFields Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination"` - GroupID string `protobuf:"bytes,2,opt,name=groupID,proto3" json:"groupID"` - Filter int32 `protobuf:"varint,3,opt,name=filter,proto3" json:"filter"` + GroupID string `protobuf:"bytes,2,opt,name=groupID,proto3" json:"groupID"` + Filter int32 `protobuf:"varint,3,opt,name=filter,proto3" json:"filter"` } func (x *GetGroupMemberListReq) Reset() { @@ -1029,7 +1031,7 @@ type GetGroupMemberListResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,2,rep,name=members,proto3" json:"members"` } @@ -1186,9 +1188,9 @@ type KickGroupMemberReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` KickedUserIDs []string `protobuf:"bytes,2,rep,name=kickedUserIDs,proto3" json:"kickedUserIDs"` - Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason"` } func (x *KickGroupMemberReq) Reset() { @@ -1397,8 +1399,8 @@ type InviteUserToGroupReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason"` InvitedUserIDs []string `protobuf:"bytes,3,rep,name=invitedUserIDs,proto3" json:"invitedUserIDs"` } @@ -1499,7 +1501,7 @@ type GetGroupAllMemberReq struct { unknownFields protoimpl.UnknownFields Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination"` - GroupID string `protobuf:"bytes,2,opt,name=groupID,proto3" json:"groupID"` + GroupID string `protobuf:"bytes,2,opt,name=groupID,proto3" json:"groupID"` } func (x *GetGroupAllMemberReq) Reset() { @@ -1600,9 +1602,9 @@ type CMSGroup struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupInfo *sdkws.GroupInfo `protobuf:"bytes,1,opt,name=groupInfo,proto3" json:"groupInfo"` + GroupInfo *sdkws.GroupInfo `protobuf:"bytes,1,opt,name=groupInfo,proto3" json:"groupInfo"` GroupOwnerUserName string `protobuf:"bytes,2,opt,name=groupOwnerUserName,proto3" json:"groupOwnerUserName"` - GroupOwnerUserID string `protobuf:"bytes,3,opt,name=groupOwnerUserID,proto3" json:"groupOwnerUserID"` + GroupOwnerUserID string `protobuf:"bytes,3,opt,name=groupOwnerUserID,proto3" json:"groupOwnerUserID"` } func (x *CMSGroup) Reset() { @@ -1664,8 +1666,8 @@ type GetGroupsReq struct { unknownFields protoimpl.UnknownFields Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination"` - GroupName string `protobuf:"bytes,2,opt,name=groupName,proto3" json:"groupName"` - GroupID string `protobuf:"bytes,3,opt,name=groupID,proto3" json:"groupID"` + GroupName string `protobuf:"bytes,2,opt,name=groupName,proto3" json:"groupName"` + GroupID string `protobuf:"bytes,3,opt,name=groupID,proto3" json:"groupID"` } func (x *GetGroupsReq) Reset() { @@ -1829,8 +1831,8 @@ type GetGroupMembersCMSReq struct { unknownFields protoimpl.UnknownFields Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination"` - GroupID string `protobuf:"bytes,2,opt,name=groupID,proto3" json:"groupID"` - UserName string `protobuf:"bytes,3,opt,name=userName,proto3" json:"userName"` + GroupID string `protobuf:"bytes,2,opt,name=groupID,proto3" json:"groupID"` + UserName string `protobuf:"bytes,3,opt,name=userName,proto3" json:"userName"` } func (x *GetGroupMembersCMSReq) Reset() { @@ -1891,7 +1893,7 @@ type GetGroupMembersCMSResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,2,rep,name=members,proto3" json:"members"` } @@ -1946,7 +1948,7 @@ type DismissGroupReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` DeleteMember bool `protobuf:"varint,2,opt,name=deleteMember,proto3" json:"deleteMember"` } @@ -2039,8 +2041,8 @@ type MuteGroupMemberReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` MutedSeconds uint32 `protobuf:"varint,3,opt,name=mutedSeconds,proto3" json:"mutedSeconds"` } @@ -2141,7 +2143,7 @@ type CancelMuteGroupMemberReq struct { unknownFields protoimpl.UnknownFields GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` } func (x *CancelMuteGroupMemberReq) Reset() { @@ -2591,12 +2593,12 @@ type SetGroupMemberInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` - Nickname *wrapperspb.StringValue `protobuf:"bytes,3,opt,name=nickname,proto3" json:"nickname"` - FaceURL *wrapperspb.StringValue `protobuf:"bytes,4,opt,name=faceURL,proto3" json:"faceURL"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + Nickname *wrapperspb.StringValue `protobuf:"bytes,3,opt,name=nickname,proto3" json:"nickname"` + FaceURL *wrapperspb.StringValue `protobuf:"bytes,4,opt,name=faceURL,proto3" json:"faceURL"` RoleLevel *wrapperspb.Int32Value `protobuf:"bytes,5,opt,name=roleLevel,proto3" json:"roleLevel"` - Ex *wrapperspb.StringValue `protobuf:"bytes,6,opt,name=ex,proto3" json:"ex"` + Ex *wrapperspb.StringValue `protobuf:"bytes,6,opt,name=ex,proto3" json:"ex"` } func (x *SetGroupMemberInfo) Reset() { @@ -2810,8 +2812,8 @@ type GroupAbstractInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - GroupMemberNumber uint32 `protobuf:"varint,2,opt,name=groupMemberNumber,proto3" json:"groupMemberNumber"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupMemberNumber uint32 `protobuf:"varint,2,opt,name=groupMemberNumber,proto3" json:"groupMemberNumber"` GroupMemberListHash uint64 `protobuf:"varint,3,opt,name=groupMemberListHash,proto3" json:"groupMemberListHash"` } @@ -2920,7 +2922,7 @@ type GetUserInGroupMembersReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` GroupIDs []string `protobuf:"bytes,2,rep,name=groupIDs,proto3" json:"groupIDs"` } @@ -3116,7 +3118,7 @@ type GetGroupMemberRoleLevelReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` RoleLevels []int32 `protobuf:"varint,2,rep,packed,name=roleLevels,proto3" json:"roleLevels"` } @@ -3312,7 +3314,7 @@ type GetGroupMemberCacheReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` GroupMemberID string `protobuf:"bytes,2,opt,name=groupMemberID,proto3" json:"groupMemberID"` } @@ -3415,7 +3417,7 @@ type GroupCreateCountReq struct { unknownFields protoimpl.UnknownFields Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` } func (x *GroupCreateCountReq) Reset() { @@ -3469,9 +3471,9 @@ type GroupCreateCountResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` Before int64 `protobuf:"varint,2,opt,name=before,proto3" json:"before"` - Count map[string]int64 `protobuf:"bytes,3,rep,name=count,proto3" json:"count" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + Count map[string]int64 `protobuf:"bytes,3,rep,name=count,proto3" json:"count" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` } func (x *GroupCreateCountResp) Reset() { diff --git a/pkg/proto/msg/msg.go b/pkg/proto/msg/msg.go index 03c9da915..48904e82b 100644 --- a/pkg/proto/msg/msg.go +++ b/pkg/proto/msg/msg.go @@ -16,13 +16,16 @@ package msg import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +// Check func (x *GetMaxAndMinSeqReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *SendMsgReq) Check() error { if x.MsgData == nil { return errs.ErrArgs.Wrap("MsgData is empty") @@ -30,21 +33,25 @@ func (x *SendMsgReq) Check() error { if err := x.MsgData.Check(); err != nil { return err } + return nil } +// Check func (x *SetSendMsgStatusReq) Check() error { if x.Status < 0 || x.Status > 3 { return errs.ErrArgs.Wrap("status is invalid") } + return nil } +// Check func (x *GetSendMsgStatusReq) Check() error { return nil } -//func (x *ModifyMessageReactionExtensionsReq) Check() error { +// func (x *ModifyMessageReactionExtensionsReq) Check() error { // if x.ConversationID == "" { // return errs.ErrArgs.Wrap("conversationID is empty") // } @@ -55,9 +62,9 @@ func (x *GetSendMsgStatusReq) Check() error { // return errs.ErrArgs.Wrap("reactionExtensions is empty") // } // return nil -//} +// } // -//func (x *SetMessageReactionExtensionsReq) Check() error { +// func (x *SetMessageReactionExtensionsReq) Check() error { // if x.ConversationID == "" { // return errs.ErrArgs.Wrap("conversationID is empty") // } @@ -68,9 +75,9 @@ func (x *GetSendMsgStatusReq) Check() error { // return errs.ErrArgs.Wrap("reactionExtensions is empty") // } // return nil -//} +// } // -//func (x *GetMessagesReactionExtensionsReq) Check() error { +// func (x *GetMessagesReactionExtensionsReq) Check() error { // if x.ConversationID == "" { // return errs.ErrArgs.Wrap("conversationID is empty") // } @@ -84,9 +91,9 @@ func (x *GetSendMsgStatusReq) Check() error { // return errs.ErrArgs.Wrap("TypeKeys is empty") // } // return nil -//} +// } // -//func (x *DeleteMessagesReactionExtensionsReq) Check() error { +// func (x *DeleteMessagesReactionExtensionsReq) Check() error { // if x.ConversationID == "" { // return errs.ErrArgs.Wrap("conversationID is empty") // } @@ -97,12 +104,14 @@ func (x *GetSendMsgStatusReq) Check() error { // return errs.ErrArgs.Wrap("ReactionExtensions is empty") // } // return nil -//} +// } +// Check func (x *DelMsgsReq) Check() error { return nil } +// Check func (x *RevokeMsgReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") @@ -113,9 +122,11 @@ func (x *RevokeMsgReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *MarkMsgsAsReadReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") @@ -131,9 +142,11 @@ func (x *MarkMsgsAsReadReq) Check() error { return errs.ErrArgs.Wrap("seqs has 0 value is invalid") } } + return nil } +// Check func (x *MarkConversationAsReadReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") @@ -149,9 +162,11 @@ func (x *MarkConversationAsReadReq) Check() error { return errs.ErrArgs.Wrap("seqs has 0 value is invalid") } } + return nil } +// Check func (x *SetConversationHasReadSeqReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") @@ -162,9 +177,11 @@ func (x *SetConversationHasReadSeqReq) Check() error { if x.HasReadSeq < 1 { return errs.ErrArgs.Wrap("hasReadSeq is invalid") } + return nil } +// Check func (x *ClearConversationsMsgReq) Check() error { if x.ConversationIDs == nil { return errs.ErrArgs.Wrap("conversationIDs is empty") @@ -172,16 +189,20 @@ func (x *ClearConversationsMsgReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *UserClearAllMsgReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } +// Check func (x *DeleteMsgsReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") @@ -192,26 +213,33 @@ func (x *DeleteMsgsReq) Check() error { if x.Seqs == nil { return errs.ErrArgs.Wrap("seqs is empty") } + return nil } +// Check func (x *DeleteMsgPhysicalReq) Check() error { if x.ConversationIDs == nil { return errs.ErrArgs.Wrap("conversationIDs is empty") } + return nil } +// Check func (x *GetConversationMaxSeqReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") } + return nil } +// Check func (x *GetConversationsHasReadAndMaxSeqReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } + return nil } diff --git a/pkg/proto/msg/msg.pb.go b/pkg/proto/msg/msg.pb.go index db1f019c2..01e8463bf 100644 --- a/pkg/proto/msg/msg.pb.go +++ b/pkg/proto/msg/msg.pb.go @@ -22,14 +22,16 @@ package msg import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( @@ -44,7 +46,7 @@ type MsgDataToMQ struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token"` MsgData *sdkws.MsgData `protobuf:"bytes,2,opt,name=msgData,proto3" json:"msgData"` } @@ -146,7 +148,7 @@ type PushMsgDataToMQ struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` + MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` } @@ -201,9 +203,9 @@ type MsgDataToMongoByMQ struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - LastSeq int64 `protobuf:"varint,1,opt,name=lastSeq,proto3" json:"lastSeq"` + LastSeq int64 `protobuf:"varint,1,opt,name=lastSeq,proto3" json:"lastSeq"` ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` - MsgData []*sdkws.MsgData `protobuf:"bytes,3,rep,name=msgData,proto3" json:"msgData"` + MsgData []*sdkws.MsgData `protobuf:"bytes,3,rep,name=msgData,proto3" json:"msgData"` } func (x *MsgDataToMongoByMQ) Reset() { @@ -415,7 +417,7 @@ type SendMsgResp struct { ServerMsgID string `protobuf:"bytes,1,opt,name=serverMsgID,proto3" json:"serverMsgID"` ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` - SendTime int64 `protobuf:"varint,3,opt,name=sendTime,proto3" json:"sendTime"` + SendTime int64 `protobuf:"varint,3,opt,name=sendTime,proto3" json:"sendTime"` } func (x *SendMsgResp) Reset() { @@ -646,7 +648,7 @@ type MsgDataToModifyByMQ struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Messages []*sdkws.MsgData `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages"` + Messages []*sdkws.MsgData `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages"` ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` } @@ -778,8 +780,8 @@ type RevokeMsgReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - Seq int64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq"` - UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` + Seq int64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq"` + UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` } func (x *RevokeMsgReq) Reset() { @@ -879,8 +881,8 @@ type MarkMsgsAsReadReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - Seqs []int64 `protobuf:"varint,2,rep,packed,name=seqs,proto3" json:"seqs"` - UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` + Seqs []int64 `protobuf:"varint,2,rep,packed,name=seqs,proto3" json:"seqs"` + UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` } func (x *MarkMsgsAsReadReq) Reset() { @@ -980,9 +982,9 @@ type MarkConversationAsReadReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` - HasReadSeq int64 `protobuf:"varint,3,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` - Seqs []int64 `protobuf:"varint,4,rep,packed,name=seqs,proto3" json:"seqs"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + HasReadSeq int64 `protobuf:"varint,3,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` + Seqs []int64 `protobuf:"varint,4,rep,packed,name=seqs,proto3" json:"seqs"` } func (x *MarkConversationAsReadReq) Reset() { @@ -1089,8 +1091,8 @@ type SetConversationHasReadSeqReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` - HasReadSeq int64 `protobuf:"varint,3,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + HasReadSeq int64 `protobuf:"varint,3,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` } func (x *SetConversationHasReadSeqReq) Reset() { @@ -1189,7 +1191,7 @@ type DeleteSyncOpt struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - IsSyncSelf bool `protobuf:"varint,3,opt,name=IsSyncSelf,proto3" json:"IsSyncSelf"` + IsSyncSelf bool `protobuf:"varint,3,opt,name=IsSyncSelf,proto3" json:"IsSyncSelf"` IsSyncOther bool `protobuf:"varint,4,opt,name=IsSyncOther,proto3" json:"IsSyncOther"` } @@ -1245,8 +1247,8 @@ type ClearConversationsMsgReq struct { unknownFields protoimpl.UnknownFields ConversationIDs []string `protobuf:"bytes,1,rep,name=conversationIDs,proto3" json:"conversationIDs"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` - DeleteSyncOpt *DeleteSyncOpt `protobuf:"bytes,3,opt,name=deleteSyncOpt,proto3" json:"deleteSyncOpt"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + DeleteSyncOpt *DeleteSyncOpt `protobuf:"bytes,3,opt,name=deleteSyncOpt,proto3" json:"deleteSyncOpt"` } func (x *ClearConversationsMsgReq) Reset() { @@ -1345,7 +1347,7 @@ type UserClearAllMsgReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` DeleteSyncOpt *DeleteSyncOpt `protobuf:"bytes,3,opt,name=deleteSyncOpt,proto3" json:"deleteSyncOpt"` } @@ -1439,9 +1441,9 @@ type DeleteMsgsReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - Seqs []int64 `protobuf:"varint,2,rep,packed,name=seqs,proto3" json:"seqs"` - UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` - DeleteSyncOpt *DeleteSyncOpt `protobuf:"bytes,4,opt,name=deleteSyncOpt,proto3" json:"deleteSyncOpt"` + Seqs []int64 `protobuf:"varint,2,rep,packed,name=seqs,proto3" json:"seqs"` + UserID string `protobuf:"bytes,3,opt,name=userID,proto3" json:"userID"` + DeleteSyncOpt *DeleteSyncOpt `protobuf:"bytes,4,opt,name=deleteSyncOpt,proto3" json:"deleteSyncOpt"` } func (x *DeleteMsgsReq) Reset() { @@ -1548,7 +1550,7 @@ type DeleteMsgPhysicalReq struct { unknownFields protoimpl.UnknownFields ConversationIDs []string `protobuf:"bytes,1,rep,name=conversationIDs,proto3" json:"conversationIDs"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp"` } func (x *DeleteMsgPhysicalReq) Reset() { @@ -1641,7 +1643,7 @@ type DeleteMsgPhysicalBySeqReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - Seqs []int64 `protobuf:"varint,2,rep,packed,name=seqs,proto3" json:"seqs"` + Seqs []int64 `protobuf:"varint,2,rep,packed,name=seqs,proto3" json:"seqs"` } func (x *DeleteMsgPhysicalBySeqReq) Reset() { @@ -1874,7 +1876,7 @@ type Seqs struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MaxSeq int64 `protobuf:"varint,1,opt,name=maxSeq,proto3" json:"maxSeq"` + MaxSeq int64 `protobuf:"varint,1,opt,name=maxSeq,proto3" json:"maxSeq"` HasReadSeq int64 `protobuf:"varint,2,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` } @@ -1976,10 +1978,10 @@ type GetActiveUserReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` - Ase bool `protobuf:"varint,3,opt,name=ase,proto3" json:"ase"` - Group bool `protobuf:"varint,4,opt,name=group,proto3" json:"group"` + Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start"` + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` + Ase bool `protobuf:"varint,3,opt,name=ase,proto3" json:"ase"` + Group bool `protobuf:"varint,4,opt,name=group,proto3" json:"group"` Pagination *sdkws.RequestPagination `protobuf:"bytes,5,opt,name=pagination,proto3" json:"pagination"` } @@ -2055,7 +2057,7 @@ type ActiveUser struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - User *sdkws.UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user"` + User *sdkws.UserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user"` Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count"` } @@ -2110,10 +2112,10 @@ type GetActiveUserResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MsgCount int64 `protobuf:"varint,1,opt,name=msgCount,proto3" json:"msgCount"` + MsgCount int64 `protobuf:"varint,1,opt,name=msgCount,proto3" json:"msgCount"` UserCount int64 `protobuf:"varint,2,opt,name=userCount,proto3" json:"userCount"` - DateCount map[string]int64 `protobuf:"bytes,3,rep,name=dateCount,proto3" json:"dateCount" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - Users []*ActiveUser `protobuf:"bytes,4,rep,name=users,proto3" json:"users"` + DateCount map[string]int64 `protobuf:"bytes,3,rep,name=dateCount,proto3" json:"dateCount" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + Users []*ActiveUser `protobuf:"bytes,4,rep,name=users,proto3" json:"users"` } func (x *GetActiveUserResp) Reset() { @@ -2181,9 +2183,9 @@ type GetActiveGroupReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` - Ase bool `protobuf:"varint,3,opt,name=ase,proto3" json:"ase"` + Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start"` + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` + Ase bool `protobuf:"varint,3,opt,name=ase,proto3" json:"ase"` Pagination *sdkws.RequestPagination `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination"` } @@ -2252,7 +2254,7 @@ type ActiveGroup struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *sdkws.GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + Group *sdkws.GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count"` } @@ -2307,10 +2309,10 @@ type GetActiveGroupResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MsgCount int64 `protobuf:"varint,1,opt,name=msgCount,proto3" json:"msgCount"` + MsgCount int64 `protobuf:"varint,1,opt,name=msgCount,proto3" json:"msgCount"` GroupCount int64 `protobuf:"varint,2,opt,name=groupCount,proto3" json:"groupCount"` - DateCount map[string]int64 `protobuf:"bytes,3,rep,name=dateCount,proto3" json:"dateCount" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - Groups []*ActiveGroup `protobuf:"bytes,4,rep,name=groups,proto3" json:"groups"` + DateCount map[string]int64 `protobuf:"bytes,3,rep,name=dateCount,proto3" json:"dateCount" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + Groups []*ActiveGroup `protobuf:"bytes,4,rep,name=groups,proto3" json:"groups"` } func (x *GetActiveGroupResp) Reset() { @@ -2378,12 +2380,12 @@ type SearchMessageReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SendID string `protobuf:"bytes,1,opt,name=sendID,proto3" json:"sendID"` //发送者ID - RecvID string `protobuf:"bytes,2,opt,name=recvID,proto3" json:"recvID"` //接收者ID - MsgType int32 `protobuf:"varint,3,opt,name=msgType,proto3" json:"msgType"` - SendTime string `protobuf:"bytes,4,opt,name=sendTime,proto3" json:"sendTime"` + SendID string `protobuf:"bytes,1,opt,name=sendID,proto3" json:"sendID"` //发送者ID + RecvID string `protobuf:"bytes,2,opt,name=recvID,proto3" json:"recvID"` //接收者ID + MsgType int32 `protobuf:"varint,3,opt,name=msgType,proto3" json:"msgType"` + SendTime string `protobuf:"bytes,4,opt,name=sendTime,proto3" json:"sendTime"` SessionType int32 `protobuf:"varint,5,opt,name=sessionType,proto3" json:"sessionType"` - Pagination *sdkws.RequestPagination `protobuf:"bytes,6,opt,name=pagination,proto3" json:"pagination"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,6,opt,name=pagination,proto3" json:"pagination"` } func (x *SearchMessageReq) Reset() { @@ -2465,7 +2467,7 @@ type SearchMessageResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ChatLogs []*ChatLog `protobuf:"bytes,1,rep,name=chatLogs,proto3" json:"chatLogs"` + ChatLogs []*ChatLog `protobuf:"bytes,1,rep,name=chatLogs,proto3" json:"chatLogs"` ChatLogsNum int32 `protobuf:"varint,2,opt,name=chatLogsNum,proto3" json:"chatLogsNum"` } @@ -2520,29 +2522,29 @@ type ChatLog struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ServerMsgID string `protobuf:"bytes,1,opt,name=serverMsgID,proto3" json:"serverMsgID"` - ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` - SendID string `protobuf:"bytes,3,opt,name=sendID,proto3" json:"sendID"` - RecvID string `protobuf:"bytes,4,opt,name=recvID,proto3" json:"recvID"` - GroupID string `protobuf:"bytes,5,opt,name=groupID,proto3" json:"groupID"` - RecvNickname string `protobuf:"bytes,6,opt,name=recvNickname,proto3" json:"recvNickname"` - SenderPlatformID int32 `protobuf:"varint,7,opt,name=senderPlatformID,proto3" json:"senderPlatformID"` - SenderNickname string `protobuf:"bytes,8,opt,name=senderNickname,proto3" json:"senderNickname"` - SenderFaceURL string `protobuf:"bytes,9,opt,name=senderFaceURL,proto3" json:"senderFaceURL"` - GroupName string `protobuf:"bytes,10,opt,name=groupName,proto3" json:"groupName"` - SessionType int32 `protobuf:"varint,11,opt,name=sessionType,proto3" json:"sessionType"` - MsgFrom int32 `protobuf:"varint,12,opt,name=msgFrom,proto3" json:"msgFrom"` - ContentType int32 `protobuf:"varint,13,opt,name=contentType,proto3" json:"contentType"` - Content string `protobuf:"bytes,14,opt,name=content,proto3" json:"content"` - Status int32 `protobuf:"varint,15,opt,name=status,proto3" json:"status"` - SendTime int64 `protobuf:"varint,16,opt,name=sendTime,proto3" json:"sendTime"` - CreateTime int64 `protobuf:"varint,17,opt,name=createTime,proto3" json:"createTime"` - Ex string `protobuf:"bytes,18,opt,name=ex,proto3" json:"ex"` - GroupFaceURL string `protobuf:"bytes,19,opt,name=groupFaceURL,proto3" json:"groupFaceURL"` + ServerMsgID string `protobuf:"bytes,1,opt,name=serverMsgID,proto3" json:"serverMsgID"` + ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` + SendID string `protobuf:"bytes,3,opt,name=sendID,proto3" json:"sendID"` + RecvID string `protobuf:"bytes,4,opt,name=recvID,proto3" json:"recvID"` + GroupID string `protobuf:"bytes,5,opt,name=groupID,proto3" json:"groupID"` + RecvNickname string `protobuf:"bytes,6,opt,name=recvNickname,proto3" json:"recvNickname"` + SenderPlatformID int32 `protobuf:"varint,7,opt,name=senderPlatformID,proto3" json:"senderPlatformID"` + SenderNickname string `protobuf:"bytes,8,opt,name=senderNickname,proto3" json:"senderNickname"` + SenderFaceURL string `protobuf:"bytes,9,opt,name=senderFaceURL,proto3" json:"senderFaceURL"` + GroupName string `protobuf:"bytes,10,opt,name=groupName,proto3" json:"groupName"` + SessionType int32 `protobuf:"varint,11,opt,name=sessionType,proto3" json:"sessionType"` + MsgFrom int32 `protobuf:"varint,12,opt,name=msgFrom,proto3" json:"msgFrom"` + ContentType int32 `protobuf:"varint,13,opt,name=contentType,proto3" json:"contentType"` + Content string `protobuf:"bytes,14,opt,name=content,proto3" json:"content"` + Status int32 `protobuf:"varint,15,opt,name=status,proto3" json:"status"` + SendTime int64 `protobuf:"varint,16,opt,name=sendTime,proto3" json:"sendTime"` + CreateTime int64 `protobuf:"varint,17,opt,name=createTime,proto3" json:"createTime"` + Ex string `protobuf:"bytes,18,opt,name=ex,proto3" json:"ex"` + GroupFaceURL string `protobuf:"bytes,19,opt,name=groupFaceURL,proto3" json:"groupFaceURL"` GroupMemberCount uint32 `protobuf:"varint,20,opt,name=groupMemberCount,proto3" json:"groupMemberCount"` - Seq int64 `protobuf:"varint,21,opt,name=seq,proto3" json:"seq"` - GroupOwner string `protobuf:"bytes,22,opt,name=groupOwner,proto3" json:"groupOwner"` - GroupType int32 `protobuf:"varint,23,opt,name=groupType,proto3" json:"groupType"` + Seq int64 `protobuf:"varint,21,opt,name=seq,proto3" json:"seq"` + GroupOwner string `protobuf:"bytes,22,opt,name=groupOwner,proto3" json:"groupOwner"` + GroupType int32 `protobuf:"varint,23,opt,name=groupType,proto3" json:"groupType"` } func (x *ChatLog) Reset() { @@ -2744,7 +2746,7 @@ type BatchSendMessageReq struct { unknownFields protoimpl.UnknownFields RecvIDList []string `protobuf:"bytes,1,rep,name=recvIDList,proto3" json:"recvIDList"` - MsgData *sdkws.MsgData `protobuf:"bytes,2,opt,name=msgData,proto3" json:"msgData"` + MsgData *sdkws.MsgData `protobuf:"bytes,2,opt,name=msgData,proto3" json:"msgData"` } func (x *BatchSendMessageReq) Reset() { diff --git a/pkg/proto/msggateway/msggateway.go b/pkg/proto/msggateway/msggateway.go index 5e0c85b45..45f20c7cb 100644 --- a/pkg/proto/msggateway/msggateway.go +++ b/pkg/proto/msggateway/msggateway.go @@ -16,6 +16,7 @@ package msggateway import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +// Check func (x *OnlinePushMsgReq) Check() error { if x.MsgData == nil { return errs.ErrArgs.Wrap("MsgData is empty") @@ -26,9 +27,11 @@ func (x *OnlinePushMsgReq) Check() error { if x.PushToUserID == "" { return errs.ErrArgs.Wrap("PushToUserID is empty") } + return nil } +// Check func (x *OnlineBatchPushOneMsgReq) Check() error { if x.MsgData == nil { return errs.ErrArgs.Wrap("MsgData is empty") @@ -39,16 +42,20 @@ func (x *OnlineBatchPushOneMsgReq) Check() error { if x.PushToUserIDs == nil { return errs.ErrArgs.Wrap("PushToUserIDs is empty") } + return nil } +// Check func (x *GetUsersOnlineStatusReq) Check() error { if x.UserIDs == nil { return errs.ErrArgs.Wrap("UserIDs is empty") } + return nil } +// Check func (x *KickUserOfflineReq) Check() error { if x.PlatformID < 1 || x.PlatformID > 9 { return errs.ErrArgs.Wrap("PlatformID is invalid") @@ -56,9 +63,11 @@ func (x *KickUserOfflineReq) Check() error { if x.KickUserIDList == nil { return errs.ErrArgs.Wrap("KickUserIDList is empty") } + return nil } +// Check func (x *MultiTerminalLoginCheckReq) Check() error { if x.PlatformID < 1 || x.PlatformID > 9 { return errs.ErrArgs.Wrap("PlatformID is invalid") @@ -69,5 +78,6 @@ func (x *MultiTerminalLoginCheckReq) Check() error { if x.Token == "" { return errs.ErrArgs.Wrap("Token is empty") } + return nil } diff --git a/pkg/proto/msggateway/msggateway.pb.go b/pkg/proto/msggateway/msggateway.pb.go index d922d98b4..353524897 100644 --- a/pkg/proto/msggateway/msggateway.pb.go +++ b/pkg/proto/msggateway/msggateway.pb.go @@ -22,14 +22,16 @@ package msggateway import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( @@ -44,7 +46,7 @@ type OnlinePushMsgReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` + MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` PushToUserID string `protobuf:"bytes,2,opt,name=pushToUserID,proto3" json:"pushToUserID"` } @@ -146,8 +148,8 @@ type SingleMsgToUserResults struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` - Resp []*SingleMsgToUserPlatform `protobuf:"bytes,2,rep,name=resp,proto3" json:"resp"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + Resp []*SingleMsgToUserPlatform `protobuf:"bytes,2,rep,name=resp,proto3" json:"resp"` OnlinePush bool `protobuf:"varint,3,opt,name=onlinePush,proto3" json:"onlinePush"` } @@ -209,7 +211,7 @@ type OnlineBatchPushOneMsgReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` + MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` PushToUserIDs []string `protobuf:"bytes,2,rep,name=pushToUserIDs,proto3" json:"pushToUserIDs"` } @@ -311,8 +313,8 @@ type SingleMsgToUserPlatform struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ResultCode int64 `protobuf:"varint,1,opt,name=ResultCode,proto3" json:"ResultCode"` - RecvID string `protobuf:"bytes,2,opt,name=RecvID,proto3" json:"RecvID"` + ResultCode int64 `protobuf:"varint,1,opt,name=ResultCode,proto3" json:"ResultCode"` + RecvID string `protobuf:"bytes,2,opt,name=RecvID,proto3" json:"RecvID"` RecvPlatFormID int32 `protobuf:"varint,3,opt,name=RecvPlatFormID,proto3" json:"RecvPlatFormID"` } @@ -422,7 +424,7 @@ type GetUsersOnlineStatusResp struct { unknownFields protoimpl.UnknownFields SuccessResult []*GetUsersOnlineStatusResp_SuccessResult `protobuf:"bytes,1,rep,name=successResult,proto3" json:"successResult"` - FailedResult []*GetUsersOnlineStatusResp_FailedDetail `protobuf:"bytes,2,rep,name=failedResult,proto3" json:"failedResult"` + FailedResult []*GetUsersOnlineStatusResp_FailedDetail `protobuf:"bytes,2,rep,name=failedResult,proto3" json:"failedResult"` } func (x *GetUsersOnlineStatusResp) Reset() { @@ -476,8 +478,8 @@ type SingleDetail struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` SinglePlatformToken []*SinglePlatformToken `protobuf:"bytes,3,rep,name=singlePlatformToken,proto3" json:"singlePlatformToken"` } @@ -540,8 +542,8 @@ type SinglePlatformToken struct { unknownFields protoimpl.UnknownFields Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform"` - Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` - Token []string `protobuf:"bytes,3,rep,name=token,proto3" json:"token"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total"` + Token []string `protobuf:"bytes,3,rep,name=token,proto3" json:"token"` } func (x *SinglePlatformToken) Reset() { @@ -602,7 +604,7 @@ type KickUserOfflineReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PlatformID int32 `protobuf:"varint,1,opt,name=platformID,proto3" json:"platformID"` + PlatformID int32 `protobuf:"varint,1,opt,name=platformID,proto3" json:"platformID"` KickUserIDList []string `protobuf:"bytes,2,rep,name=kickUserIDList,proto3" json:"kickUserIDList"` } @@ -695,9 +697,9 @@ type MultiTerminalLoginCheckReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` PlatformID int32 `protobuf:"varint,2,opt,name=platformID,proto3" json:"platformID"` - Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token"` + Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token"` OperationID string `protobuf:"bytes,4,opt,name=operationID,proto3" json:"operationID"` } @@ -804,11 +806,11 @@ type GetUsersOnlineStatusResp_SuccessDetail struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` - ConnID string `protobuf:"bytes,3,opt,name=connID,proto3" json:"connID"` + Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` + ConnID string `protobuf:"bytes,3,opt,name=connID,proto3" json:"connID"` IsBackground bool `protobuf:"varint,4,opt,name=isBackground,proto3" json:"isBackground"` - Token string `protobuf:"bytes,5,opt,name=token,proto3" json:"token"` + Token string `protobuf:"bytes,5,opt,name=token,proto3" json:"token"` } func (x *GetUsersOnlineStatusResp_SuccessDetail) Reset() { @@ -930,8 +932,8 @@ type GetUsersOnlineStatusResp_SuccessResult struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` DetailPlatformStatus []*GetUsersOnlineStatusResp_SuccessDetail `protobuf:"bytes,3,rep,name=detailPlatformStatus,proto3" json:"detailPlatformStatus"` } diff --git a/pkg/proto/push/push.go b/pkg/proto/push/push.go index 2f117acda..83c6e9a9f 100644 --- a/pkg/proto/push/push.go +++ b/pkg/proto/push/push.go @@ -16,6 +16,7 @@ package push import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +// Check func (x *PushMsgReq) Check() error { if x.MsgData == nil { return errs.ErrArgs.Wrap("MsgData is empty") @@ -26,9 +27,11 @@ func (x *PushMsgReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("ConversationID is empty") } + return nil } +// Check func (x *DelUserPushTokenReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("UserID is empty") @@ -36,5 +39,6 @@ func (x *DelUserPushTokenReq) Check() error { if x.PlatformID < 1 || x.PlatformID > 9 { return errs.ErrArgs.Wrap("PlatformID is invalid") } + return nil } diff --git a/pkg/proto/push/push.pb.go b/pkg/proto/push/push.pb.go index 1dc9d2ab9..7ef946b60 100644 --- a/pkg/proto/push/push.pb.go +++ b/pkg/proto/push/push.pb.go @@ -22,14 +22,16 @@ package push import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( @@ -44,7 +46,7 @@ type PushMsgReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` + MsgData *sdkws.MsgData `protobuf:"bytes,1,opt,name=msgData,proto3" json:"msgData"` ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` } @@ -137,7 +139,7 @@ type DelUserPushTokenReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` PlatformID int32 `protobuf:"varint,2,opt,name=platformID,proto3" json:"platformID"` } diff --git a/pkg/proto/sdkws/sdkws.go b/pkg/proto/sdkws/sdkws.go index d0b0ae8aa..ff4630629 100644 --- a/pkg/proto/sdkws/sdkws.go +++ b/pkg/proto/sdkws/sdkws.go @@ -19,6 +19,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" ) +// Check func (x *MsgData) Check() error { if x.SendID == "" { return errs.ErrArgs.Wrap("sendID is empty") @@ -42,5 +43,6 @@ func (x *MsgData) Check() error { return errs.ErrArgs.Wrap("GroupID is empty") } } + return nil } diff --git a/pkg/proto/sdkws/sdkws.pb.go b/pkg/proto/sdkws/sdkws.pb.go index b45d46d4c..ca6e6135a 100644 --- a/pkg/proto/sdkws/sdkws.pb.go +++ b/pkg/proto/sdkws/sdkws.pb.go @@ -21,11 +21,13 @@ package sdkws import ( - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" ) const ( @@ -87,23 +89,23 @@ type GroupInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - GroupName string `protobuf:"bytes,2,opt,name=groupName,proto3" json:"groupName"` - Notification string `protobuf:"bytes,3,opt,name=notification,proto3" json:"notification"` - Introduction string `protobuf:"bytes,4,opt,name=introduction,proto3" json:"introduction"` - FaceURL string `protobuf:"bytes,5,opt,name=faceURL,proto3" json:"faceURL"` - OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID,proto3" json:"ownerUserID"` - CreateTime int64 `protobuf:"varint,7,opt,name=createTime,proto3" json:"createTime"` - MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount,proto3" json:"memberCount"` - Ex string `protobuf:"bytes,9,opt,name=ex,proto3" json:"ex"` - Status int32 `protobuf:"varint,10,opt,name=status,proto3" json:"status"` - CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID,proto3" json:"creatorUserID"` - GroupType int32 `protobuf:"varint,12,opt,name=groupType,proto3" json:"groupType"` - NeedVerification int32 `protobuf:"varint,13,opt,name=needVerification,proto3" json:"needVerification"` - LookMemberInfo int32 `protobuf:"varint,14,opt,name=lookMemberInfo,proto3" json:"lookMemberInfo"` - ApplyMemberFriend int32 `protobuf:"varint,15,opt,name=applyMemberFriend,proto3" json:"applyMemberFriend"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupName string `protobuf:"bytes,2,opt,name=groupName,proto3" json:"groupName"` + Notification string `protobuf:"bytes,3,opt,name=notification,proto3" json:"notification"` + Introduction string `protobuf:"bytes,4,opt,name=introduction,proto3" json:"introduction"` + FaceURL string `protobuf:"bytes,5,opt,name=faceURL,proto3" json:"faceURL"` + OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID,proto3" json:"ownerUserID"` + CreateTime int64 `protobuf:"varint,7,opt,name=createTime,proto3" json:"createTime"` + MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount,proto3" json:"memberCount"` + Ex string `protobuf:"bytes,9,opt,name=ex,proto3" json:"ex"` + Status int32 `protobuf:"varint,10,opt,name=status,proto3" json:"status"` + CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID,proto3" json:"creatorUserID"` + GroupType int32 `protobuf:"varint,12,opt,name=groupType,proto3" json:"groupType"` + NeedVerification int32 `protobuf:"varint,13,opt,name=needVerification,proto3" json:"needVerification"` + LookMemberInfo int32 `protobuf:"varint,14,opt,name=lookMemberInfo,proto3" json:"lookMemberInfo"` + ApplyMemberFriend int32 `protobuf:"varint,15,opt,name=applyMemberFriend,proto3" json:"applyMemberFriend"` NotificationUpdateTime int64 `protobuf:"varint,16,opt,name=notificationUpdateTime,proto3" json:"notificationUpdateTime"` - NotificationUserID string `protobuf:"bytes,17,opt,name=notificationUserID,proto3" json:"notificationUserID"` + NotificationUserID string `protobuf:"bytes,17,opt,name=notificationUserID,proto3" json:"notificationUserID"` } func (x *GroupInfo) Reset() { @@ -262,14 +264,14 @@ type GroupInfoForSet struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - GroupName string `protobuf:"bytes,2,opt,name=groupName,proto3" json:"groupName"` - Notification string `protobuf:"bytes,3,opt,name=notification,proto3" json:"notification"` - Introduction string `protobuf:"bytes,4,opt,name=introduction,proto3" json:"introduction"` - FaceURL string `protobuf:"bytes,5,opt,name=faceURL,proto3" json:"faceURL"` - Ex string `protobuf:"bytes,6,opt,name=ex,proto3" json:"ex"` - NeedVerification *wrapperspb.Int32Value `protobuf:"bytes,7,opt,name=needVerification,proto3" json:"needVerification"` - LookMemberInfo *wrapperspb.Int32Value `protobuf:"bytes,8,opt,name=lookMemberInfo,proto3" json:"lookMemberInfo"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + GroupName string `protobuf:"bytes,2,opt,name=groupName,proto3" json:"groupName"` + Notification string `protobuf:"bytes,3,opt,name=notification,proto3" json:"notification"` + Introduction string `protobuf:"bytes,4,opt,name=introduction,proto3" json:"introduction"` + FaceURL string `protobuf:"bytes,5,opt,name=faceURL,proto3" json:"faceURL"` + Ex string `protobuf:"bytes,6,opt,name=ex,proto3" json:"ex"` + NeedVerification *wrapperspb.Int32Value `protobuf:"bytes,7,opt,name=needVerification,proto3" json:"needVerification"` + LookMemberInfo *wrapperspb.Int32Value `protobuf:"bytes,8,opt,name=lookMemberInfo,proto3" json:"lookMemberInfo"` ApplyMemberFriend *wrapperspb.Int32Value `protobuf:"bytes,9,opt,name=applyMemberFriend,proto3" json:"applyMemberFriend"` } @@ -373,18 +375,18 @@ type GroupMemberFullInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` - RoleLevel int32 `protobuf:"varint,3,opt,name=roleLevel,proto3" json:"roleLevel"` - JoinTime int64 `protobuf:"varint,4,opt,name=joinTime,proto3" json:"joinTime"` - Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname"` - FaceURL string `protobuf:"bytes,6,opt,name=faceURL,proto3" json:"faceURL"` + GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + RoleLevel int32 `protobuf:"varint,3,opt,name=roleLevel,proto3" json:"roleLevel"` + JoinTime int64 `protobuf:"varint,4,opt,name=joinTime,proto3" json:"joinTime"` + Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname"` + FaceURL string `protobuf:"bytes,6,opt,name=faceURL,proto3" json:"faceURL"` AppMangerLevel int32 `protobuf:"varint,7,opt,name=appMangerLevel,proto3" json:"appMangerLevel"` //if >0 - JoinSource int32 `protobuf:"varint,8,opt,name=joinSource,proto3" json:"joinSource"` - OperatorUserID string `protobuf:"bytes,9,opt,name=operatorUserID,proto3" json:"operatorUserID"` - Ex string `protobuf:"bytes,10,opt,name=ex,proto3" json:"ex"` - MuteEndTime int64 `protobuf:"varint,11,opt,name=muteEndTime,proto3" json:"muteEndTime"` - InviterUserID string `protobuf:"bytes,12,opt,name=inviterUserID,proto3" json:"inviterUserID"` + JoinSource int32 `protobuf:"varint,8,opt,name=joinSource,proto3" json:"joinSource"` + OperatorUserID string `protobuf:"bytes,9,opt,name=operatorUserID,proto3" json:"operatorUserID"` + Ex string `protobuf:"bytes,10,opt,name=ex,proto3" json:"ex"` + MuteEndTime int64 `protobuf:"varint,11,opt,name=muteEndTime,proto3" json:"muteEndTime"` + InviterUserID string `protobuf:"bytes,12,opt,name=inviterUserID,proto3" json:"inviterUserID"` } func (x *GroupMemberFullInfo) Reset() { @@ -508,10 +510,10 @@ type PublicUserInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname"` - FaceURL string `protobuf:"bytes,3,opt,name=faceURL,proto3" json:"faceURL"` - Ex string `protobuf:"bytes,4,opt,name=ex,proto3" json:"ex"` + FaceURL string `protobuf:"bytes,3,opt,name=faceURL,proto3" json:"faceURL"` + Ex string `protobuf:"bytes,4,opt,name=ex,proto3" json:"ex"` } func (x *PublicUserInfo) Reset() { @@ -579,12 +581,12 @@ type UserInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` - Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname"` - FaceURL string `protobuf:"bytes,3,opt,name=faceURL,proto3" json:"faceURL"` - Ex string `protobuf:"bytes,4,opt,name=ex,proto3" json:"ex"` - CreateTime int64 `protobuf:"varint,5,opt,name=createTime,proto3" json:"createTime"` - AppMangerLevel int32 `protobuf:"varint,6,opt,name=appMangerLevel,proto3" json:"appMangerLevel"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname"` + FaceURL string `protobuf:"bytes,3,opt,name=faceURL,proto3" json:"faceURL"` + Ex string `protobuf:"bytes,4,opt,name=ex,proto3" json:"ex"` + CreateTime int64 `protobuf:"varint,5,opt,name=createTime,proto3" json:"createTime"` + AppMangerLevel int32 `protobuf:"varint,6,opt,name=appMangerLevel,proto3" json:"appMangerLevel"` GlobalRecvMsgOpt int32 `protobuf:"varint,7,opt,name=globalRecvMsgOpt,proto3" json:"globalRecvMsgOpt"` } @@ -674,13 +676,13 @@ type FriendInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` - Remark string `protobuf:"bytes,2,opt,name=remark,proto3" json:"remark"` - CreateTime int64 `protobuf:"varint,3,opt,name=createTime,proto3" json:"createTime"` - FriendUser *UserInfo `protobuf:"bytes,4,opt,name=friendUser,proto3" json:"friendUser"` - AddSource int32 `protobuf:"varint,5,opt,name=addSource,proto3" json:"addSource"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + Remark string `protobuf:"bytes,2,opt,name=remark,proto3" json:"remark"` + CreateTime int64 `protobuf:"varint,3,opt,name=createTime,proto3" json:"createTime"` + FriendUser *UserInfo `protobuf:"bytes,4,opt,name=friendUser,proto3" json:"friendUser"` + AddSource int32 `protobuf:"varint,5,opt,name=addSource,proto3" json:"addSource"` OperatorUserID string `protobuf:"bytes,6,opt,name=operatorUserID,proto3" json:"operatorUserID"` - Ex string `protobuf:"bytes,7,opt,name=ex,proto3" json:"ex"` + Ex string `protobuf:"bytes,7,opt,name=ex,proto3" json:"ex"` } func (x *FriendInfo) Reset() { @@ -769,12 +771,12 @@ type BlackInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` - CreateTime int64 `protobuf:"varint,2,opt,name=createTime,proto3" json:"createTime"` - BlackUserInfo *PublicUserInfo `protobuf:"bytes,3,opt,name=blackUserInfo,proto3" json:"blackUserInfo"` - AddSource int32 `protobuf:"varint,4,opt,name=addSource,proto3" json:"addSource"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + CreateTime int64 `protobuf:"varint,2,opt,name=createTime,proto3" json:"createTime"` + BlackUserInfo *PublicUserInfo `protobuf:"bytes,3,opt,name=blackUserInfo,proto3" json:"blackUserInfo"` + AddSource int32 `protobuf:"varint,4,opt,name=addSource,proto3" json:"addSource"` OperatorUserID string `protobuf:"bytes,5,opt,name=operatorUserID,proto3" json:"operatorUserID"` - Ex string `protobuf:"bytes,6,opt,name=ex,proto3" json:"ex"` + Ex string `protobuf:"bytes,6,opt,name=ex,proto3" json:"ex"` } func (x *BlackInfo) Reset() { @@ -856,16 +858,16 @@ type GroupRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserInfo *PublicUserInfo `protobuf:"bytes,1,opt,name=userInfo,proto3" json:"userInfo"` - GroupInfo *GroupInfo `protobuf:"bytes,2,opt,name=groupInfo,proto3" json:"groupInfo"` - HandleResult int32 `protobuf:"varint,3,opt,name=handleResult,proto3" json:"handleResult"` - ReqMsg string `protobuf:"bytes,4,opt,name=reqMsg,proto3" json:"reqMsg"` - HandleMsg string `protobuf:"bytes,5,opt,name=handleMsg,proto3" json:"handleMsg"` - ReqTime int64 `protobuf:"varint,6,opt,name=reqTime,proto3" json:"reqTime"` - HandleUserID string `protobuf:"bytes,7,opt,name=handleUserID,proto3" json:"handleUserID"` - HandleTime int64 `protobuf:"varint,8,opt,name=handleTime,proto3" json:"handleTime"` - Ex string `protobuf:"bytes,9,opt,name=ex,proto3" json:"ex"` - JoinSource int32 `protobuf:"varint,10,opt,name=joinSource,proto3" json:"joinSource"` + UserInfo *PublicUserInfo `protobuf:"bytes,1,opt,name=userInfo,proto3" json:"userInfo"` + GroupInfo *GroupInfo `protobuf:"bytes,2,opt,name=groupInfo,proto3" json:"groupInfo"` + HandleResult int32 `protobuf:"varint,3,opt,name=handleResult,proto3" json:"handleResult"` + ReqMsg string `protobuf:"bytes,4,opt,name=reqMsg,proto3" json:"reqMsg"` + HandleMsg string `protobuf:"bytes,5,opt,name=handleMsg,proto3" json:"handleMsg"` + ReqTime int64 `protobuf:"varint,6,opt,name=reqTime,proto3" json:"reqTime"` + HandleUserID string `protobuf:"bytes,7,opt,name=handleUserID,proto3" json:"handleUserID"` + HandleTime int64 `protobuf:"varint,8,opt,name=handleTime,proto3" json:"handleTime"` + Ex string `protobuf:"bytes,9,opt,name=ex,proto3" json:"ex"` + JoinSource int32 `protobuf:"varint,10,opt,name=joinSource,proto3" json:"joinSource"` InviterUserID string `protobuf:"bytes,11,opt,name=inviterUserID,proto3" json:"inviterUserID"` } @@ -983,19 +985,19 @@ type FriendRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FromUserID string `protobuf:"bytes,1,opt,name=fromUserID,proto3" json:"fromUserID"` - FromNickname string `protobuf:"bytes,2,opt,name=fromNickname,proto3" json:"fromNickname"` - FromFaceURL string `protobuf:"bytes,3,opt,name=fromFaceURL,proto3" json:"fromFaceURL"` - ToUserID string `protobuf:"bytes,4,opt,name=toUserID,proto3" json:"toUserID"` - ToNickname string `protobuf:"bytes,5,opt,name=toNickname,proto3" json:"toNickname"` - ToFaceURL string `protobuf:"bytes,6,opt,name=toFaceURL,proto3" json:"toFaceURL"` - HandleResult int32 `protobuf:"varint,7,opt,name=handleResult,proto3" json:"handleResult"` - ReqMsg string `protobuf:"bytes,8,opt,name=reqMsg,proto3" json:"reqMsg"` - CreateTime int64 `protobuf:"varint,9,opt,name=createTime,proto3" json:"createTime"` + FromUserID string `protobuf:"bytes,1,opt,name=fromUserID,proto3" json:"fromUserID"` + FromNickname string `protobuf:"bytes,2,opt,name=fromNickname,proto3" json:"fromNickname"` + FromFaceURL string `protobuf:"bytes,3,opt,name=fromFaceURL,proto3" json:"fromFaceURL"` + ToUserID string `protobuf:"bytes,4,opt,name=toUserID,proto3" json:"toUserID"` + ToNickname string `protobuf:"bytes,5,opt,name=toNickname,proto3" json:"toNickname"` + ToFaceURL string `protobuf:"bytes,6,opt,name=toFaceURL,proto3" json:"toFaceURL"` + HandleResult int32 `protobuf:"varint,7,opt,name=handleResult,proto3" json:"handleResult"` + ReqMsg string `protobuf:"bytes,8,opt,name=reqMsg,proto3" json:"reqMsg"` + CreateTime int64 `protobuf:"varint,9,opt,name=createTime,proto3" json:"createTime"` HandlerUserID string `protobuf:"bytes,10,opt,name=handlerUserID,proto3" json:"handlerUserID"` - HandleMsg string `protobuf:"bytes,11,opt,name=handleMsg,proto3" json:"handleMsg"` - HandleTime int64 `protobuf:"varint,12,opt,name=handleTime,proto3" json:"handleTime"` - Ex string `protobuf:"bytes,13,opt,name=ex,proto3" json:"ex"` + HandleMsg string `protobuf:"bytes,11,opt,name=handleMsg,proto3" json:"handleMsg"` + HandleTime int64 `protobuf:"varint,12,opt,name=handleTime,proto3" json:"handleTime"` + Ex string `protobuf:"bytes,13,opt,name=ex,proto3" json:"ex"` } func (x *FriendRequest) Reset() { @@ -1126,8 +1128,8 @@ type PullMessageBySeqsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` - SeqRanges []*SeqRange `protobuf:"bytes,2,rep,name=seqRanges,proto3" json:"seqRanges"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + SeqRanges []*SeqRange `protobuf:"bytes,2,rep,name=seqRanges,proto3" json:"seqRanges"` Order PullOrder `protobuf:"varint,3,opt,name=order,proto3,enum=OpenIMServer.sdkws.PullOrder" json:"order"` } @@ -1190,9 +1192,9 @@ type SeqRange struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - Begin int64 `protobuf:"varint,2,opt,name=begin,proto3" json:"begin"` - End int64 `protobuf:"varint,3,opt,name=end,proto3" json:"end"` - Num int64 `protobuf:"varint,4,opt,name=num,proto3" json:"num"` + Begin int64 `protobuf:"varint,2,opt,name=begin,proto3" json:"begin"` + End int64 `protobuf:"varint,3,opt,name=end,proto3" json:"end"` + Num int64 `protobuf:"varint,4,opt,name=num,proto3" json:"num"` } func (x *SeqRange) Reset() { @@ -1260,7 +1262,7 @@ type PullMsgs struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Msgs []*MsgData `protobuf:"bytes,1,rep,name=Msgs,proto3" json:"Msgs"` + Msgs []*MsgData `protobuf:"bytes,1,rep,name=Msgs,proto3" json:"Msgs"` IsEnd bool `protobuf:"varint,2,opt,name=isEnd,proto3" json:"isEnd"` } @@ -1315,7 +1317,7 @@ type PullMessageBySeqsResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Msgs map[string]*PullMsgs `protobuf:"bytes,1,rep,name=msgs,proto3" json:"msgs" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Msgs map[string]*PullMsgs `protobuf:"bytes,1,rep,name=msgs,proto3" json:"msgs" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` NotificationMsgs map[string]*PullMsgs `protobuf:"bytes,2,rep,name=notificationMsgs,proto3" json:"notificationMsgs" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -1474,7 +1476,7 @@ type UserSendMsgResp struct { ServerMsgID string `protobuf:"bytes,1,opt,name=serverMsgID,proto3" json:"serverMsgID"` ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` - SendTime int64 `protobuf:"varint,3,opt,name=sendTime,proto3" json:"sendTime"` + SendTime int64 `protobuf:"varint,3,opt,name=sendTime,proto3" json:"sendTime"` } func (x *UserSendMsgResp) Reset() { @@ -1535,28 +1537,28 @@ type MsgData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SendID string `protobuf:"bytes,1,opt,name=sendID,proto3" json:"sendID"` - RecvID string `protobuf:"bytes,2,opt,name=recvID,proto3" json:"recvID"` - GroupID string `protobuf:"bytes,3,opt,name=groupID,proto3" json:"groupID"` - ClientMsgID string `protobuf:"bytes,4,opt,name=clientMsgID,proto3" json:"clientMsgID"` - ServerMsgID string `protobuf:"bytes,5,opt,name=serverMsgID,proto3" json:"serverMsgID"` + SendID string `protobuf:"bytes,1,opt,name=sendID,proto3" json:"sendID"` + RecvID string `protobuf:"bytes,2,opt,name=recvID,proto3" json:"recvID"` + GroupID string `protobuf:"bytes,3,opt,name=groupID,proto3" json:"groupID"` + ClientMsgID string `protobuf:"bytes,4,opt,name=clientMsgID,proto3" json:"clientMsgID"` + ServerMsgID string `protobuf:"bytes,5,opt,name=serverMsgID,proto3" json:"serverMsgID"` SenderPlatformID int32 `protobuf:"varint,6,opt,name=senderPlatformID,proto3" json:"senderPlatformID"` - SenderNickname string `protobuf:"bytes,7,opt,name=senderNickname,proto3" json:"senderNickname"` - SenderFaceURL string `protobuf:"bytes,8,opt,name=senderFaceURL,proto3" json:"senderFaceURL"` - SessionType int32 `protobuf:"varint,9,opt,name=sessionType,proto3" json:"sessionType"` - MsgFrom int32 `protobuf:"varint,10,opt,name=msgFrom,proto3" json:"msgFrom"` - ContentType int32 `protobuf:"varint,11,opt,name=contentType,proto3" json:"contentType"` - Content []byte `protobuf:"bytes,12,opt,name=content,proto3" json:"content"` - Seq int64 `protobuf:"varint,14,opt,name=seq,proto3" json:"seq"` - SendTime int64 `protobuf:"varint,15,opt,name=sendTime,proto3" json:"sendTime"` - CreateTime int64 `protobuf:"varint,16,opt,name=createTime,proto3" json:"createTime"` - Status int32 `protobuf:"varint,17,opt,name=status,proto3" json:"status"` - IsRead bool `protobuf:"varint,18,opt,name=isRead,proto3" json:"isRead"` - Options map[string]bool `protobuf:"bytes,19,rep,name=options,proto3" json:"options" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - OfflinePushInfo *OfflinePushInfo `protobuf:"bytes,20,opt,name=offlinePushInfo,proto3" json:"offlinePushInfo"` - AtUserIDList []string `protobuf:"bytes,21,rep,name=atUserIDList,proto3" json:"atUserIDList"` - AttachedInfo string `protobuf:"bytes,22,opt,name=attachedInfo,proto3" json:"attachedInfo"` - Ex string `protobuf:"bytes,23,opt,name=ex,proto3" json:"ex"` + SenderNickname string `protobuf:"bytes,7,opt,name=senderNickname,proto3" json:"senderNickname"` + SenderFaceURL string `protobuf:"bytes,8,opt,name=senderFaceURL,proto3" json:"senderFaceURL"` + SessionType int32 `protobuf:"varint,9,opt,name=sessionType,proto3" json:"sessionType"` + MsgFrom int32 `protobuf:"varint,10,opt,name=msgFrom,proto3" json:"msgFrom"` + ContentType int32 `protobuf:"varint,11,opt,name=contentType,proto3" json:"contentType"` + Content []byte `protobuf:"bytes,12,opt,name=content,proto3" json:"content"` + Seq int64 `protobuf:"varint,14,opt,name=seq,proto3" json:"seq"` + SendTime int64 `protobuf:"varint,15,opt,name=sendTime,proto3" json:"sendTime"` + CreateTime int64 `protobuf:"varint,16,opt,name=createTime,proto3" json:"createTime"` + Status int32 `protobuf:"varint,17,opt,name=status,proto3" json:"status"` + IsRead bool `protobuf:"varint,18,opt,name=isRead,proto3" json:"isRead"` + Options map[string]bool `protobuf:"bytes,19,rep,name=options,proto3" json:"options" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + OfflinePushInfo *OfflinePushInfo `protobuf:"bytes,20,opt,name=offlinePushInfo,proto3" json:"offlinePushInfo"` + AtUserIDList []string `protobuf:"bytes,21,rep,name=atUserIDList,proto3" json:"atUserIDList"` + AttachedInfo string `protobuf:"bytes,22,opt,name=attachedInfo,proto3" json:"attachedInfo"` + Ex string `protobuf:"bytes,23,opt,name=ex,proto3" json:"ex"` } func (x *MsgData) Reset() { @@ -1750,7 +1752,7 @@ type PushMessages struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Msgs map[string]*PullMsgs `protobuf:"bytes,1,rep,name=msgs,proto3" json:"msgs" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Msgs map[string]*PullMsgs `protobuf:"bytes,1,rep,name=msgs,proto3" json:"msgs" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` NotificationMsgs map[string]*PullMsgs `protobuf:"bytes,2,rep,name=notificationMsgs,proto3" json:"notificationMsgs" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -1805,12 +1807,12 @@ type OfflinePushInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title"` - Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc"` - Ex string `protobuf:"bytes,3,opt,name=ex,proto3" json:"ex"` - IOSPushSound string `protobuf:"bytes,4,opt,name=iOSPushSound,proto3" json:"iOSPushSound"` + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title"` + Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc"` + Ex string `protobuf:"bytes,3,opt,name=ex,proto3" json:"ex"` + IOSPushSound string `protobuf:"bytes,4,opt,name=iOSPushSound,proto3" json:"iOSPushSound"` IOSBadgeCount bool `protobuf:"varint,5,opt,name=iOSBadgeCount,proto3" json:"iOSBadgeCount"` - SignalInfo string `protobuf:"bytes,6,opt,name=signalInfo,proto3" json:"signalInfo"` + SignalInfo string `protobuf:"bytes,6,opt,name=signalInfo,proto3" json:"signalInfo"` } func (x *OfflinePushInfo) Reset() { @@ -1892,9 +1894,9 @@ type TipsComm struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Detail []byte `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail"` + Detail []byte `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail"` DefaultTips string `protobuf:"bytes,2,opt,name=defaultTips,proto3" json:"defaultTips"` - JsonDetail string `protobuf:"bytes,3,opt,name=jsonDetail,proto3" json:"jsonDetail"` + JsonDetail string `protobuf:"bytes,3,opt,name=jsonDetail,proto3" json:"jsonDetail"` } func (x *TipsComm) Reset() { @@ -1956,9 +1958,9 @@ type GroupCreatedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` - MemberList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList,proto3" json:"memberList"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + MemberList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList,proto3" json:"memberList"` OperationTime int64 `protobuf:"varint,4,opt,name=operationTime,proto3" json:"operationTime"` GroupOwnerUser *GroupMemberFullInfo `protobuf:"bytes,5,opt,name=groupOwnerUser,proto3" json:"groupOwnerUser"` } @@ -2036,9 +2038,9 @@ type GroupInfoSetTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OpUser *GroupMemberFullInfo `protobuf:"bytes,1,opt,name=opUser,proto3" json:"opUser"` //who do this + OpUser *GroupMemberFullInfo `protobuf:"bytes,1,opt,name=opUser,proto3" json:"opUser"` //who do this MuteTime int64 `protobuf:"varint,2,opt,name=muteTime,proto3" json:"muteTime"` - Group *GroupInfo `protobuf:"bytes,3,opt,name=group,proto3" json:"group"` + Group *GroupInfo `protobuf:"bytes,3,opt,name=group,proto3" json:"group"` } func (x *GroupInfoSetTips) Reset() { @@ -2100,7 +2102,7 @@ type GroupInfoSetNameTips struct { unknownFields protoimpl.UnknownFields OpUser *GroupMemberFullInfo `protobuf:"bytes,1,opt,name=opUser,proto3" json:"opUser"` //who do this - Group *GroupInfo `protobuf:"bytes,2,opt,name=group,proto3" json:"group"` + Group *GroupInfo `protobuf:"bytes,2,opt,name=group,proto3" json:"group"` } func (x *GroupInfoSetNameTips) Reset() { @@ -2155,7 +2157,7 @@ type GroupInfoSetAnnouncementTips struct { unknownFields protoimpl.UnknownFields OpUser *GroupMemberFullInfo `protobuf:"bytes,1,opt,name=opUser,proto3" json:"opUser"` //who do this - Group *GroupInfo `protobuf:"bytes,2,opt,name=group,proto3" json:"group"` + Group *GroupInfo `protobuf:"bytes,2,opt,name=group,proto3" json:"group"` } func (x *GroupInfoSetAnnouncementTips) Reset() { @@ -2210,9 +2212,9 @@ type JoinGroupApplicationTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` Applicant *PublicUserInfo `protobuf:"bytes,2,opt,name=applicant,proto3" json:"applicant"` - ReqMsg string `protobuf:"bytes,3,opt,name=reqMsg,proto3" json:"reqMsg"` + ReqMsg string `protobuf:"bytes,3,opt,name=reqMsg,proto3" json:"reqMsg"` } func (x *JoinGroupApplicationTips) Reset() { @@ -2276,8 +2278,8 @@ type MemberQuitTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - QuitUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=quitUser,proto3" json:"quitUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + QuitUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=quitUser,proto3" json:"quitUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` } @@ -2340,9 +2342,9 @@ type GroupApplicationAcceptedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` - HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg,proto3" json:"handleMsg"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg,proto3" json:"handleMsg"` ReceiverAs int32 `protobuf:"varint,5,opt,name=receiverAs,proto3" json:"receiverAs"` // admin(==1) or applicant(==0) } @@ -2412,9 +2414,9 @@ type GroupApplicationRejectedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` - HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg,proto3" json:"handleMsg"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg,proto3" json:"handleMsg"` ReceiverAs int32 `protobuf:"varint,5,opt,name=receiverAs,proto3" json:"receiverAs"` // admin(==1) or applicant(==0) } @@ -2484,9 +2486,9 @@ type GroupOwnerTransferredTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` - NewGroupOwner *GroupMemberFullInfo `protobuf:"bytes,3,opt,name=newGroupOwner,proto3" json:"newGroupOwner"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + NewGroupOwner *GroupMemberFullInfo `protobuf:"bytes,3,opt,name=newGroupOwner,proto3" json:"newGroupOwner"` OperationTime int64 `protobuf:"varint,4,opt,name=operationTime,proto3" json:"operationTime"` } @@ -2556,8 +2558,8 @@ type MemberKickedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` KickedUserList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=kickedUserList,proto3" json:"kickedUserList"` OperationTime int64 `protobuf:"varint,4,opt,name=operationTime,proto3" json:"operationTime"` } @@ -2628,10 +2630,10 @@ type MemberInvitedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` InvitedUserList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=invitedUserList,proto3" json:"invitedUserList"` - OperationTime int64 `protobuf:"varint,4,opt,name=operationTime,proto3" json:"operationTime"` + OperationTime int64 `protobuf:"varint,4,opt,name=operationTime,proto3" json:"operationTime"` } func (x *MemberInvitedTips) Reset() { @@ -2700,8 +2702,8 @@ type MemberEnterTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - EntrantUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=entrantUser,proto3" json:"entrantUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + EntrantUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=entrantUser,proto3" json:"entrantUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` } @@ -2763,8 +2765,8 @@ type GroupDismissedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` } @@ -2826,11 +2828,11 @@ type GroupMemberMutedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` - MutedUser *GroupMemberFullInfo `protobuf:"bytes,4,opt,name=mutedUser,proto3" json:"mutedUser"` - MutedSeconds uint32 `protobuf:"varint,5,opt,name=mutedSeconds,proto3" json:"mutedSeconds"` + MutedUser *GroupMemberFullInfo `protobuf:"bytes,4,opt,name=mutedUser,proto3" json:"mutedUser"` + MutedSeconds uint32 `protobuf:"varint,5,opt,name=mutedSeconds,proto3" json:"mutedSeconds"` } func (x *GroupMemberMutedTips) Reset() { @@ -2905,10 +2907,10 @@ type GroupMemberCancelMutedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` - MutedUser *GroupMemberFullInfo `protobuf:"bytes,4,opt,name=mutedUser,proto3" json:"mutedUser"` + MutedUser *GroupMemberFullInfo `protobuf:"bytes,4,opt,name=mutedUser,proto3" json:"mutedUser"` } func (x *GroupMemberCancelMutedTips) Reset() { @@ -2976,8 +2978,8 @@ type GroupMutedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` } @@ -3039,8 +3041,8 @@ type GroupCancelMutedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` } @@ -3102,10 +3104,10 @@ type GroupMemberInfoSetTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` + Group *GroupInfo `protobuf:"bytes,1,opt,name=group,proto3" json:"group"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser,proto3" json:"opUser"` OperationTime int64 `protobuf:"varint,3,opt,name=operationTime,proto3" json:"operationTime"` - ChangedUser *GroupMemberFullInfo `protobuf:"bytes,4,opt,name=changedUser,proto3" json:"changedUser"` + ChangedUser *GroupMemberFullInfo `protobuf:"bytes,4,opt,name=changedUser,proto3" json:"changedUser"` } func (x *GroupMemberInfoSetTips) Reset() { @@ -3173,8 +3175,8 @@ type FriendApplication struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AddTime int64 `protobuf:"varint,1,opt,name=addTime,proto3" json:"addTime"` - AddSource string `protobuf:"bytes,2,opt,name=addSource,proto3" json:"addSource"` + AddTime int64 `protobuf:"varint,1,opt,name=addTime,proto3" json:"addTime"` + AddSource string `protobuf:"bytes,2,opt,name=addSource,proto3" json:"addSource"` AddWording string `protobuf:"bytes,3,opt,name=addWording,proto3" json:"addWording"` } @@ -3237,7 +3239,7 @@ type FromToUserID struct { unknownFields protoimpl.UnknownFields FromUserID string `protobuf:"bytes,1,opt,name=fromUserID,proto3" json:"fromUserID"` - ToUserID string `protobuf:"bytes,2,opt,name=toUserID,proto3" json:"toUserID"` + ToUserID string `protobuf:"bytes,2,opt,name=toUserID,proto3" json:"toUserID"` } func (x *FromToUserID) Reset() { @@ -3341,7 +3343,7 @@ type FriendApplicationApprovedTips struct { unknownFields protoimpl.UnknownFields FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID,proto3" json:"fromToUserID"` //from:同意者;to:请求发起者 - HandleMsg string `protobuf:"bytes,2,opt,name=handleMsg,proto3" json:"handleMsg"` + HandleMsg string `protobuf:"bytes,2,opt,name=handleMsg,proto3" json:"handleMsg"` } func (x *FriendApplicationApprovedTips) Reset() { @@ -3397,7 +3399,7 @@ type FriendApplicationRejectedTips struct { unknownFields protoimpl.UnknownFields FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID,proto3" json:"fromToUserID"` //from:拒绝者;to:请求发起者 - HandleMsg string `protobuf:"bytes,2,opt,name=handleMsg,proto3" json:"handleMsg"` + HandleMsg string `protobuf:"bytes,2,opt,name=handleMsg,proto3" json:"handleMsg"` } func (x *FriendApplicationRejectedTips) Reset() { @@ -3452,9 +3454,9 @@ type FriendAddedTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Friend *FriendInfo `protobuf:"bytes,1,opt,name=friend,proto3" json:"friend"` + Friend *FriendInfo `protobuf:"bytes,1,opt,name=friend,proto3" json:"friend"` OperationTime int64 `protobuf:"varint,2,opt,name=operationTime,proto3" json:"operationTime"` - OpUser *PublicUserInfo `protobuf:"bytes,3,opt,name=opUser,proto3" json:"opUser"` //who do this + OpUser *PublicUserInfo `protobuf:"bytes,3,opt,name=opUser,proto3" json:"opUser"` //who do this } func (x *FriendAddedTips) Reset() { @@ -3753,7 +3755,7 @@ type ConversationUpdateTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` ConversationIDList []string `protobuf:"bytes,2,rep,name=conversationIDList,proto3" json:"conversationIDList"` } @@ -3808,8 +3810,8 @@ type ConversationSetPrivateTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RecvID string `protobuf:"bytes,1,opt,name=recvID,proto3" json:"recvID"` - SendID string `protobuf:"bytes,2,opt,name=sendID,proto3" json:"sendID"` + RecvID string `protobuf:"bytes,1,opt,name=recvID,proto3" json:"recvID"` + SendID string `protobuf:"bytes,2,opt,name=sendID,proto3" json:"sendID"` IsPrivate bool `protobuf:"varint,3,opt,name=isPrivate,proto3" json:"isPrivate"` } @@ -3871,9 +3873,9 @@ type ConversationHasReadTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` - ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` - HasReadSeq int64 `protobuf:"varint,3,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` + HasReadSeq int64 `protobuf:"varint,3,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` UnreadCountTime int64 `protobuf:"varint,4,opt,name=unreadCountTime,proto3" json:"unreadCountTime"` } @@ -4037,8 +4039,8 @@ type DeleteMessageTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OpUserID string `protobuf:"bytes,1,opt,name=opUserID,proto3" json:"opUserID"` - UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` + OpUserID string `protobuf:"bytes,1,opt,name=opUserID,proto3" json:"opUserID"` + UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID"` Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs,proto3" json:"seqs"` } @@ -4100,11 +4102,11 @@ type RevokeMsgTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RevokerUserID string `protobuf:"bytes,1,opt,name=revokerUserID,proto3" json:"revokerUserID"` - ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` - RevokeTime int64 `protobuf:"varint,3,opt,name=revokeTime,proto3" json:"revokeTime"` - SesstionType int32 `protobuf:"varint,5,opt,name=sesstionType,proto3" json:"sesstionType"` - Seq int64 `protobuf:"varint,6,opt,name=seq,proto3" json:"seq"` + RevokerUserID string `protobuf:"bytes,1,opt,name=revokerUserID,proto3" json:"revokerUserID"` + ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` + RevokeTime int64 `protobuf:"varint,3,opt,name=revokeTime,proto3" json:"revokeTime"` + SesstionType int32 `protobuf:"varint,5,opt,name=sesstionType,proto3" json:"sesstionType"` + Seq int64 `protobuf:"varint,6,opt,name=seq,proto3" json:"seq"` ConversationID string `protobuf:"bytes,7,opt,name=conversationID,proto3" json:"conversationID"` } @@ -4187,17 +4189,17 @@ type MessageRevokedContent struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RevokerID string `protobuf:"bytes,1,opt,name=revokerID,proto3" json:"revokerID"` - RevokerRole int32 `protobuf:"varint,2,opt,name=revokerRole,proto3" json:"revokerRole"` - ClientMsgID string `protobuf:"bytes,3,opt,name=clientMsgID,proto3" json:"clientMsgID"` - RevokerNickname string `protobuf:"bytes,4,opt,name=revokerNickname,proto3" json:"revokerNickname"` - RevokeTime int64 `protobuf:"varint,5,opt,name=revokeTime,proto3" json:"revokeTime"` - SourceMessageSendTime int64 `protobuf:"varint,6,opt,name=sourceMessageSendTime,proto3" json:"sourceMessageSendTime"` - SourceMessageSendID string `protobuf:"bytes,7,opt,name=sourceMessageSendID,proto3" json:"sourceMessageSendID"` + RevokerID string `protobuf:"bytes,1,opt,name=revokerID,proto3" json:"revokerID"` + RevokerRole int32 `protobuf:"varint,2,opt,name=revokerRole,proto3" json:"revokerRole"` + ClientMsgID string `protobuf:"bytes,3,opt,name=clientMsgID,proto3" json:"clientMsgID"` + RevokerNickname string `protobuf:"bytes,4,opt,name=revokerNickname,proto3" json:"revokerNickname"` + RevokeTime int64 `protobuf:"varint,5,opt,name=revokeTime,proto3" json:"revokeTime"` + SourceMessageSendTime int64 `protobuf:"varint,6,opt,name=sourceMessageSendTime,proto3" json:"sourceMessageSendTime"` + SourceMessageSendID string `protobuf:"bytes,7,opt,name=sourceMessageSendID,proto3" json:"sourceMessageSendID"` SourceMessageSenderNickname string `protobuf:"bytes,8,opt,name=sourceMessageSenderNickname,proto3" json:"sourceMessageSenderNickname"` - SessionType int32 `protobuf:"varint,10,opt,name=sessionType,proto3" json:"sessionType"` - Seq int64 `protobuf:"varint,11,opt,name=seq,proto3" json:"seq"` - Ex string `protobuf:"bytes,12,opt,name=ex,proto3" json:"ex"` + SessionType int32 `protobuf:"varint,10,opt,name=sessionType,proto3" json:"sessionType"` + Seq int64 `protobuf:"varint,11,opt,name=seq,proto3" json:"seq"` + Ex string `protobuf:"bytes,12,opt,name=ex,proto3" json:"ex"` } func (x *MessageRevokedContent) Reset() { @@ -4314,7 +4316,7 @@ type ClearConversationTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` ConversationIDs []string `protobuf:"bytes,2,rep,name=conversationIDs,proto3" json:"conversationIDs"` } @@ -4369,9 +4371,9 @@ type DeleteMsgsTips struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` - Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs,proto3" json:"seqs"` + Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs,proto3" json:"seqs"` } func (x *DeleteMsgsTips) Reset() { @@ -4433,9 +4435,9 @@ type MarkAsReadTips struct { unknownFields protoimpl.UnknownFields MarkAsReadUserID string `protobuf:"bytes,1,opt,name=markAsReadUserID,proto3" json:"markAsReadUserID"` - ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` - Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs,proto3" json:"seqs"` - HasReadSeq int64 `protobuf:"varint,4,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` + ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` + Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs,proto3" json:"seqs"` + HasReadSeq int64 `protobuf:"varint,4,opt,name=hasReadSeq,proto3" json:"hasReadSeq"` } func (x *MarkAsReadTips) Reset() { @@ -4503,7 +4505,7 @@ type SetAppBackgroundStatusReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` IsBackground bool `protobuf:"varint,2,opt,name=isBackground,proto3" json:"isBackground"` } diff --git a/pkg/proto/statistics/statistics.pb.go b/pkg/proto/statistics/statistics.pb.go index 5660758f9..5e03e9797 100644 --- a/pkg/proto/statistics/statistics.pb.go +++ b/pkg/proto/statistics/statistics.pb.go @@ -21,9 +21,10 @@ package statistics import ( + reflect "reflect" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" ) const ( diff --git a/pkg/proto/third/third.go b/pkg/proto/third/third.go index 0e2072727..454191342 100644 --- a/pkg/proto/third/third.go +++ b/pkg/proto/third/third.go @@ -16,7 +16,7 @@ package third import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" -//func (x *ApplyPutReq) Check() error { +// func (x *ApplyPutReq) Check() error { // if x.PutID == "" { // return errs.ErrArgs.Wrap("PutID is empty") // } @@ -24,36 +24,37 @@ import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" // return errs.ErrArgs.Wrap("ContentType is empty") // } // return nil -//} +// } // -//func (x *ConfirmPutReq) Check() error { +// func (x *ConfirmPutReq) Check() error { // if x.PutID == "" { // return errs.ErrArgs.Wrap("PutID is empty") // } // return nil -//} +// } // -//func (x *GetUrlReq) Check() error { +// func (x *GetUrlReq) Check() error { // if x.Name == "" { // return errs.ErrArgs.Wrap("Name is empty") // } // return nil -//} +// } // -//func (x *GetPutReq) Check() error { +// func (x *GetPutReq) Check() error { // if x.PutID == "" { // return errs.ErrArgs.Wrap("PutID is empty") // } // return nil -//} +// } // -//func (x *GetHashInfoReq) Check() error { +// func (x *GetHashInfoReq) Check() error { // if x.Hash == "" { // return errs.ErrArgs.Wrap("Hash is empty") // } // return nil -//} +// } +// Check func (x *FcmUpdateTokenReq) Check() error { if x.PlatformID < 1 || x.PlatformID > 9 { return errs.ErrArgs.Wrap("PlatformID is invalid") @@ -64,12 +65,15 @@ func (x *FcmUpdateTokenReq) Check() error { if x.Account == "" { return errs.ErrArgs.Wrap("Account is empty") } + return nil } +// Check func (x *SetAppBadgeReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("UserID is empty") } + return nil } diff --git a/pkg/proto/third/third.pb.go b/pkg/proto/third/third.pb.go index 155b5f7cc..a098b296f 100644 --- a/pkg/proto/third/third.pb.go +++ b/pkg/proto/third/third.pb.go @@ -22,13 +22,14 @@ package third import ( context "context" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( @@ -43,7 +44,7 @@ type KeyValues struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key"` Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values"` } @@ -99,9 +100,9 @@ type SignPart struct { unknownFields protoimpl.UnknownFields PartNumber int32 `protobuf:"varint,1,opt,name=partNumber,proto3" json:"partNumber"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url"` - Query []*KeyValues `protobuf:"bytes,3,rep,name=query,proto3" json:"query"` - Header []*KeyValues `protobuf:"bytes,4,rep,name=header,proto3" json:"header"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url"` + Query []*KeyValues `protobuf:"bytes,3,rep,name=query,proto3" json:"query"` + Header []*KeyValues `protobuf:"bytes,4,rep,name=header,proto3" json:"header"` } func (x *SignPart) Reset() { @@ -169,10 +170,10 @@ type AuthSignParts struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` - Query []*KeyValues `protobuf:"bytes,2,rep,name=query,proto3" json:"query"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` + Query []*KeyValues `protobuf:"bytes,2,rep,name=query,proto3" json:"query"` Header []*KeyValues `protobuf:"bytes,3,rep,name=header,proto3" json:"header"` - Parts []*SignPart `protobuf:"bytes,4,rep,name=parts,proto3" json:"parts"` + Parts []*SignPart `protobuf:"bytes,4,rep,name=parts,proto3" json:"parts"` } func (x *AuthSignParts) Reset() { @@ -280,7 +281,7 @@ type PartLimitResp struct { MinPartSize int64 `protobuf:"varint,1,opt,name=minPartSize,proto3" json:"minPartSize"` MaxPartSize int64 `protobuf:"varint,2,opt,name=maxPartSize,proto3" json:"maxPartSize"` - MaxNumSize int32 `protobuf:"varint,3,opt,name=maxNumSize,proto3" json:"maxNumSize"` + MaxNumSize int32 `protobuf:"varint,3,opt,name=maxNumSize,proto3" json:"maxNumSize"` } func (x *PartLimitResp) Reset() { @@ -435,12 +436,12 @@ type InitiateMultipartUploadReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"` - Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size"` - PartSize int64 `protobuf:"varint,3,opt,name=partSize,proto3" json:"partSize"` - MaxParts int32 `protobuf:"varint,4,opt,name=maxParts,proto3" json:"maxParts"` - Cause string `protobuf:"bytes,5,opt,name=cause,proto3" json:"cause"` - Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name"` + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size"` + PartSize int64 `protobuf:"varint,3,opt,name=partSize,proto3" json:"partSize"` + MaxParts int32 `protobuf:"varint,4,opt,name=maxParts,proto3" json:"maxParts"` + Cause string `protobuf:"bytes,5,opt,name=cause,proto3" json:"cause"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name"` ContentType string `protobuf:"bytes,7,opt,name=contentType,proto3" json:"contentType"` } @@ -530,9 +531,9 @@ type UploadInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UploadID string `protobuf:"bytes,1,opt,name=uploadID,proto3" json:"uploadID"` - PartSize int64 `protobuf:"varint,2,opt,name=partSize,proto3" json:"partSize"` - Sign *AuthSignParts `protobuf:"bytes,3,opt,name=sign,proto3" json:"sign"` + UploadID string `protobuf:"bytes,1,opt,name=uploadID,proto3" json:"uploadID"` + PartSize int64 `protobuf:"varint,2,opt,name=partSize,proto3" json:"partSize"` + Sign *AuthSignParts `protobuf:"bytes,3,opt,name=sign,proto3" json:"sign"` ExpireTime int64 `protobuf:"varint,4,opt,name=expireTime,proto3" json:"expireTime"` } @@ -601,7 +602,7 @@ type InitiateMultipartUploadResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` Upload *UploadInfo `protobuf:"bytes,2,opt,name=upload,proto3" json:"upload"` } @@ -656,7 +657,7 @@ type AuthSignReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UploadID string `protobuf:"bytes,1,opt,name=uploadID,proto3" json:"uploadID"` + UploadID string `protobuf:"bytes,1,opt,name=uploadID,proto3" json:"uploadID"` PartNumbers []int32 `protobuf:"varint,2,rep,packed,name=partNumbers,proto3" json:"partNumbers"` } @@ -711,10 +712,10 @@ type AuthSignResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` - Query []*KeyValues `protobuf:"bytes,2,rep,name=query,proto3" json:"query"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` + Query []*KeyValues `protobuf:"bytes,2,rep,name=query,proto3" json:"query"` Header []*KeyValues `protobuf:"bytes,3,rep,name=header,proto3" json:"header"` - Parts []*SignPart `protobuf:"bytes,4,rep,name=parts,proto3" json:"parts"` + Parts []*SignPart `protobuf:"bytes,4,rep,name=parts,proto3" json:"parts"` } func (x *AuthSignResp) Reset() { @@ -782,11 +783,11 @@ type CompleteMultipartUploadReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UploadID string `protobuf:"bytes,1,opt,name=uploadID,proto3" json:"uploadID"` - Parts []string `protobuf:"bytes,2,rep,name=parts,proto3" json:"parts"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` + UploadID string `protobuf:"bytes,1,opt,name=uploadID,proto3" json:"uploadID"` + Parts []string `protobuf:"bytes,2,rep,name=parts,proto3" json:"parts"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` ContentType string `protobuf:"bytes,4,opt,name=contentType,proto3" json:"contentType"` - Cause string `protobuf:"bytes,5,opt,name=cause,proto3" json:"cause"` + Cause string `protobuf:"bytes,5,opt,name=cause,proto3" json:"cause"` } func (x *CompleteMultipartUploadReq) Reset() { @@ -955,7 +956,7 @@ type AccessURLResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` ExpireTime int64 `protobuf:"varint,2,opt,name=expireTime,proto3" json:"expireTime"` } @@ -1011,8 +1012,8 @@ type FcmUpdateTokenReq struct { unknownFields protoimpl.UnknownFields PlatformID int32 `protobuf:"varint,1,opt,name=platformID,proto3" json:"platformID"` - FcmToken string `protobuf:"bytes,2,opt,name=fcmToken,proto3" json:"fcmToken"` - Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account"` + FcmToken string `protobuf:"bytes,2,opt,name=fcmToken,proto3" json:"fcmToken"` + Account string `protobuf:"bytes,3,opt,name=account,proto3" json:"account"` ExpireTime int64 `protobuf:"varint,4,opt,name=expireTime,proto3" json:"expireTime"` } @@ -1119,7 +1120,7 @@ type SetAppBadgeReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` AppUnreadCount int32 `protobuf:"varint,2,opt,name=appUnreadCount,proto3" json:"appUnreadCount"` } diff --git a/pkg/proto/user/user.go b/pkg/proto/user/user.go index 06f07cb6e..f92ea9b9d 100644 --- a/pkg/proto/user/user.go +++ b/pkg/proto/user/user.go @@ -16,6 +16,7 @@ package user import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" +// Check func (x *GetAllUserIDReq) Check() error { if x.Pagination == nil { return errs.ErrArgs.Wrap("pagination is empty") @@ -23,23 +24,29 @@ func (x *GetAllUserIDReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *AccountCheckReq) Check() error { if x.CheckUserIDs == nil { return errs.ErrArgs.Wrap("CheckUserIDs is empty") } + return nil } +// Check func (x *GetDesignateUsersReq) Check() error { if x.UserIDs == nil { return errs.ErrArgs.Wrap("UserIDs is empty") } + return nil } +// Check func (x *UpdateUserInfoReq) Check() error { if x.UserInfo == nil { return errs.ErrArgs.Wrap("UserInfo is empty") @@ -47,9 +54,11 @@ func (x *UpdateUserInfoReq) Check() error { if x.UserInfo.UserID == "" { return errs.ErrArgs.Wrap("UserID is empty") } + return nil } +// Check func (x *SetGlobalRecvMessageOptReq) Check() error { if x.GlobalRecvMsgOpt > 2 || x.GlobalRecvMsgOpt < 0 { return errs.ErrArgs.Wrap("GlobalRecvMsgOpt is invalid") @@ -57,9 +66,11 @@ func (x *SetGlobalRecvMessageOptReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("UserID is empty") } + return nil } +// Check func (x *SetConversationReq) Check() error { if err := x.Conversation.Check(); err != nil { return err @@ -67,9 +78,11 @@ func (x *SetConversationReq) Check() error { if x.NotificationType < 1 || x.NotificationType > 3 { return errs.ErrArgs.Wrap("NotificationType is invalid") } + return nil } +// Check func (x *SetRecvMsgOptReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("OwnerUserID is empty") @@ -83,9 +96,11 @@ func (x *SetRecvMsgOptReq) Check() error { if x.NotificationType < 1 || x.NotificationType > 3 { return errs.ErrArgs.Wrap("NotificationType is invalid") } + return nil } +// Check func (x *GetConversationReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("OwnerUserID is empty") @@ -93,9 +108,11 @@ func (x *GetConversationReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("ConversationID is empty") } + return nil } +// Check func (x *GetConversationsReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("OwnerUserID is empty") @@ -103,16 +120,20 @@ func (x *GetConversationsReq) Check() error { if x.ConversationIDs == nil { return errs.ErrArgs.Wrap("ConversationIDs is empty") } + return nil } +// Check func (x *GetAllConversationsReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("OwnerUserID is empty") } + return nil } +// Check func (x *BatchSetConversationsReq) Check() error { if x.OwnerUserID == "" { return errs.ErrArgs.Wrap("OwnerUserID is empty") @@ -123,9 +144,11 @@ func (x *BatchSetConversationsReq) Check() error { if x.NotificationType < 1 || x.NotificationType > 3 { return errs.ErrArgs.Wrap("NotificationType is invalid") } + return nil } +// Check func (x *GetPaginationUsersReq) Check() error { if x.Pagination == nil { return errs.ErrArgs.Wrap("pagination is empty") @@ -133,23 +156,29 @@ func (x *GetPaginationUsersReq) Check() error { if x.Pagination.PageNumber < 1 { return errs.ErrArgs.Wrap("pageNumber is invalid") } + return nil } +// Check func (x *UserRegisterReq) Check() error { if x.Users == nil { return errs.ErrArgs.Wrap("Users is empty") } + return nil } +// Check func (x *GetGlobalRecvMessageOptReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("UserID is empty") } + return nil } +// Check func (x *UserRegisterCountReq) Check() error { if x.Start <= 0 { return errs.ErrArgs.Wrap("start is invalid") @@ -157,5 +186,6 @@ func (x *UserRegisterCountReq) Check() error { if x.End <= 0 { return errs.ErrArgs.Wrap("end is invalid") } + return nil } diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index 5046505db..12a1bd2c8 100644 --- a/pkg/proto/user/user.pb.go +++ b/pkg/proto/user/user.pb.go @@ -22,15 +22,17 @@ package user import ( context "context" - conversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + conversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( @@ -92,7 +94,7 @@ type GetAllUserIDResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` UserIDs []string `protobuf:"bytes,2,rep,name=userIDs,proto3" json:"userIDs"` } @@ -420,7 +422,7 @@ type SetGlobalRecvMessageOptReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` GlobalRecvMsgOpt int32 `protobuf:"varint,3,opt,name=globalRecvMsgOpt,proto3" json:"globalRecvMsgOpt"` } @@ -513,9 +515,9 @@ type SetConversationReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Conversation *conversation.Conversation `protobuf:"bytes,1,opt,name=conversation,proto3" json:"conversation"` + Conversation *conversation.Conversation `protobuf:"bytes,1,opt,name=conversation,proto3" json:"conversation"` NotificationType int32 `protobuf:"varint,2,opt,name=notificationType,proto3" json:"notificationType"` - OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID"` + OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID"` } func (x *SetConversationReq) Reset() { @@ -614,11 +616,11 @@ type SetRecvMsgOptReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` - ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` - RecvMsgOpt int32 `protobuf:"varint,3,opt,name=recvMsgOpt,proto3" json:"recvMsgOpt"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"` + RecvMsgOpt int32 `protobuf:"varint,3,opt,name=recvMsgOpt,proto3" json:"recvMsgOpt"` NotificationType int32 `protobuf:"varint,4,opt,name=notificationType,proto3" json:"notificationType"` - OperationID string `protobuf:"bytes,5,opt,name=operationID,proto3" json:"operationID"` + OperationID string `protobuf:"bytes,5,opt,name=operationID,proto3" json:"operationID"` } func (x *SetRecvMsgOptReq) Reset() { @@ -732,8 +734,8 @@ type GetConversationReq struct { unknownFields protoimpl.UnknownFields ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"` - OwnerUserID string `protobuf:"bytes,2,opt,name=ownerUserID,proto3" json:"ownerUserID"` - OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID"` + OwnerUserID string `protobuf:"bytes,2,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID"` } func (x *GetConversationReq) Reset() { @@ -841,9 +843,9 @@ type GetConversationsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"` ConversationIDs []string `protobuf:"bytes,2,rep,name=conversationIDs,proto3" json:"conversationIDs"` - OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID"` + OperationID string `protobuf:"bytes,3,opt,name=operationID,proto3" json:"operationID"` } func (x *GetConversationsReq) Reset() { @@ -1053,10 +1055,10 @@ type BatchSetConversationsReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Conversations []*conversation.Conversation `protobuf:"bytes,1,rep,name=conversations,proto3" json:"conversations"` - OwnerUserID string `protobuf:"bytes,2,opt,name=OwnerUserID,proto3" json:"OwnerUserID"` + Conversations []*conversation.Conversation `protobuf:"bytes,1,rep,name=conversations,proto3" json:"conversations"` + OwnerUserID string `protobuf:"bytes,2,opt,name=OwnerUserID,proto3" json:"OwnerUserID"` NotificationType int32 `protobuf:"varint,3,opt,name=notificationType,proto3" json:"notificationType"` - OperationID string `protobuf:"bytes,4,opt,name=OperationID,proto3" json:"OperationID"` + OperationID string `protobuf:"bytes,4,opt,name=OperationID,proto3" json:"OperationID"` } func (x *BatchSetConversationsReq) Reset() { @@ -1125,7 +1127,7 @@ type BatchSetConversationsResp struct { unknownFields protoimpl.UnknownFields Success []string `protobuf:"bytes,2,rep,name=Success,proto3" json:"Success"` - Failed []string `protobuf:"bytes,3,rep,name=Failed,proto3" json:"Failed"` + Failed []string `protobuf:"bytes,3,rep,name=Failed,proto3" json:"Failed"` } func (x *BatchSetConversationsResp) Reset() { @@ -1227,7 +1229,7 @@ type GetPaginationUsersResp struct { unknownFields protoimpl.UnknownFields Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` - Users []*sdkws.UserInfo `protobuf:"bytes,2,rep,name=users,proto3" json:"users"` + Users []*sdkws.UserInfo `protobuf:"bytes,2,rep,name=users,proto3" json:"users"` } func (x *GetPaginationUsersResp) Reset() { @@ -1282,7 +1284,7 @@ type UserRegisterReq struct { unknownFields protoimpl.UnknownFields Secret string `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret"` - Users []*sdkws.UserInfo `protobuf:"bytes,2,rep,name=users,proto3" json:"users"` + Users []*sdkws.UserInfo `protobuf:"bytes,2,rep,name=users,proto3" json:"users"` } func (x *UserRegisterReq) Reset() { @@ -1469,7 +1471,7 @@ type UserRegisterCountReq struct { unknownFields protoimpl.UnknownFields Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end"` } func (x *UserRegisterCountReq) Reset() { @@ -1523,9 +1525,9 @@ type UserRegisterCountResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` Before int64 `protobuf:"varint,2,opt,name=before,proto3" json:"before"` - Count map[string]int64 `protobuf:"bytes,3,rep,name=count,proto3" json:"count" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + Count map[string]int64 `protobuf:"bytes,3,rep,name=count,proto3" json:"count" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` } func (x *UserRegisterCountResp) Reset() { @@ -1586,7 +1588,7 @@ type AccountCheckRespSingleUserStatus struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` + UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID"` AccountStatus string `protobuf:"bytes,2,opt,name=accountStatus,proto3" json:"accountStatus"` } diff --git a/pkg/proto/wrapperspb/wrapperspb.pb.go b/pkg/proto/wrapperspb/wrapperspb.pb.go index 9678bb2a0..c08a87822 100644 --- a/pkg/proto/wrapperspb/wrapperspb.pb.go +++ b/pkg/proto/wrapperspb/wrapperspb.pb.go @@ -21,10 +21,11 @@ package wrapperspb import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/pkg/rpcclient/auth.go b/pkg/rpcclient/auth.go index aa13ed898..abde73548 100644 --- a/pkg/rpcclient/auth.go +++ b/pkg/rpcclient/auth.go @@ -24,15 +24,18 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/auth" ) +// NewAuth func NewAuth(discov discoveryregistry.SvcDiscoveryRegistry) *Auth { conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImAuthName) if err != nil { panic(err) } client := auth.NewAuthClient(conn) + return &Auth{discov: discov, conn: conn, Client: client} } +// Auth type Auth struct { conn grpc.ClientConnInterface Client auth.AuthClient diff --git a/pkg/rpcclient/conversation.go b/pkg/rpcclient/conversation.go index 71867620d..30fb1c8c7 100644 --- a/pkg/rpcclient/conversation.go +++ b/pkg/rpcclient/conversation.go @@ -26,27 +26,33 @@ import ( pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" ) +// Conversation type Conversation struct { Client pbConversation.ConversationClient conn grpc.ClientConnInterface discov discoveryregistry.SvcDiscoveryRegistry } +// NewConversation func NewConversation(discov discoveryregistry.SvcDiscoveryRegistry) *Conversation { conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImConversationName) if err != nil { panic(err) } client := pbConversation.NewConversationClient(conn) + return &Conversation{discov: discov, conn: conn, Client: client} } +// ConversationRpcClient type ConversationRpcClient Conversation +// NewConversationRpcClient func NewConversationRpcClient(discov discoveryregistry.SvcDiscoveryRegistry) ConversationRpcClient { return ConversationRpcClient(*NewConversation(discov)) } +// GetSingleConversationRecvMsgOpt func (c *ConversationRpcClient) GetSingleConversationRecvMsgOpt(ctx context.Context, userID, conversationID string) (int32, error) { var req pbConversation.GetConversationReq req.OwnerUserID = userID @@ -55,45 +61,59 @@ func (c *ConversationRpcClient) GetSingleConversationRecvMsgOpt(ctx context.Cont if err != nil { return 0, err } + return conversation.GetConversation().RecvMsgOpt, err } +// SingleChatFirstCreateConversation func (c *ConversationRpcClient) SingleChatFirstCreateConversation(ctx context.Context, recvID, sendID string) error { _, err := c.Client.CreateSingleChatConversations(ctx, &pbConversation.CreateSingleChatConversationsReq{RecvID: recvID, SendID: sendID}) + return err } +// GroupChatFirstCreateConversation func (c *ConversationRpcClient) GroupChatFirstCreateConversation(ctx context.Context, groupID string, userIDs []string) error { _, err := c.Client.CreateGroupChatConversations(ctx, &pbConversation.CreateGroupChatConversationsReq{UserIDs: userIDs, GroupID: groupID}) + return err } +// SetConversationMaxSeq func (c *ConversationRpcClient) SetConversationMaxSeq(ctx context.Context, ownerUserIDs []string, conversationID string, maxSeq int64) error { _, err := c.Client.SetConversationMaxSeq(ctx, &pbConversation.SetConversationMaxSeqReq{OwnerUserID: ownerUserIDs, ConversationID: conversationID, MaxSeq: maxSeq}) + return err } +// SetConversations func (c *ConversationRpcClient) SetConversations(ctx context.Context, userIDs []string, conversation *pbConversation.ConversationReq) error { _, err := c.Client.SetConversations(ctx, &pbConversation.SetConversationsReq{UserIDs: userIDs, Conversation: conversation}) + return err } +// GetConversationIDs func (c *ConversationRpcClient) GetConversationIDs(ctx context.Context, ownerUserID string) ([]string, error) { resp, err := c.Client.GetConversationIDs(ctx, &pbConversation.GetConversationIDsReq{UserID: ownerUserID}) if err != nil { return nil, err } + return resp.ConversationIDs, nil } +// GetConversation func (c *ConversationRpcClient) GetConversation(ctx context.Context, ownerUserID, conversationID string) (*pbConversation.Conversation, error) { resp, err := c.Client.GetConversation(ctx, &pbConversation.GetConversationReq{OwnerUserID: ownerUserID, ConversationID: conversationID}) if err != nil { return nil, err } + return resp.Conversation, nil } +// GetConversationsByConversationID func (c *ConversationRpcClient) GetConversationsByConversationID(ctx context.Context, conversationIDs []string) ([]*pbConversation.Conversation, error) { if len(conversationIDs) == 0 { return nil, nil @@ -105,9 +125,11 @@ func (c *ConversationRpcClient) GetConversationsByConversationID(ctx context.Con if len(resp.Conversations) == 0 { return nil, errs.ErrRecordNotFound.Wrap(fmt.Sprintf("conversationIDs: %v not found", conversationIDs)) } + return resp.Conversations, nil } +// GetConversations func (c *ConversationRpcClient) GetConversations( ctx context.Context, ownerUserID string, @@ -123,5 +145,6 @@ func (c *ConversationRpcClient) GetConversations( if err != nil { return nil, err } + return resp.Conversations, nil } diff --git a/pkg/rpcclient/friend.go b/pkg/rpcclient/friend.go index 5a8ac0633..edb75cc21 100644 --- a/pkg/rpcclient/friend.go +++ b/pkg/rpcclient/friend.go @@ -25,27 +25,33 @@ import ( sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) +// Friend type Friend struct { conn grpc.ClientConnInterface Client friend.FriendClient discov discoveryregistry.SvcDiscoveryRegistry } +// NewFriend func NewFriend(discov discoveryregistry.SvcDiscoveryRegistry) *Friend { conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImFriendName) if err != nil { panic(err) } client := friend.NewFriendClient(conn) + return &Friend{discov: discov, conn: conn, Client: client} } +// FriendRpcClient type FriendRpcClient Friend +// NewFriendRpcClient func NewFriendRpcClient(discov discoveryregistry.SvcDiscoveryRegistry) FriendRpcClient { return FriendRpcClient(*NewFriend(discov)) } +// GetFriendsInfo func (f *FriendRpcClient) GetFriendsInfo( ctx context.Context, ownerUserID, friendUserID string, @@ -58,31 +64,37 @@ func (f *FriendRpcClient) GetFriendsInfo( return nil, err } resp = r.FriendsInfo[0] + return } -// possibleFriendUserID是否在userID的好友中. +// IsFriend possibleFriendUserID是否在userID的好友中. func (f *FriendRpcClient) IsFriend(ctx context.Context, possibleFriendUserID, userID string) (bool, error) { resp, err := f.Client.IsFriend(ctx, &friend.IsFriendReq{UserID1: userID, UserID2: possibleFriendUserID}) if err != nil { return false, err } + return resp.InUser1Friends, nil } +// GetFriendIDs func (f *FriendRpcClient) GetFriendIDs(ctx context.Context, ownerUserID string) (friendIDs []string, err error) { req := friend.GetFriendIDsReq{UserID: ownerUserID} resp, err := f.Client.GetFriendIDs(ctx, &req) if err != nil { return nil, err } + return resp.FriendIDs, nil } +// IsBlocked func (b *FriendRpcClient) IsBlocked(ctx context.Context, possibleBlackUserID, userID string) (bool, error) { r, err := b.Client.IsBlack(ctx, &friend.IsBlackReq{UserID1: possibleBlackUserID, UserID2: userID}) if err != nil { return false, err } + return r.InUser2Blacks, nil } diff --git a/pkg/rpcclient/group.go b/pkg/rpcclient/group.go index 06333234f..65ef0ab0f 100644 --- a/pkg/rpcclient/group.go +++ b/pkg/rpcclient/group.go @@ -29,27 +29,33 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" ) +// Group type Group struct { conn grpc.ClientConnInterface Client group.GroupClient discov discoveryregistry.SvcDiscoveryRegistry } +// NewGroup func NewGroup(discov discoveryregistry.SvcDiscoveryRegistry) *Group { conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImGroupName) if err != nil { panic(err) } client := group.NewGroupClient(conn) + return &Group{discov: discov, conn: conn, Client: client} } +// GroupRpcClient type GroupRpcClient Group +// NewGroupRpcClient func NewGroupRpcClient(discov discoveryregistry.SvcDiscoveryRegistry) GroupRpcClient { return GroupRpcClient(*NewGroup(discov)) } +// GetGroupInfos func (g *GroupRpcClient) GetGroupInfos( ctx context.Context, groupIDs []string, @@ -71,14 +77,17 @@ func (g *GroupRpcClient) GetGroupInfos( return resp.GroupInfos, nil } +// GetGroupInfo func (g *GroupRpcClient) GetGroupInfo(ctx context.Context, groupID string) (*sdkws.GroupInfo, error) { groups, err := g.GetGroupInfos(ctx, []string{groupID}, true) if err != nil { return nil, err } + return groups[0], nil } +// GetGroupInfoMap func (g *GroupRpcClient) GetGroupInfoMap( ctx context.Context, groupIDs []string, @@ -88,11 +97,13 @@ func (g *GroupRpcClient) GetGroupInfoMap( if err != nil { return nil, err } + return utils.SliceToMap(groups, func(e *sdkws.GroupInfo) string { return e.GroupID }), nil } +// GetGroupMemberInfos func (g *GroupRpcClient) GetGroupMemberInfos( ctx context.Context, groupID string, @@ -113,9 +124,11 @@ func (g *GroupRpcClient) GetGroupMemberInfos( return nil, errs.ErrNotInGroupYet.Wrap(strings.Join(ids, ",")) } } + return resp.Members, nil } +// GetGroupMemberInfo func (g *GroupRpcClient) GetGroupMemberInfo( ctx context.Context, groupID string, @@ -125,9 +138,11 @@ func (g *GroupRpcClient) GetGroupMemberInfo( if err != nil { return nil, err } + return members[0], nil } +// GetGroupMemberInfoMap func (g *GroupRpcClient) GetGroupMemberInfoMap( ctx context.Context, groupID string, @@ -138,11 +153,13 @@ func (g *GroupRpcClient) GetGroupMemberInfoMap( if err != nil { return nil, err } + return utils.SliceToMap(members, func(e *sdkws.GroupMemberFullInfo) string { return e.UserID }), nil } +// GetOwnerAndAdminInfos func (g *GroupRpcClient) GetOwnerAndAdminInfos( ctx context.Context, groupID string, @@ -154,17 +171,21 @@ func (g *GroupRpcClient) GetOwnerAndAdminInfos( if err != nil { return nil, err } + return resp.Members, nil } +// GetOwnerInfo func (g *GroupRpcClient) GetOwnerInfo(ctx context.Context, groupID string) (*sdkws.GroupMemberFullInfo, error) { resp, err := g.Client.GetGroupMemberRoleLevel(ctx, &group.GetGroupMemberRoleLevelReq{ GroupID: groupID, RoleLevels: []int32{constant.GroupOwner}, }) + return resp.Members[0], err } +// GetGroupMemberIDs func (g *GroupRpcClient) GetGroupMemberIDs(ctx context.Context, groupID string) ([]string, error) { resp, err := g.Client.GetGroupMemberUserIDs(ctx, &group.GetGroupMemberUserIDsReq{ GroupID: groupID, @@ -172,9 +193,11 @@ func (g *GroupRpcClient) GetGroupMemberIDs(ctx context.Context, groupID string) if err != nil { return nil, err } + return resp.UserIDs, nil } +// GetGroupInfoCache func (g *GroupRpcClient) GetGroupInfoCache(ctx context.Context, groupID string) (*sdkws.GroupInfo, error) { resp, err := g.Client.GetGroupInfoCache(ctx, &group.GetGroupInfoCacheReq{ GroupID: groupID, @@ -182,9 +205,11 @@ func (g *GroupRpcClient) GetGroupInfoCache(ctx context.Context, groupID string) if err != nil { return nil, err } + return resp.GroupInfo, nil } +// GetGroupMemberCache func (g *GroupRpcClient) GetGroupMemberCache( ctx context.Context, groupID string, @@ -197,13 +222,16 @@ func (g *GroupRpcClient) GetGroupMemberCache( if err != nil { return nil, err } + return resp.Member, nil } +// DismissGroup func (g *GroupRpcClient) DismissGroup(ctx context.Context, groupID string) error { _, err := g.Client.DismissGroup(ctx, &group.DismissGroupReq{ GroupID: groupID, DeleteMember: true, }) + return err } diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index a012a5a5f..5555aba23 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -121,29 +121,36 @@ func newSessionTypeConf() map[int32]int32 { } } +// Message type Message struct { conn grpc.ClientConnInterface Client msg.MsgClient discov discoveryregistry.SvcDiscoveryRegistry } +// NewMessage func NewMessage(discov discoveryregistry.SvcDiscoveryRegistry) *Message { conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImMsgName) if err != nil { panic(err) } client := msg.NewMsgClient(conn) + return &Message{discov: discov, conn: conn, Client: client} } +// MessageRpcClient type MessageRpcClient Message +// NewMessageRpcClient func NewMessageRpcClient(discov discoveryregistry.SvcDiscoveryRegistry) MessageRpcClient { return MessageRpcClient(*NewMessage(discov)) } +// SendMsg func (m *MessageRpcClient) SendMsg(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error) { resp, err := m.Client.SendMsg(ctx, req) + return resp, err } @@ -154,17 +161,21 @@ func (m *MessageRpcClient) GetMaxSeq(ctx context.Context, req *sdkws.GetMaxSeqRe func (m *MessageRpcClient) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) { resp, err := m.Client.PullMessageBySeqs(ctx, req) + return resp, err } +// GetConversationMaxSeq func (m *MessageRpcClient) GetConversationMaxSeq(ctx context.Context, conversationID string) (int64, error) { resp, err := m.Client.GetConversationMaxSeq(ctx, &msg.GetConversationMaxSeqReq{ConversationID: conversationID}) if err != nil { return 0, err } + return resp.MaxSeq, nil } +// NotificationSender type NotificationSender struct { contentTypeConf map[int32]config.NotificationConf sessionTypeConf map[int32]int32 @@ -172,31 +183,37 @@ type NotificationSender struct { getUserInfo func(ctx context.Context, userID string) (*sdkws.UserInfo, error) } +// NotificationSenderOptions type NotificationSenderOptions func(*NotificationSender) +// WithLocalSendMsg func WithLocalSendMsg(sendMsg func(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error)) NotificationSenderOptions { return func(s *NotificationSender) { s.sendMsg = sendMsg } } +// WithRpcClient func WithRpcClient(msgRpcClient *MessageRpcClient) NotificationSenderOptions { return func(s *NotificationSender) { s.sendMsg = msgRpcClient.SendMsg } } +// WithUserRpcClient func WithUserRpcClient(userRpcClient *UserRpcClient) NotificationSenderOptions { return func(s *NotificationSender) { s.getUserInfo = userRpcClient.GetUserInfo } } +// NewNotificationSender func NewNotificationSender(opts ...NotificationSenderOptions) *NotificationSender { notificationSender := &NotificationSender{contentTypeConf: newContentTypeConf(), sessionTypeConf: newSessionTypeConf()} for _, opt := range opts { opt(notificationSender) } + return notificationSender } @@ -204,19 +221,23 @@ type notificationOpt struct { WithRpcGetUsername bool } +// NotificationOptions type NotificationOptions func(*notificationOpt) +// WithRpcGetUserName func WithRpcGetUserName() NotificationOptions { return func(opt *notificationOpt) { opt.WithRpcGetUsername = true } } +// NotificationWithSesstionType func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, sendID, recvID string, contentType, sesstionType int32, m proto.Message, opts ...NotificationOptions) (err error) { n := sdkws.NotificationElem{Detail: utils.StructToJsonString(m)} content, err := json.Marshal(&n) if err != nil { log.ZError(ctx, "MsgClient Notification json.Marshal failed", err, "sendID", sendID, "recvID", recvID, "contentType", contentType, "msg", m) + return err } notificationOpt := ¬ificationOpt{} @@ -260,9 +281,11 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s } else { log.ZError(ctx, "MsgClient Notification SendMsg failed", err, "req", &req) } + return err } +// Notification func (s *NotificationSender) Notification(ctx context.Context, sendID, recvID string, contentType int32, m proto.Message, opts ...NotificationOptions) error { return s.NotificationWithSesstionType(ctx, sendID, recvID, contentType, s.sessionTypeConf[contentType], m, opts...) } diff --git a/pkg/rpcclient/notification/common.go b/pkg/rpcclient/notification/common.go index 09d8b8798..d595f836b 100644 --- a/pkg/rpcclient/notification/common.go +++ b/pkg/rpcclient/notification/common.go @@ -14,6 +14,7 @@ package notification +// CommonUser type CommonUser interface { GetNickname() string GetFaceURL() string @@ -21,6 +22,7 @@ type CommonUser interface { GetEx() string } +// CommonGroup type CommonGroup interface { GetNickname() string GetFaceURL() string diff --git a/pkg/rpcclient/notification/conevrsation.go b/pkg/rpcclient/notification/conevrsation.go index d2995df3d..963012009 100644 --- a/pkg/rpcclient/notification/conevrsation.go +++ b/pkg/rpcclient/notification/conevrsation.go @@ -22,15 +22,17 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" ) +// ConversationNotificationSender type ConversationNotificationSender struct { *rpcclient.NotificationSender } +// NewConversationNotificationSender func NewConversationNotificationSender(msgRpcClient *rpcclient.MessageRpcClient) *ConversationNotificationSender { return &ConversationNotificationSender{rpcclient.NewNotificationSender(rpcclient.WithRpcClient(msgRpcClient))} } -// SetPrivate调用. +// ConversationSetPrivateNotification func (c *ConversationNotificationSender) ConversationSetPrivateNotification( ctx context.Context, sendID, recvID string, @@ -41,18 +43,20 @@ func (c *ConversationNotificationSender) ConversationSetPrivateNotification( SendID: sendID, IsPrivate: isPrivateChat, } + return c.Notification(ctx, sendID, recvID, constant.ConversationPrivateChatNotification, tips) } -// 会话改变. +// ConversationChangeNotification func (c *ConversationNotificationSender) ConversationChangeNotification(ctx context.Context, userID string) error { tips := &sdkws.ConversationUpdateTips{ UserID: userID, } + return c.Notification(ctx, userID, userID, constant.ConversationChangeNotification, tips) } -// 会话未读数同步. +// ConversationUnreadChangeNotification func (c *ConversationNotificationSender) ConversationUnreadChangeNotification( ctx context.Context, userID, conversationID string, @@ -64,5 +68,6 @@ func (c *ConversationNotificationSender) ConversationUnreadChangeNotification( HasReadSeq: hasReadSeq, UnreadCountTime: unreadCountTime, } + return c.Notification(ctx, userID, userID, constant.ConversationUnreadNotification, tips) } diff --git a/pkg/rpcclient/notification/friend.go b/pkg/rpcclient/notification/friend.go index e7df2e6cd..496377a00 100644 --- a/pkg/rpcclient/notification/friend.go +++ b/pkg/rpcclient/notification/friend.go @@ -28,9 +28,10 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" ) +// FriendNotificationSender type FriendNotificationSender struct { *rpcclient.NotificationSender - // 找不到报错 + // if not finded, return err getUsersInfo func(ctx context.Context, userIDs []string) ([]CommonUser, error) // db controller db controller.FriendDatabase @@ -38,12 +39,14 @@ type FriendNotificationSender struct { type friendNotificationSenderOptions func(*FriendNotificationSender) +// WithFriendDB func WithFriendDB(db controller.FriendDatabase) friendNotificationSenderOptions { return func(s *FriendNotificationSender) { s.db = db } } +// WithDBFunc func WithDBFunc( fn func(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error), ) friendNotificationSenderOptions { @@ -56,12 +59,14 @@ func WithDBFunc( for _, user := range users { result = append(result, user) } + return result, nil } s.getUsersInfo = f } } +// WithRpcFunc func WithRpcFunc( fn func(ctx context.Context, userIDs []string) ([]*sdkws.UserInfo, error), ) friendNotificationSenderOptions { @@ -74,12 +79,14 @@ func WithRpcFunc( for _, user := range users { result = append(result, user) } + return result, err } s.getUsersInfo = f } } +// NewFriendNotificationSender func NewFriendNotificationSender( msgRpcClient *rpcclient.MessageRpcClient, opts ...friendNotificationSenderOptions, @@ -90,6 +97,7 @@ func NewFriendNotificationSender( for _, opt := range opts { opt(f) } + return f } @@ -105,6 +113,7 @@ func (f *FriendNotificationSender) getUsersInfoMap( for _, user := range users { result[user.GetUserID()] = user.(*sdkws.UserInfo) } + return result, nil } @@ -114,16 +123,20 @@ func (f *FriendNotificationSender) getFromToUserNickname( ) (string, string, error) { users, err := f.getUsersInfoMap(ctx, []string{fromUserID, toUserID}) if err != nil { - return "", "", nil + return "", "", err } + return users[fromUserID].Nickname, users[toUserID].Nickname, nil } +// UserInfoUpdatedNotification func (f *FriendNotificationSender) UserInfoUpdatedNotification(ctx context.Context, changedUserID string) error { tips := sdkws.UserInfoUpdatedTips{UserID: changedUserID} + return f.Notification(ctx, mcontext.GetOpUserID(ctx), changedUserID, constant.UserInfoUpdatedNotification, &tips) } +// FriendApplicationAddNotification func (f *FriendNotificationSender) FriendApplicationAddNotification( ctx context.Context, req *pbFriend.ApplyToAddFriendReq, @@ -132,9 +145,11 @@ func (f *FriendNotificationSender) FriendApplicationAddNotification( FromUserID: req.FromUserID, ToUserID: req.ToUserID, }} + return f.Notification(ctx, req.FromUserID, req.ToUserID, constant.FriendApplicationNotification, &tips) } +// FriendApplicationAgreedNotification func (c *FriendNotificationSender) FriendApplicationAgreedNotification( ctx context.Context, req *pbFriend.RespondFriendApplyReq, @@ -143,6 +158,7 @@ func (c *FriendNotificationSender) FriendApplicationAgreedNotification( FromUserID: req.FromUserID, ToUserID: req.ToUserID, }, HandleMsg: req.HandleMsg} + return c.Notification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationApprovedNotification, &tips) } @@ -154,9 +170,11 @@ func (c *FriendNotificationSender) FriendApplicationRefusedNotification( FromUserID: req.FromUserID, ToUserID: req.ToUserID, }, HandleMsg: req.HandleMsg} + return c.Notification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationRejectedNotification, &tips) } +// FriendAddedNotification func (c *FriendNotificationSender) FriendAddedNotification( ctx context.Context, operationID, opUserID, fromUserID, toUserID string, @@ -178,31 +196,39 @@ func (c *FriendNotificationSender) FriendAddedNotification( if err != nil { return err } + return c.Notification(ctx, fromUserID, toUserID, constant.FriendAddedNotification, &tips) } +// FriendDeletedNotification func (c *FriendNotificationSender) FriendDeletedNotification(ctx context.Context, req *pbFriend.DeleteFriendReq) error { tips := sdkws.FriendDeletedTips{FromToUserID: &sdkws.FromToUserID{ FromUserID: req.OwnerUserID, ToUserID: req.FriendUserID, }} + return c.Notification(ctx, req.OwnerUserID, req.FriendUserID, constant.FriendDeletedNotification, &tips) } +// FriendRemarkSetNotification func (c *FriendNotificationSender) FriendRemarkSetNotification(ctx context.Context, fromUserID, toUserID string) error { tips := sdkws.FriendInfoChangedTips{FromToUserID: &sdkws.FromToUserID{}} tips.FromToUserID.FromUserID = fromUserID tips.FromToUserID.ToUserID = toUserID + return c.Notification(ctx, fromUserID, toUserID, constant.FriendRemarkSetNotification, &tips) } +// BlackAddedNotification func (c *FriendNotificationSender) BlackAddedNotification(ctx context.Context, req *pbFriend.AddBlackReq) error { tips := sdkws.BlackAddedTips{FromToUserID: &sdkws.FromToUserID{}} tips.FromToUserID.FromUserID = req.OwnerUserID tips.FromToUserID.ToUserID = req.BlackUserID + return c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackAddedNotification, &tips) } +// BlackDeletedNotification func (c *FriendNotificationSender) BlackDeletedNotification(ctx context.Context, req *pbFriend.RemoveBlackReq) { blackDeletedTips := sdkws.BlackDeletedTips{FromToUserID: &sdkws.FromToUserID{ FromUserID: req.OwnerUserID, @@ -211,6 +237,7 @@ func (c *FriendNotificationSender) BlackDeletedNotification(ctx context.Context, c.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips) } +// FriendInfoUpdatedNotification func (c *FriendNotificationSender) FriendInfoUpdatedNotification( ctx context.Context, changedUserID string, diff --git a/pkg/rpcclient/notification/group.go b/pkg/rpcclient/notification/group.go index 22aa694c7..5b8d87226 100644 --- a/pkg/rpcclient/notification/group.go +++ b/pkg/rpcclient/notification/group.go @@ -30,6 +30,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" ) +// NewGroupNotificationSender func NewGroupNotificationSender( db controller.GroupDatabase, msgRpcClient *rpcclient.MessageRpcClient, @@ -43,6 +44,7 @@ func NewGroupNotificationSender( } } +// GroupNotificationSender type GroupNotificationSender struct { *rpcclient.NotificationSender getUsersInfo func(ctx context.Context, userIDs []string) ([]CommonUser, error) @@ -57,6 +59,7 @@ func (g *GroupNotificationSender) getUser(ctx context.Context, userID string) (* if len(users) == 0 { return nil, errs.ErrUserIDNotFound.Wrap(fmt.Sprintf("user %s not found", userID)) } + return &sdkws.PublicUserInfo{ UserID: users[0].GetUserID(), Nickname: users[0].GetNickname(), @@ -78,6 +81,7 @@ func (g *GroupNotificationSender) getGroupInfo(ctx context.Context, groupID stri if err != nil { return nil, err } + return &sdkws.GroupInfo{ GroupID: gm.GroupID, GroupName: gm.GroupName, @@ -122,7 +126,7 @@ func (g *GroupNotificationSender) getGroupMembers(ctx context.Context, groupID s res = append(res, g.groupMemberDB2PB(member, user.AppMangerLevel)) delete(users, member.UserID) } - //for userID, info := range users { + // for userID, info := range users { // if info.AppMangerLevel == constant.AppAdmin { // res = append(res, &sdkws.GroupMemberFullInfo{ // GroupID: groupID, @@ -132,7 +136,7 @@ func (g *GroupNotificationSender) getGroupMembers(ctx context.Context, groupID s // AppMangerLevel: info.AppMangerLevel, // }) // } - //} + // } return res, nil } @@ -145,6 +149,7 @@ func (g *GroupNotificationSender) getGroupMemberMap(ctx context.Context, groupID for i, member := range members { m[member.UserID] = members[i] } + return m, nil } @@ -156,6 +161,7 @@ func (g *GroupNotificationSender) getGroupMember(ctx context.Context, groupID st if len(members) == 0 { return nil, errs.ErrInternalServer.Wrap(fmt.Sprintf("group %s member %s not found", groupID, userID)) } + return members[0], nil } @@ -165,6 +171,7 @@ func (g *GroupNotificationSender) getGroupOwnerAndAdminUserID(ctx context.Contex return nil, err } fn := func(e *relation.GroupMemberModel) string { return e.UserID } + return utils.Slice(members, fn), nil } @@ -216,6 +223,7 @@ func (g *GroupNotificationSender) getUsersInfoMap(ctx context.Context, userIDs [ for _, user := range users { result[user.GetUserID()] = user.(*sdkws.UserInfo) } + return result, nil } @@ -255,37 +263,47 @@ func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws (*opUser).FaceURL = user.FaceURL } } + return nil } +// GroupCreatedNotification func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context, tips *sdkws.GroupCreatedTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupCreatedNotification, tips) } +// GroupInfoSetNotification func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context, tips *sdkws.GroupInfoSetTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNotification, tips, rpcclient.WithRpcGetUserName()) } +// GroupInfoSetNameNotification func (g *GroupNotificationSender) GroupInfoSetNameNotification(ctx context.Context, tips *sdkws.GroupInfoSetNameTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNameNotification, tips) } +// GroupInfoSetAnnouncementNotification func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification(ctx context.Context, tips *sdkws.GroupInfoSetAnnouncementTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetAnnouncementNotification, tips, rpcclient.WithRpcGetUserName()) } +// JoinGroupApplicationNotification func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { @@ -307,9 +325,11 @@ func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.C log.ZError(ctx, "JoinGroupApplicationNotification failed", err, "group", req.GroupID, "userID", userID) } } + return nil } +// MemberQuitNotification func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, member *sdkws.GroupMemberFullInfo) (err error) { defer log.ZDebug(ctx, "return") defer func() { @@ -322,9 +342,11 @@ func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, me return err } tips := &sdkws.MemberQuitTips{Group: group, QuitUser: member} + return g.Notification(ctx, mcontext.GetOpUserID(ctx), member.GroupID, constant.MemberQuitNotification, tips) } +// GroupApplicationAcceptedNotification func (g *GroupNotificationSender) GroupApplicationAcceptedNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) { defer log.ZDebug(ctx, "return") defer func() { @@ -350,9 +372,11 @@ func (g *GroupNotificationSender) GroupApplicationAcceptedNotification(ctx conte log.ZError(ctx, "failed", err) } } + return nil } +// GroupApplicationRejectedNotification func (g *GroupNotificationSender) GroupApplicationRejectedNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { @@ -372,9 +396,11 @@ func (g *GroupNotificationSender) GroupApplicationRejectedNotification(ctx conte log.ZError(ctx, "failed", err) } } + return nil } +// GroupOwnerTransferredNotification func (g *GroupNotificationSender) GroupOwnerTransferredNotification(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { @@ -389,16 +415,20 @@ func (g *GroupNotificationSender) GroupOwnerTransferredNotification(ctx context. if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupOwnerTransferredNotification, tips) } +// MemberKickedNotification func (g *GroupNotificationSender) MemberKickedNotification(ctx context.Context, tips *sdkws.MemberKickedTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.MemberKickedNotification, tips) } +// MemberInvitedNotification func (g *GroupNotificationSender) MemberInvitedNotification(ctx context.Context, groupID, reason string, invitedUserIDList []string) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { @@ -415,9 +445,11 @@ func (g *GroupNotificationSender) MemberInvitedNotification(ctx context.Context, if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberInvitedNotification, tips) } +// MemberEnterNotification func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { @@ -435,9 +467,11 @@ func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupDismissedNotification, tips) } +// GroupMemberMutedNotification func (g *GroupNotificationSender) GroupMemberMutedNotification(ctx context.Context, groupID, groupMemberUserID string, mutedSeconds uint32) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { @@ -454,6 +488,7 @@ func (g *GroupNotificationSender) GroupMemberMutedNotification(ctx context.Conte if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberMutedNotification, tips) } @@ -470,6 +505,7 @@ func (g *GroupNotificationSender) GroupMemberCancelMutedNotification(ctx context if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberCancelMutedNotification, tips) } @@ -489,6 +525,7 @@ func (g *GroupNotificationSender) GroupMutedNotification(ctx context.Context, gr if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMutedNotification, tips) } @@ -508,9 +545,11 @@ func (g *GroupNotificationSender) GroupCancelMutedNotification(ctx context.Conte if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupCancelMutedNotification, tips) } +// GroupMemberInfoSetNotification func (g *GroupNotificationSender) GroupMemberInfoSetNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { @@ -524,6 +563,7 @@ func (g *GroupNotificationSender) GroupMemberInfoSetNotification(ctx context.Con if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberInfoSetNotification, tips) } @@ -540,6 +580,7 @@ func (g *GroupNotificationSender) GroupMemberSetToAdminNotification(ctx context. if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToAdminNotification, tips) } @@ -556,9 +597,11 @@ func (g *GroupNotificationSender) GroupMemberSetToOrdinaryUserNotification(ctx c if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToOrdinaryUserNotification, tips) } +// MemberEnterDirectlyNotification func (g *GroupNotificationSender) MemberEnterDirectlyNotification(ctx context.Context, groupID string, entrantUserID string) (err error) { defer log.ZDebug(ctx, "return") defer func() { @@ -575,9 +618,11 @@ func (g *GroupNotificationSender) MemberEnterDirectlyNotification(ctx context.Co return err } tips := &sdkws.MemberEnterTips{Group: group, EntrantUser: user} + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberEnterNotification, tips) } +// SuperGroupNotification func (g *GroupNotificationSender) SuperGroupNotification(ctx context.Context, sendID, recvID string) (err error) { defer log.ZDebug(ctx, "return") defer func() { @@ -586,5 +631,6 @@ func (g *GroupNotificationSender) SuperGroupNotification(ctx context.Context, se } }() err = g.Notification(ctx, sendID, recvID, constant.SuperGroupUpdateNotification, nil) + return err } diff --git a/pkg/rpcclient/notification/msg.go b/pkg/rpcclient/notification/msg.go index bcc6865b1..ad708ce8b 100644 --- a/pkg/rpcclient/notification/msg.go +++ b/pkg/rpcclient/notification/msg.go @@ -22,23 +22,28 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" ) +// MsgNotificationSender type MsgNotificationSender struct { *rpcclient.NotificationSender } +// NewMsgNotificationSender func NewMsgNotificationSender(opts ...rpcclient.NotificationSenderOptions) *MsgNotificationSender { return &MsgNotificationSender{rpcclient.NewNotificationSender(opts...)} } +// UserDeleteMsgsNotification func (m *MsgNotificationSender) UserDeleteMsgsNotification(ctx context.Context, userID, conversationID string, seqs []int64) error { tips := sdkws.DeleteMsgsTips{ UserID: userID, ConversationID: conversationID, Seqs: seqs, } + return m.Notification(ctx, userID, userID, constant.DeleteMsgsNotification, &tips) } +// MarkAsReadNotification func (m *MsgNotificationSender) MarkAsReadNotification(ctx context.Context, conversationID string, sesstionType int32, sendID, recvID string, seqs []int64, hasReadSeq int64) error { tips := &sdkws.MarkAsReadTips{ MarkAsReadUserID: sendID, @@ -46,5 +51,6 @@ func (m *MsgNotificationSender) MarkAsReadNotification(ctx context.Context, conv Seqs: seqs, HasReadSeq: hasReadSeq, } + return m.NotificationWithSesstionType(ctx, sendID, recvID, constant.HasReadReceipt, sesstionType, tips) } diff --git a/pkg/rpcclient/push.go b/pkg/rpcclient/push.go index 8e19782bd..62752901e 100644 --- a/pkg/rpcclient/push.go +++ b/pkg/rpcclient/push.go @@ -24,17 +24,20 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/push" ) +// Push type Push struct { conn grpc.ClientConnInterface Client push.PushMsgServiceClient discov discoveryregistry.SvcDiscoveryRegistry } +// NewPush func NewPush(discov discoveryregistry.SvcDiscoveryRegistry) *Push { conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImPushName) if err != nil { panic(err) } + return &Push{ discov: discov, conn: conn, @@ -42,12 +45,15 @@ func NewPush(discov discoveryregistry.SvcDiscoveryRegistry) *Push { } } +// PushRpcClient type PushRpcClient Push +// NewPushRpcClient func NewPushRpcClient(discov discoveryregistry.SvcDiscoveryRegistry) PushRpcClient { return PushRpcClient(*NewPush(discov)) } +// DelUserPushToken func (p *PushRpcClient) DelUserPushToken( ctx context.Context, req *push.DelUserPushTokenReq, diff --git a/pkg/rpcclient/third.go b/pkg/rpcclient/third.go index e1181b8f4..629234e7f 100644 --- a/pkg/rpcclient/third.go +++ b/pkg/rpcclient/third.go @@ -28,6 +28,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third" ) +// Third type Third struct { conn grpc.ClientConnInterface Client third.ThirdClient @@ -35,20 +36,22 @@ type Third struct { MinioClient *minio.Client } +// NewThird func NewThird(discov discoveryregistry.SvcDiscoveryRegistry) *Third { + var minioClient *minio.Client conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImThirdName) if err != nil { panic(err) } client := third.NewThirdClient(conn) - minioClient, err := minioInit() + minioClient, err = minioInit() + return &Third{discov: discov, Client: client, conn: conn, MinioClient: minioClient} } func minioInit() (*minio.Client, error) { - minioClient := &minio.Client{} - var initUrl string - initUrl = config.Config.Object.Minio.Endpoint + var minioClient *minio.Client + initUrl := config.Config.Object.Minio.Endpoint minioUrl, err := url.Parse(initUrl) if err != nil { return nil, err @@ -66,5 +69,6 @@ func minioInit() (*minio.Client, error) { if err != nil { return nil, err } + return minioClient, nil } diff --git a/pkg/rpcclient/user.go b/pkg/rpcclient/user.go index 023c26d3c..0e92a3e96 100644 --- a/pkg/rpcclient/user.go +++ b/pkg/rpcclient/user.go @@ -29,32 +29,39 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" ) +// User type User struct { conn grpc.ClientConnInterface Client user.UserClient Discov discoveryregistry.SvcDiscoveryRegistry } +// NewUser func NewUser(discov discoveryregistry.SvcDiscoveryRegistry) *User { conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImUserName) if err != nil { panic(err) } client := user.NewUserClient(conn) + return &User{Discov: discov, Client: client, conn: conn} } type UserRpcClient User +// NewUserRpcClientByUser func NewUserRpcClientByUser(user *User) *UserRpcClient { rpc := UserRpcClient(*user) + return &rpc } +// NewUserRpcClient func NewUserRpcClient(client discoveryregistry.SvcDiscoveryRegistry) UserRpcClient { return UserRpcClient(*NewUser(client)) } +// GetUsersInfo func (u *UserRpcClient) GetUsersInfo(ctx context.Context, userIDs []string) ([]*sdkws.UserInfo, error) { resp, err := u.Client.GetDesignateUsers(ctx, &user.GetDesignateUsersReq{ UserIDs: userIDs, @@ -67,27 +74,33 @@ func (u *UserRpcClient) GetUsersInfo(ctx context.Context, userIDs []string) ([]* })); len(ids) > 0 { return nil, errs.ErrUserIDNotFound.Wrap(strings.Join(ids, ",")) } + return resp.UsersInfo, nil } +// GetUserInfo func (u *UserRpcClient) GetUserInfo(ctx context.Context, userID string) (*sdkws.UserInfo, error) { users, err := u.GetUsersInfo(ctx, []string{userID}) if err != nil { return nil, err } + return users[0], nil } +// GetUsersInfoMap func (u *UserRpcClient) GetUsersInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error) { users, err := u.GetUsersInfo(ctx, userIDs) if err != nil { return nil, err } + return utils.SliceToMap(users, func(e *sdkws.UserInfo) string { return e.UserID }), nil } +// GetPublicUserInfos func (u *UserRpcClient) GetPublicUserInfos( ctx context.Context, userIDs []string, @@ -97,6 +110,7 @@ func (u *UserRpcClient) GetPublicUserInfos( if err != nil { return nil, err } + return utils.Slice(users, func(e *sdkws.UserInfo) *sdkws.PublicUserInfo { return &sdkws.PublicUserInfo{ UserID: e.UserID, @@ -107,14 +121,17 @@ func (u *UserRpcClient) GetPublicUserInfos( }), nil } +// GetPublicUserInfo func (u *UserRpcClient) GetPublicUserInfo(ctx context.Context, userID string) (*sdkws.PublicUserInfo, error) { users, err := u.GetPublicUserInfos(ctx, []string{userID}, true) if err != nil { return nil, err } + return users[0], nil } +// GetPublicUserInfoMap func (u *UserRpcClient) GetPublicUserInfoMap( ctx context.Context, userIDs []string, @@ -124,11 +141,13 @@ func (u *UserRpcClient) GetPublicUserInfoMap( if err != nil { return nil, err } + return utils.SliceToMap(users, func(e *sdkws.PublicUserInfo) string { return e.UserID }), nil } +// GetUserGlobalMsgRecvOpt func (u *UserRpcClient) GetUserGlobalMsgRecvOpt(ctx context.Context, userID string) (int32, error) { resp, err := u.Client.GetGlobalRecvMessageOpt(ctx, &user.GetGlobalRecvMessageOptReq{ UserID: userID, @@ -136,21 +155,26 @@ func (u *UserRpcClient) GetUserGlobalMsgRecvOpt(ctx context.Context, userID stri if err != nil { return 0, err } + return resp.GlobalRecvMsgOpt, err } +// Access func (u *UserRpcClient) Access(ctx context.Context, ownerUserID string) error { _, err := u.GetUserInfo(ctx, ownerUserID) if err != nil { return err } + return tokenverify.CheckAccessV3(ctx, ownerUserID) } +// GetAllUserIDs func (u *UserRpcClient) GetAllUserIDs(ctx context.Context, pageNumber, showNumber int32) ([]string, error) { resp, err := u.Client.GetAllUserID(ctx, &user.GetAllUserIDReq{Pagination: &sdkws.RequestPagination{PageNumber: pageNumber, ShowNumber: showNumber}}) if err != nil { return nil, err } + return resp.UserIDs, nil } diff --git a/pkg/startrpc/start.go b/pkg/startrpc/start.go index 3eeaaa3a2..ef207cf56 100644 --- a/pkg/startrpc/start.go +++ b/pkg/startrpc/start.go @@ -34,6 +34,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" ) +// Start func Start( rpcPort int, rpcRegisterName string, @@ -108,5 +109,6 @@ func Start( } } }() + return utils.Wrap1(srv.Serve(listener)) } diff --git a/pkg/statistics/statistics.go b/pkg/statistics/statistics.go index 2a6ae01ae..223e2c322 100644 --- a/pkg/statistics/statistics.go +++ b/pkg/statistics/statistics.go @@ -21,6 +21,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" ) +// Statistics num type Statistics struct { AllCount *uint64 ModuleName string @@ -63,8 +64,10 @@ func (s *Statistics) output() { } } +// NewStatistics func NewStatistics(allCount *uint64, moduleName, printArgs string, sleepTime int) *Statistics { p := &Statistics{AllCount: allCount, ModuleName: moduleName, SleepTime: uint64(sleepTime), PrintArgs: printArgs} go p.output() + return p }