添加设置用户关系中的附加信息

This commit is contained in:
heavyrain2012
2021-09-01 14:39:59 +08:00
parent 5ce8165514
commit f62e3f3cef
7 changed files with 141 additions and 0 deletions
@@ -381,6 +381,15 @@ public class Main {
System.exit(-1);
}
String friendExtra = "hello friend extra";
IMResult<Void> setExtraResult = RelationAdmin.updateFriendExtra("ff1", "ff2", friendExtra);
if (setExtraResult != null && setExtraResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("set friend extra success");
} else {
System.out.println("set friend extra failure");
System.exit(-1);
}
IMResult<RelationPojo> getRelation = RelationAdmin.getRelation("ff1", "ff2");
if (getRelation != null && getRelation.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("get friend relation success");
@@ -388,6 +397,11 @@ public class Main {
System.out.println("get friend relation failure");
System.exit(-1);
}
if(!friendExtra.equals(getRelation.getResult().extra)) {
System.out.println("set friend extra failure");
System.exit(-1);
}
}
//***********************************************
//**** 群组相关功能
@@ -56,6 +56,14 @@ public class RelationAdmin {
return AdminHttpUtils.httpJsonPost(path, input, OutputGetAlias.class);
}
public static IMResult<Void> updateFriendExtra(String operator, String targetId, String extra) throws Exception {
String path = APIPath.Friend_Set_Extra;
InputUpdateExtra input = new InputUpdateExtra();
input.setOperator(operator);
input.setTargetId(targetId);
input.setExtra(extra);
return AdminHttpUtils.httpJsonPost(path, input, Void.class);
}
public static IMResult<Void> sendFriendRequest(String userId, String targetId, String reason, boolean force) throws Exception {
String path = APIPath.Friend_Send_Request;
InputAddFriendRequest input = new InputAddFriendRequest();