update
This commit is contained in:
@@ -2,10 +2,6 @@ package cn.wildfirechat.common;
|
|||||||
|
|
||||||
public interface APIPath {
|
public interface APIPath {
|
||||||
String Create_Chatroom = "/admin/chatroom/create";
|
String Create_Chatroom = "/admin/chatroom/create";
|
||||||
String Create_Group = "/admin/group/create";
|
|
||||||
String Create_Robot = "/admin/robot/create";
|
|
||||||
String Create_User = "/admin/user/create";
|
|
||||||
|
|
||||||
String Chatroom_Destroy = "/admin/chatroom/del";
|
String Chatroom_Destroy = "/admin/chatroom/del";
|
||||||
String Chatroom_Info = "/admin/chatroom/info";
|
String Chatroom_Info = "/admin/chatroom/info";
|
||||||
|
|
||||||
@@ -14,6 +10,7 @@ public interface APIPath {
|
|||||||
String Sensitive_Del = "/admin/sensitive/del";
|
String Sensitive_Del = "/admin/sensitive/del";
|
||||||
String Sensitive_Query = "/admin/sensitive/query";
|
String Sensitive_Query = "/admin/sensitive/query";
|
||||||
|
|
||||||
|
String Create_User = "/admin/user/create";
|
||||||
String User_Get_Token = "/admin/user/get_token";
|
String User_Get_Token = "/admin/user/get_token";
|
||||||
String User_Update_Block_Status = "/admin/user/update_block_status";
|
String User_Update_Block_Status = "/admin/user/update_block_status";
|
||||||
String User_Get_Info = "/admin/user/get_info";
|
String User_Get_Info = "/admin/user/get_info";
|
||||||
@@ -28,12 +25,15 @@ public interface APIPath {
|
|||||||
String Msg_Send = "/admin/message/send";
|
String Msg_Send = "/admin/message/send";
|
||||||
String Msg_Recall = "/admin/message/recall";
|
String Msg_Recall = "/admin/message/recall";
|
||||||
|
|
||||||
|
String Create_Group = "/admin/group/create";
|
||||||
String Group_Dismiss = "/admin/group/del";
|
String Group_Dismiss = "/admin/group/del";
|
||||||
String Group_Transfer = "/admin/group/transfer";
|
String Group_Transfer = "/admin/group/transfer";
|
||||||
String Group_Member_Add = "/admin/group/member/add";
|
String Group_Member_Add = "/admin/group/member/add";
|
||||||
String Group_Member_Kickoff = "/admin/group/member/del";
|
String Group_Member_Kickoff = "/admin/group/member/del";
|
||||||
|
|
||||||
|
String Create_Robot = "/admin/robot/create";
|
||||||
|
|
||||||
|
|
||||||
String Channel_Message_Send = "/channel/message/send";
|
String Channel_Message_Send = "/channel/message/send";
|
||||||
|
|
||||||
String Robot_User_Info = "/robot/user_info";
|
String Robot_User_Info = "/robot/user_info";
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package cn.wildfirechat.sdk;
|
package cn.wildfirechat.sdk;
|
||||||
|
|
||||||
import cn.wildfirechat.common.APIPath;
|
import cn.wildfirechat.sdk.utilities.HttpUtils;
|
||||||
import cn.wildfirechat.pojos.*;
|
|
||||||
import cn.wildfirechat.sdk.model.*;
|
|
||||||
|
|
||||||
public class ChatConfig {
|
public class ChatConfig {
|
||||||
public static void init(String url, String secret) {
|
public static void init(String url, String secret) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cn.wildfirechat.sdk;
|
|||||||
import cn.wildfirechat.common.APIPath;
|
import cn.wildfirechat.common.APIPath;
|
||||||
import cn.wildfirechat.pojos.*;
|
import cn.wildfirechat.pojos.*;
|
||||||
import cn.wildfirechat.sdk.model.IMResult;
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
|
import cn.wildfirechat.sdk.utilities.HttpUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package cn.wildfirechat.sdk;
|
||||||
|
|
||||||
|
import cn.wildfirechat.common.APIPath;
|
||||||
|
import cn.wildfirechat.pojos.*;
|
||||||
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
|
import cn.wildfirechat.sdk.utilities.HttpUtils;
|
||||||
|
|
||||||
|
public class MessageAdmin {
|
||||||
|
public static IMResult<SendMessageResult> sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception {
|
||||||
|
String path = APIPath.Msg_Send;
|
||||||
|
SendMessageData messageData = new SendMessageData();
|
||||||
|
messageData.setSender(sender);
|
||||||
|
messageData.setConv(conversation);
|
||||||
|
messageData.setPayload(payload);
|
||||||
|
return HttpUtils.httpJsonPost(path, messageData, SendMessageResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IMResult<Void> recallMessage(String operator, long messageUid) throws Exception {
|
||||||
|
String path = APIPath.Msg_Recall;
|
||||||
|
RecallMessageData messageData = new RecallMessageData();
|
||||||
|
messageData.setOperator(operator);
|
||||||
|
messageData.setMessageUid(messageUid);
|
||||||
|
return HttpUtils.httpJsonPost(path, messageData, Void.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,7 @@ package cn.wildfirechat.sdk;
|
|||||||
import cn.wildfirechat.common.APIPath;
|
import cn.wildfirechat.common.APIPath;
|
||||||
import cn.wildfirechat.pojos.*;
|
import cn.wildfirechat.pojos.*;
|
||||||
import cn.wildfirechat.sdk.model.IMResult;
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
|
import cn.wildfirechat.sdk.utilities.HttpUtils;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class UserAdmin {
|
public class UserAdmin {
|
||||||
public static IMResult<InputOutputUserInfo> getUserByName(String mobile) throws Exception {
|
public static IMResult<InputOutputUserInfo> getUserByName(String mobile) throws Exception {
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package cn.wildfirechat.sdk;
|
package cn.wildfirechat.sdk.utilities;
|
||||||
|
|
||||||
import cn.wildfirechat.sdk.model.IMResult;
|
import cn.wildfirechat.sdk.model.IMResult;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -25,12 +25,12 @@ public class HttpUtils {
|
|||||||
private static String adminUrl;
|
private static String adminUrl;
|
||||||
private static String adminSecret;
|
private static String adminSecret;
|
||||||
|
|
||||||
static void init(String url, String secret) {
|
public static void init(String url, String secret) {
|
||||||
adminUrl = url;
|
adminUrl = url;
|
||||||
adminSecret = secret;
|
adminSecret = secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static <T> IMResult<T> httpJsonPost(String path, Object object, Class<T> clazz) throws Exception{
|
public static <T> IMResult<T> httpJsonPost(String path, Object object, Class<T> clazz) throws Exception{
|
||||||
if (isNullOrEmpty(adminUrl) || isNullOrEmpty(path)) {
|
if (isNullOrEmpty(adminUrl) || isNullOrEmpty(path)) {
|
||||||
LOG.error("Not init IM SDK correctly. Do you forget init it?");
|
LOG.error("Not init IM SDK correctly. Do you forget init it?");
|
||||||
throw new Exception("SDK url or secret lack!");
|
throw new Exception("SDK url or secret lack!");
|
||||||
Reference in New Issue
Block a user