sdk 添加获取会话阅读时间和消息送达时间接口

This commit is contained in:
heavyrian2012
2022-07-20 22:25:46 +08:00
parent 2b09a7bf84
commit dece1d7a1c
8 changed files with 130 additions and 0 deletions
@@ -750,6 +750,20 @@ public class Main {
} else {
System.out.println("failure");
}
IMResult<OutputTimestamp> timestampResult = MessageAdmin.getConversationReadTimestamp("57gqmws2k", new Conversation(0, "admin", 0));
if(timestampResult != null && timestampResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("Get conversation read time success");
} else {
System.out.println("Get conversation read time failure");
}
timestampResult = MessageAdmin.getMessageDelivery("57gqmws2k");
if(timestampResult != null && timestampResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
System.out.println("Get message delivery success");
} else {
System.out.println("Get message delivery failure");
}
}
List<String> multicastReceivers = Arrays.asList("user2", "user3", "user4");
@@ -103,4 +103,16 @@ public class MessageAdmin {
messageData.setPayload(payload);
return AdminHttpUtils.httpJsonPost(path, messageData, MultiMessageResult.class);
}
public static IMResult<OutputTimestamp> getConversationReadTimestamp(String userId, Conversation conversation) throws Exception {
String path = APIPath.Msg_ConvRead;
InputGetConvReadTime input = new InputGetConvReadTime(userId, conversation.getType(), conversation.getTarget(), conversation.getLine());
return AdminHttpUtils.httpJsonPost(path, input, OutputTimestamp.class);
}
public static IMResult<OutputTimestamp> getMessageDelivery(String userId) throws Exception {
String path = APIPath.Msg_Delivery;
InputUserId input = new InputUserId(userId);
return AdminHttpUtils.httpJsonPost(path, input, OutputTimestamp.class);
}
}