添加server api和机器人api获取机器人信息的接口
This commit is contained in:
@@ -95,6 +95,14 @@ public class Main {
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<OutputRobot> outputRobotIMResult = UserAdmin.getRobotInfo("robot1");
|
||||
if(outputRobotIMResult != null && outputRobotIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("Get robot success");
|
||||
} else {
|
||||
System.out.println("Get robot failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<Void> destroyResult = UserAdmin.destroyRobot("robot1");
|
||||
if(destroyResult != null && destroyResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("success");
|
||||
@@ -1003,8 +1011,8 @@ public class Main {
|
||||
//**** 机器人API
|
||||
//***********************************************
|
||||
|
||||
IMResult<InputOutputUserInfo> userInfoIMResult = robotService.getProfile(robotId);
|
||||
if(userInfoIMResult != null && userInfoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
IMResult<OutputRobot> robotProfileIMResult = robotService.getProfile();
|
||||
if(robotProfileIMResult != null && robotProfileIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("get profile success");
|
||||
} else {
|
||||
System.out.println("get profile failure");
|
||||
@@ -1019,8 +1027,8 @@ public class Main {
|
||||
System.out.println("modify profile failure");
|
||||
System.exit(-1);
|
||||
}
|
||||
userInfoIMResult = robotService.getProfile(robotId);
|
||||
if(userInfoIMResult != null && userInfoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && displayName.equals(userInfoIMResult.getResult().getDisplayName())) {
|
||||
robotProfileIMResult = robotService.getProfile();
|
||||
if(robotProfileIMResult != null && robotProfileIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && displayName.equals(robotProfileIMResult.getResult().getDisplayName())) {
|
||||
System.out.println("get profile success");
|
||||
} else {
|
||||
System.out.println("get profile failure");
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.wildfirechat.sdk;
|
||||
import cn.wildfirechat.common.APIPath;
|
||||
import cn.wildfirechat.pojos.*;
|
||||
import cn.wildfirechat.sdk.model.IMResult;
|
||||
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
||||
import cn.wildfirechat.sdk.utilities.RobotHttpUtils;
|
||||
|
||||
import java.util.List;
|
||||
@@ -58,8 +59,9 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, null, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<InputOutputUserInfo> getProfile(String robotId) throws Exception {
|
||||
return getUserInfo(robotId);
|
||||
public IMResult<OutputRobot> getProfile() throws Exception {
|
||||
String path = APIPath.Robot_Get_Profile;
|
||||
return robotHttpUtils.httpJsonPost(path, null, OutputRobot.class);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -52,6 +52,13 @@ public class UserAdmin {
|
||||
return AdminHttpUtils.httpJsonPost(path, inputDestroyUser, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<OutputRobot> getRobotInfo(String robotId) throws Exception {
|
||||
String path = APIPath.User_Get_Robot_Info;
|
||||
InputRobotId getRobotInfo = new InputRobotId();
|
||||
getRobotInfo.setRobotId(robotId);
|
||||
return AdminHttpUtils.httpJsonPost(path, getRobotInfo, OutputRobot.class);
|
||||
}
|
||||
|
||||
public static IMResult<OutputGetIMTokenData> getUserToken(String userId, String clientId, int platform) throws Exception {
|
||||
String path = APIPath.User_Get_Token;
|
||||
InputGetToken getToken = new InputGetToken(userId, clientId, platform);
|
||||
|
||||
Reference in New Issue
Block a user