use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class ThreadManager method prepareRemoveRoleRequest.
public static String prepareRemoveRoleRequest(SetRuleVO request, String uniqueId, String mtypecode, String token, String TOKEN_ISSUER) {
ArrayList<UserRoleVO> userRoleVOS = new ArrayList<>();
for (RequestRole requestRole : request.getRoles()) {
UserRoleVO userRoleVO = new UserRoleVO();
userRoleVO.setUserId(requestRole.getId());
userRoleVO.setRoles(requestRole.getRoleTypes());
userRoleVOS.add(userRoleVO);
}
ChatMessage chatMessage = new ChatMessage();
chatMessage.setContent(App.getGson().toJson(userRoleVOS));
chatMessage.setSubjectId(request.getThreadId());
chatMessage.setToken(token);
chatMessage.setType(ChatMessageType.Constants.REMOVE_ROLE_FROM_USER);
chatMessage.setTokenIssuer(TOKEN_ISSUER);
chatMessage.setUniqueId(uniqueId);
chatMessage.setTypeCode(mtypecode);
return App.getGson().toJson(chatMessage);
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class SearchManager method prepareSearchRequest.
public static String prepareSearchRequest(NosqlListMessageCriteriaVO messageCriteriaVO, String uniqueId, String typecode, String token) {
if (messageCriteriaVO.getCount() == 0)
messageCriteriaVO.setCount(25);
String content = App.getGson().toJson(messageCriteriaVO);
ChatMessage chatMessage = new ChatMessage();
chatMessage.setContent(content);
chatMessage.setType(ChatMessageType.Constants.GET_HISTORY);
chatMessage.setToken(token);
chatMessage.setTokenIssuer("1");
chatMessage.setUniqueId(uniqueId);
chatMessage.setSubjectId(messageCriteriaVO.getMessageThreadId());
JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessage);
if (Util.isNullOrEmpty(typecode)) {
jsonObject.remove("typeCode");
} else {
jsonObject.remove("typeCode");
jsonObject.addProperty("typeCode", typecode);
}
return jsonObject.toString();
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class TagManager method createRemoveTagParticipantRequest.
public static String createRemoveTagParticipantRequest(RemoveTagParticipantRequest request, String uniqueId) {
JsonArray participants = new JsonArray();
for (Long p : request.getThreadIds()) {
participants.add(p);
}
String content = "[{\"threadId\": 8688 }," + "{\"threadId\": 8730 }," + "{\"threadId\": 8729 }]";
// String content = App.getGson().toJson(participants);
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.REMOVE_TAG_PARTICIPANT);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setContent(content);
message.setSubjectId(request.getTagId());
message.setUniqueId(uniqueId);
return App.getGson().toJson(message);
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class TagManager method createDeleteTagRequest.
public static String createDeleteTagRequest(DeleteTagRequest request, String uniqueId) {
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.DELETE_TAG);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setSubjectId(request.getTagId());
message.setUniqueId(uniqueId);
return App.getGson().toJson(message);
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class TagManager method createEditTagRequest.
public static String createEditTagRequest(EditTagRequest request, String uniqueId) {
JsonObject contentObject = new JsonObject();
if (request.getName() != null)
contentObject.addProperty("name", request.getName());
String content = App.getGson().toJson(contentObject);
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.EDIT_TAG);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setContent(content);
message.setSubjectId(request.getTagId());
message.setUniqueId(uniqueId);
return App.getGson().toJson(message);
}
Aggregations