Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apilimit #119

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions constant/limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ const (
MaxNotificationNum = 500
MaxUsersStatusList = 500
)

const (
ParamMaxLength = 1000
)
15 changes: 8 additions & 7 deletions group/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package group
import (
"errors"
"fmt"
"github.com/openimsdk/protocol/constant"
)

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

if len(x.KickedUserIDs) > 1000 {
if len(x.KickedUserIDs) > constant.ParamMaxLength {
return errors.New("too many KickedUserIDs, need to be less than 1000")
}
return nil
Expand Down Expand Up @@ -192,7 +193,7 @@ func (x *InviteUserToGroupReq) Check() error {
return errors.New("invitedUserIDs is empty")
}

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

Expand Down Expand Up @@ -301,7 +302,7 @@ func (x *SetGroupMemberInfoReq) Check() error {
return errors.New("members is empty")
}

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

if len(x.GroupIDs) > 1000 {
if len(x.GroupIDs) > constant.ParamMaxLength {
return errors.New("too many GroupIDs, need to be less than 1000")
}
return nil
Expand All @@ -326,7 +327,7 @@ func (x *GetUserInGroupMembersReq) Check() error {
return errors.New("userID is empty")
}

if len(x.GroupIDs) > 1000 {
if len(x.GroupIDs) > constant.ParamMaxLength {
return errors.New("too many GroupIDs, need to be less than 1000")
}
return nil
Expand Down Expand Up @@ -373,7 +374,7 @@ func (x *GetGroupUsersReqApplicationListReq) Check() error {
return errors.New("UserID is empty")
}

if len(x.UserIDs) > 1000 {
if len(x.UserIDs) > constant.ParamMaxLength {
return errors.New("too many UserIDs, need to be less than 1000")
}
return nil
Expand Down
7 changes: 4 additions & 3 deletions relation/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package relation
import (
"errors"
"fmt"
"github.com/openimsdk/protocol/constant"
)

func (x *GetPaginationFriendsReq) Check() error {
Expand Down Expand Up @@ -50,7 +51,7 @@ func (x *ImportFriendReq) Check() error {
return errors.New("friendUserIDS is empty")
}

if len(x.FriendUserIDs) > 1000 {
if len(x.FriendUserIDs) > constant.ParamMaxLength {
return errors.New("too many FriendUserIDs, need to be less than 1000")
}
return nil
Expand Down Expand Up @@ -202,7 +203,7 @@ func (x *UpdateFriendsReq) Check() error {
return errors.New("friendUserIDs is empty")
}

if len(x.FriendUserIDs) > 1000 {
if len(x.FriendUserIDs) > constant.ParamMaxLength {
return errors.New("too many FriendUserIDs, need to be less than 1000")
}
return nil
Expand All @@ -215,7 +216,7 @@ func (x *GetSpecifiedFriendsInfoReq) Check() error {
return errors.New("userIDList is empty")
}

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