update
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package cn.wildfirechat.sdk;
|
||||
|
||||
import cn.wildfirechat.common.APIPath;
|
||||
import cn.wildfirechat.pojos.*;
|
||||
import cn.wildfirechat.sdk.model.IMResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GroupAdmin {
|
||||
public static IMResult<OutputCreateGroupResult> createGroup(String operator, PojoGroupInfo group_info, List<PojoGroupMember> members, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Create_Group;
|
||||
PojoGroup pojoGroup = new PojoGroup();
|
||||
pojoGroup.setGroup_info(group_info);
|
||||
pojoGroup.setMembers(members);
|
||||
InputCreateGroup createGroup = new InputCreateGroup();
|
||||
createGroup.setGroup(pojoGroup);
|
||||
createGroup.setOperator(operator);
|
||||
createGroup.setTo_lines(to_lines);
|
||||
createGroup.setNotify_message(notify_message);
|
||||
|
||||
return HttpUtils.httpJsonPost(path, createGroup, OutputCreateGroupResult.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> dismissGroup(String operator, String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Group_Dismiss;
|
||||
InputDismissGroup dismissGroup = new InputDismissGroup();
|
||||
dismissGroup.setOperator(operator);
|
||||
dismissGroup.setGroup_id(groupId);
|
||||
dismissGroup.setTo_lines(to_lines);
|
||||
dismissGroup.setNotify_message(notify_message);
|
||||
return HttpUtils.httpJsonPost(path, dismissGroup, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> transferGroup(String operator, String groupId, String newOwner, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Group_Transfer;
|
||||
InputTransferGroup transferGroup = new InputTransferGroup();
|
||||
transferGroup.setGroup_id(groupId);
|
||||
transferGroup.setNew_owner(newOwner);
|
||||
transferGroup.setTo_lines(to_lines);
|
||||
transferGroup.setNotify_message(notify_message);
|
||||
return HttpUtils.httpJsonPost(path, transferGroup, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> addGroupMembers(String operator, String groupId, List<String> groupMemberIds, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Group_Member_Add;
|
||||
InputAddGroupMember addGroupMember = new InputAddGroupMember();
|
||||
addGroupMember.setGroup_id(groupId);
|
||||
List<PojoGroupMember> members = new ArrayList<>();
|
||||
for (String mid : groupMemberIds) {
|
||||
PojoGroupMember m = new PojoGroupMember();
|
||||
m.setMember_id(mid);
|
||||
members.add(m);
|
||||
}
|
||||
addGroupMember.setMembers(members);
|
||||
addGroupMember.setTo_lines(to_lines);
|
||||
addGroupMember.setNotify_message(notify_message);
|
||||
return HttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> kickoffGroupMembers(String operator, String groupId, List<String> groupMemberIds, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Group_Member_Kickoff;
|
||||
InputKickoffGroupMember kickoffGroupMember = new InputKickoffGroupMember();
|
||||
kickoffGroupMember.setGroup_id(groupId);
|
||||
kickoffGroupMember.setMembers(groupMemberIds);
|
||||
kickoffGroupMember.setTo_lines(to_lines);
|
||||
kickoffGroupMember.setNotify_message(notify_message);
|
||||
return HttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,7 +54,10 @@ public class HttpUtils {
|
||||
post.setHeader("timestamp", "" + timestamp);
|
||||
post.setHeader("sign", sign);
|
||||
|
||||
String jsonStr = new Gson().toJson(object);
|
||||
String jsonStr = null;
|
||||
if (object != null) {
|
||||
jsonStr = new Gson().toJson(object);
|
||||
}
|
||||
LOG.info("http request content: {}", jsonStr);
|
||||
|
||||
StringEntity entity = new StringEntity(jsonStr, Charset.forName("UTF-8"));
|
||||
|
||||
@@ -4,9 +4,11 @@ import cn.wildfirechat.common.APIPath;
|
||||
import cn.wildfirechat.pojos.*;
|
||||
import cn.wildfirechat.sdk.model.IMResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserAdmin {
|
||||
public static IMResult<InputOutputUserInfo> getUserByName(String mobile) throws Exception {
|
||||
String path = APIPath.Get_User_Info;
|
||||
String path = APIPath.User_Get_Info;
|
||||
InputGetUserInfo getUserInfo = new InputGetUserInfo(null, mobile);
|
||||
return HttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
|
||||
}
|
||||
@@ -17,8 +19,36 @@ public class UserAdmin {
|
||||
}
|
||||
|
||||
public static IMResult<OutputGetIMTokenData> getUserToken(String userId, String clientId) throws Exception {
|
||||
String path = APIPath.Get_User_Token;
|
||||
String path = APIPath.User_Get_Token;
|
||||
InputGetToken getToken = new InputGetToken(userId, clientId);
|
||||
return HttpUtils.httpJsonPost(path, getToken, OutputGetIMTokenData.class);
|
||||
}
|
||||
|
||||
public static IMResult<Void> updateUserBlockStatus(String userId, int block) throws Exception {
|
||||
String path = APIPath.User_Update_Block_Status;
|
||||
InputOutputUserBlockStatus blockStatus = new InputOutputUserBlockStatus(userId, block);
|
||||
return HttpUtils.httpJsonPost(path, blockStatus, Void.class);
|
||||
}
|
||||
|
||||
public static IMResult<OutputUserStatus> checkUserBlockStatus(String userId) throws Exception {
|
||||
String path = APIPath.User_Update_Block_Status;
|
||||
InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null);
|
||||
return HttpUtils.httpJsonPost(path, getUserInfo, OutputUserStatus.class);
|
||||
}
|
||||
|
||||
public static IMResult<OutputUserBlockStatusList> getBlockedList() throws Exception {
|
||||
String path = APIPath.User_Get_Blocked_List;
|
||||
return HttpUtils.httpJsonPost(path, null, OutputUserBlockStatusList.class);
|
||||
}
|
||||
|
||||
//not implement
|
||||
// public static IMResult<OutputUserBlockStatusList> getUserOnlineStatus(String userId) throws Exception {
|
||||
// String path = APIPath.User_Get_Online_Status;
|
||||
// InputGetUserInfo inputGetUserInfo = new InputGetUserInfo(userId, null);
|
||||
// return HttpUtils.httpJsonPost(path, null, OutputUserBlockStatusList.class);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user