添加退出群组api接口
This commit is contained in:
@@ -113,6 +113,16 @@ public class GroupAdmin {
|
||||
return AdminHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> quitGroup(String operator, String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Group_Member_Quit;
|
||||
InputQuitGroup quitGroup = new InputQuitGroup();
|
||||
quitGroup.setGroup_id(groupId);
|
||||
quitGroup.setOperator(operator);
|
||||
quitGroup.setTo_lines(to_lines);
|
||||
quitGroup.setNotify_message(notify_message);
|
||||
return AdminHttpUtils.httpJsonPost(path, quitGroup, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<OutputGroupIds> getUserGroups(String user) throws Exception {
|
||||
String path = APIPath.Get_User_Groups;
|
||||
InputUserId inputUserId = new InputUserId();
|
||||
|
||||
@@ -40,6 +40,7 @@ public class Main {
|
||||
createRobot.setUserId("robot1");
|
||||
createRobot.setName("robot1");
|
||||
createRobot.setDisplayName("机器人");
|
||||
createRobot.setOwner("userId1");
|
||||
createRobot.setSecret("123456");
|
||||
createRobot.setCallback("http://127.0.0.1:8883/robot/recvmsg");
|
||||
IMResult<OutputCreateRobot> resultCreateRobot = UserAdmin.createRobot(createRobot);
|
||||
@@ -284,6 +285,15 @@ public class Main {
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
|
||||
voidIMResult = GroupAdmin.quitGroup("user4", groupInfo.getTarget_id(), null, null);
|
||||
if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("quit group success");
|
||||
} else {
|
||||
System.out.println("quit group failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<OutputGroupIds> groupIdsIMResult = GroupAdmin.getUserGroups("user1");
|
||||
if (groupIdsIMResult != null && groupIdsIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
if (groupIdsIMResult.getResult().getGroupIds().contains(groupInfo.getTarget_id())) {
|
||||
|
||||
Reference in New Issue
Block a user