同步专业版sdk

This commit is contained in:
heavyrian2012
2025-08-17 10:51:08 +08:00
parent f4ea8b184c
commit 8f798742c3
5 changed files with 63 additions and 2 deletions
@@ -4,6 +4,7 @@ import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.pojos.*;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.sdk.model.IMResult;
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
import cn.wildfirechat.sdk.utilities.ChannelHttpUtils;
import com.google.gson.Gson;
import org.apache.commons.codec.digest.DigestUtils;
@@ -65,6 +66,23 @@ public class ChannelServiceApi {
return channelHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
}
//仅专业版支持
public IMResult<String> recallMessage(long messageUid) throws Exception {
String path = APIPath.Channel_Msg_Recall;
RecallMessageData messageData = new RecallMessageData();
messageData.setMessageUid(messageUid);
return channelHttpUtils.httpJsonPost(path, messageData, String.class);
}
//仅专业版支持
public IMResult<Void> republishMessage(long messageUid, List<String> targets) throws Exception {
String path = APIPath.Channel_Msg_Republish;
RepublishChannelMessageData messageData = new RepublishChannelMessageData();
messageData.setMessageId(messageUid);
messageData.setTargets(targets);
return channelHttpUtils.httpJsonPost(path, messageData, Void.class);
}
public IMResult<Void> subscribe(String userId) throws Exception {
String path = APIPath.Channel_Subscribe;
InputChannelSubscribe input = new InputChannelSubscribe();
@@ -114,8 +114,8 @@ public class AdminHttpUtils extends JsonUtils {
public static <T> IMResult<T> httpJsonPost(String path, Object object, Class<T> clazz) throws Exception {
if (isNullOrEmpty(adminUrl) || isNullOrEmpty(adminSecret)) {
LOG.error("野火IM Server SDK必须先初始化才能使用,是不是忘记初始化了!!!!");
throw new Exception("SDK没有初始化");
LOG.error("野火IM Server SDK必须先初始化才能使用,是不是忘记初始化了!请调用AdminConfig.initAdmin(AdminUrl, AdminSecret);进行初始化");
throw new Exception("SDK没有初始化,请调用AdminConfig.initAdmin(AdminUrl, AdminSecret);进行初始化");
}
if (isNullOrEmpty(path)) {