add get user group list and destroy user function
This commit is contained in:
@@ -113,4 +113,12 @@ public class GroupAdmin {
|
||||
return AdminHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<OutputGroupIds> getUserGroups(String user) throws Exception {
|
||||
String path = APIPath.Get_User_Groups;
|
||||
InputUserId inputUserId = new InputUserId();
|
||||
inputUserId.setUserId(user);
|
||||
return AdminHttpUtils.httpJsonPost(path, inputUserId, OutputGroupIds.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -284,6 +284,18 @@ public class Main {
|
||||
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())) {
|
||||
System.out.println("get user groups success");
|
||||
} else {
|
||||
System.out.println("get user groups failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
} else {
|
||||
System.out.println("get user groups failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
|
||||
//***********************************************
|
||||
@@ -392,5 +404,14 @@ public class Main {
|
||||
System.out.println("robot get user info by userId failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
|
||||
voidIMResult = UserAdmin.destroyUser("user1");
|
||||
if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("destroy user success");
|
||||
} else {
|
||||
System.out.println("destroy user failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,13 @@ public class UserAdmin {
|
||||
return AdminHttpUtils.httpJsonPost(path, null, OutputUserBlockStatusList.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> destroyUser(String userId) throws Exception {
|
||||
String path = APIPath.Destroy_User;
|
||||
InputDestroyUser inputDestroyUser = new InputDestroyUser();
|
||||
inputDestroyUser.setUserId(userId);
|
||||
return AdminHttpUtils.httpJsonPost(path, inputDestroyUser, Void.class);
|
||||
}
|
||||
|
||||
//not implement
|
||||
// public static IMResult<OutputUserBlockStatusList> getUserOnlineStatus(String userId) throws Exception {
|
||||
// String path = APIPath.User_Get_Online_Status;
|
||||
|
||||
Reference in New Issue
Block a user