Skip to content

Commit 49aa78e

Browse files
authored
update (#123)
* 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
1 parent f25e90c commit 49aa78e

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

group/group.go

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ package group
1717
import (
1818
"errors"
1919
"fmt"
20+
21+
"github.com/openimsdk/protocol/constant"
2022
)
2123

2224
func (x *CreateGroupReq) Check() error {
@@ -30,7 +32,10 @@ func (x *CreateGroupReq) Check() error {
3032
return errors.New("GroupType is invalid")
3133
}
3234
if x.OwnerUserID == "" {
33-
return errors.New("ownerUserID")
35+
return errors.New("ownerUserID is empty")
36+
}
37+
if len(x.MemberUserIDs) > constant.ParamMaxLength {
38+
return errors.New("too many MemberUserIDs, need to be less than 1000")
3439
}
3540
return nil
3641
}
@@ -160,6 +165,10 @@ func (x *KickGroupMemberReq) Check() error {
160165
if x.KickedUserIDs == nil {
161166
return errors.New("kickUserIDs is empty")
162167
}
168+
169+
if len(x.KickedUserIDs) > constant.ParamMaxLength {
170+
return errors.New("too many KickedUserIDs, need to be less than 1000")
171+
}
163172
return nil
164173
}
165174

@@ -184,6 +193,11 @@ func (x *InviteUserToGroupReq) Check() error {
184193
if x.InvitedUserIDs == nil {
185194
return errors.New("invitedUserIDs is empty")
186195
}
196+
197+
if len(x.InvitedUserIDs) > constant.ParamMaxLength {
198+
return errors.New("too many InvitedUserIDs, need to be less than 1000")
199+
}
200+
187201
return nil
188202
}
189203

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

287301
func (x *SetGroupMemberInfoReq) Check() error {
288302
if x.Members == nil {
289-
return errors.New("Members is empty")
303+
return errors.New("members is empty")
304+
}
305+
306+
if len(x.Members) > constant.ParamMaxLength {
307+
return errors.New("too many Members, need to be less than 1000")
290308
}
291309
return nil
292310
}
@@ -295,6 +313,10 @@ func (x *GetGroupAbstractInfoReq) Check() error {
295313
if x.GroupIDs == nil {
296314
return errors.New("GroupID is empty")
297315
}
316+
317+
if len(x.GroupIDs) > constant.ParamMaxLength {
318+
return errors.New("too many GroupIDs, need to be less than 1000")
319+
}
298320
return nil
299321
}
300322

@@ -305,6 +327,10 @@ func (x *GetUserInGroupMembersReq) Check() error {
305327
if x.UserID == "" {
306328
return errors.New("userID is empty")
307329
}
330+
331+
if len(x.GroupIDs) > constant.ParamMaxLength {
332+
return errors.New("too many GroupIDs, need to be less than 1000")
333+
}
308334
return nil
309335
}
310336

@@ -348,6 +374,10 @@ func (x *GetGroupUsersReqApplicationListReq) Check() error {
348374
if x.UserIDs == nil {
349375
return errors.New("UserID is empty")
350376
}
377+
378+
if len(x.UserIDs) > constant.ParamMaxLength {
379+
return errors.New("too many UserIDs, need to be less than 1000")
380+
}
351381
return nil
352382
}
353383
func (x *GroupCreateCountReq) Check() error {

0 commit comments

Comments
 (0)