Skip to content

Commit

Permalink
update (#123)
Browse files Browse the repository at this point in the history
* feat: update max Seq format method.

* update Format method in pb.

* update to correct constant.

* update format method in pb.

* feat: update conversation fields.

* update pb files.

* update ConversationsDestructMsgs method.

* update conversation and msg destruct pb.

* feat: update GroupInfoForSetEX struct.

* update group pb.

* feat: implement request max count limit.

* feat: add PushMsgReq

* remove unused pkg.

* fix
  • Loading branch information
mo3et authored Sep 7, 2024
1 parent f25e90c commit 49aa78e
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions group/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package group
import (
"errors"
"fmt"

"github.com/openimsdk/protocol/constant"
)

func (x *CreateGroupReq) Check() error {
Expand All @@ -30,7 +32,10 @@ func (x *CreateGroupReq) Check() error {
return errors.New("GroupType is invalid")
}
if x.OwnerUserID == "" {
return errors.New("ownerUserID")
return errors.New("ownerUserID is empty")
}
if len(x.MemberUserIDs) > constant.ParamMaxLength {
return errors.New("too many MemberUserIDs, need to be less than 1000")
}
return nil
}
Expand Down Expand Up @@ -160,6 +165,10 @@ func (x *KickGroupMemberReq) Check() error {
if x.KickedUserIDs == nil {
return errors.New("kickUserIDs is empty")
}

if len(x.KickedUserIDs) > constant.ParamMaxLength {
return errors.New("too many KickedUserIDs, need to be less than 1000")
}
return nil
}

Expand All @@ -184,6 +193,11 @@ func (x *InviteUserToGroupReq) Check() error {
if x.InvitedUserIDs == nil {
return errors.New("invitedUserIDs is empty")
}

if len(x.InvitedUserIDs) > constant.ParamMaxLength {
return errors.New("too many InvitedUserIDs, need to be less than 1000")
}

return nil
}

Expand Down Expand Up @@ -286,7 +300,11 @@ func (x *SetGroupMemberInfo) Check() error {

func (x *SetGroupMemberInfoReq) Check() error {
if x.Members == nil {
return errors.New("Members is empty")
return errors.New("members is empty")
}

if len(x.Members) > constant.ParamMaxLength {
return errors.New("too many Members, need to be less than 1000")
}
return nil
}
Expand All @@ -295,6 +313,10 @@ func (x *GetGroupAbstractInfoReq) Check() error {
if x.GroupIDs == nil {
return errors.New("GroupID is empty")
}

if len(x.GroupIDs) > constant.ParamMaxLength {
return errors.New("too many GroupIDs, need to be less than 1000")
}
return nil
}

Expand All @@ -305,6 +327,10 @@ func (x *GetUserInGroupMembersReq) Check() error {
if x.UserID == "" {
return errors.New("userID is empty")
}

if len(x.GroupIDs) > constant.ParamMaxLength {
return errors.New("too many GroupIDs, need to be less than 1000")
}
return nil
}

Expand Down Expand Up @@ -348,6 +374,10 @@ func (x *GetGroupUsersReqApplicationListReq) Check() error {
if x.UserIDs == nil {
return errors.New("UserID is empty")
}

if len(x.UserIDs) > constant.ParamMaxLength {
return errors.New("too many UserIDs, need to be less than 1000")
}
return nil
}
func (x *GroupCreateCountReq) Check() error {
Expand Down

0 comments on commit 49aa78e

Please sign in to comment.