同步专业版sdk
This commit is contained in:
@@ -128,6 +128,8 @@ public interface APIPath {
|
||||
String Channel_Update_Profile = "/channel/update_profile";
|
||||
String Channel_Get_Profile = "/channel/get_profile";
|
||||
String Channel_Message_Send = "/channel/message/send";
|
||||
String Channel_Msg_Recall = "/channel/message/recall";
|
||||
String Channel_Msg_Republish = "/channel/message/republish";
|
||||
String Channel_Subscribe = "/channel/subscribe";
|
||||
String Channel_Subscriber_List = "/channel/subscriber_list";
|
||||
String Channel_Is_Subscriber = "/channel/is_subscriber";
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is part of the Wildfire Chat package.
|
||||
* (c) Heavyrain2012 <[email protected]>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
package cn.wildfirechat.pojos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RepublishChannelMessageData {
|
||||
private List<String> targets;
|
||||
private long messageId;
|
||||
|
||||
public List<String> getTargets() {
|
||||
return targets;
|
||||
}
|
||||
|
||||
public void setTargets(List<String> targets) {
|
||||
this.targets = targets;
|
||||
}
|
||||
|
||||
public long getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public void setMessageId(long messageId) {
|
||||
this.messageId = messageId;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public class SendMessageData {
|
||||
private MessagePayload payload;
|
||||
private List<String> toUsers;
|
||||
private boolean isMeshMessage;
|
||||
private boolean isUserMessage;
|
||||
|
||||
public String getSender() {
|
||||
return sender;
|
||||
@@ -61,6 +62,14 @@ public class SendMessageData {
|
||||
isMeshMessage = meshMessage;
|
||||
}
|
||||
|
||||
public boolean isUserMessage() {
|
||||
return isUserMessage;
|
||||
}
|
||||
|
||||
public void setUserMessage(boolean userMessage) {
|
||||
isUserMessage = userMessage;
|
||||
}
|
||||
|
||||
public static boolean isValide(SendMessageData sendMessageData) {
|
||||
if(sendMessageData == null ||
|
||||
sendMessageData.getConv() == null ||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user