update
This commit is contained in:
committed by
heavyrain.lee
parent
608184ef9e
commit
7494cdc071
@@ -0,0 +1,27 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
public class ChannelAdmin {
|
||||||
|
public static IMResult<OutputCreateChatroom> createChannel(InputCreateChatroom input) throws Exception {
|
||||||
|
String path = APIPath.Create_Chatroom;
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, input, OutputCreateChatroom.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IMResult<Void> destroyChannel(String chatroomId) throws Exception {
|
||||||
|
String path = APIPath.Chatroom_Destroy;
|
||||||
|
InputDestoryChatroom input = new InputDestoryChatroom();
|
||||||
|
input.setChatroomId(chatroomId);
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, input, Void.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IMResult<OutputGetChatroomInfo> getChannelInfo(String chatroomId) throws Exception {
|
||||||
|
String path = APIPath.Chatroom_Info;
|
||||||
|
InputGetChatroomInfo input = new InputGetChatroomInfo(chatroomId);
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, input, OutputGetChatroomInfo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -294,6 +294,14 @@ public class Main {
|
|||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> multicastReceivers = Arrays.asList("user2", "user3", "user4");
|
||||||
|
IMResult<MultiMessageResult> resultMulticastMessage = MessageAdmin.multicastMessage("user1", multicastReceivers, 0, payload);
|
||||||
|
if (resultMulticastMessage != null && resultMulticastMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
System.out.println("multi message success, messageid is " + resultMulticastMessage.getResult().getMessageUid());
|
||||||
|
} else {
|
||||||
|
System.out.println("multi message failure");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
IMResult<SystemSettingPojo> resultGetSystemSetting = GeneralAdmin.getSystemSetting(Group_Max_Member_Count);
|
IMResult<SystemSettingPojo> resultGetSystemSetting = GeneralAdmin.getSystemSetting(Group_Max_Member_Count);
|
||||||
if (resultGetSystemSetting != null && resultGetSystemSetting.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
if (resultGetSystemSetting != null && resultGetSystemSetting.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import cn.wildfirechat.pojos.*;
|
|||||||
import cn.wildfirechat.sdk.model.IMResult;
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
import cn.wildfirechat.sdk.utilities.AdminHttpUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MessageAdmin {
|
public class MessageAdmin {
|
||||||
public static IMResult<SendMessageResult> sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception {
|
public static IMResult<SendMessageResult> sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception {
|
||||||
String path = APIPath.Msg_Send;
|
String path = APIPath.Msg_Send;
|
||||||
@@ -31,4 +33,14 @@ public class MessageAdmin {
|
|||||||
messageData.setPayload(payload);
|
messageData.setPayload(payload);
|
||||||
return AdminHttpUtils.httpJsonPost(path, messageData, BroadMessageResult.class);
|
return AdminHttpUtils.httpJsonPost(path, messageData, BroadMessageResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IMResult<MultiMessageResult> multicastMessage(String sender, List<String> receivers, int line, MessagePayload payload) throws Exception {
|
||||||
|
String path = APIPath.Msg_Multicast;
|
||||||
|
MulticastMessageData messageData = new MulticastMessageData();
|
||||||
|
messageData.setSender(sender);
|
||||||
|
messageData.setTargets(receivers);
|
||||||
|
messageData.setLine(line);
|
||||||
|
messageData.setPayload(payload);
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, messageData, MultiMessageResult.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user