添加批量获取用户信息的接口

This commit is contained in:
heavyrian2012
2024-11-14 12:50:38 +08:00
parent 1b8cf3e5f9
commit 0549bc502f
4 changed files with 100 additions and 0 deletions
@@ -193,6 +193,14 @@ public class Main {
System.exit(-1);
}
IMResult<OutputUserInfoList> batchGetUsers = UserAdmin.getBatchUsers(Arrays.asList("userId1", "admin", "FireRobot", "TestUser"));
if (batchGetUsers.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("get batch user success");
} else {
System.out.println("get batch user failure");
System.exit(-1);
}
InputOutputUserInfo updateUserInfo = new InputOutputUserInfo();
updateUserInfo.setUserId(System.currentTimeMillis()+"");
updateUserInfo.setDisplayName("updatedUserName");
@@ -5,6 +5,8 @@ import cn.wildfirechat.pojos.*;
import cn.wildfirechat.sdk.model.IMResult;
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
import java.util.List;
public class UserAdmin {
public static IMResult<InputOutputUserInfo> getUserByName(String name) throws Exception {
String path = APIPath.User_Get_Info;
@@ -37,6 +39,13 @@ public class UserAdmin {
return AdminHttpUtils.httpJsonPost(path, input, OutputGetUserList.class);
}
public static IMResult<OutputUserInfoList> getBatchUsers(List<String> userIds) throws Exception {
String path = APIPath.User_Batch_Get_Infos;
InputStringList input = new InputStringList();
input.setList(userIds);
return AdminHttpUtils.httpJsonPost(path, input, OutputUserInfoList.class);
}
public static IMResult<OutputCreateUser> createUser(InputOutputUserInfo user) throws Exception {
String path = APIPath.Create_User;
return AdminHttpUtils.httpJsonPost(path, user, OutputCreateUser.class);