use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class MessageManager method prepareSendTextMessageRequest.
public static JsonObject prepareSendTextMessageRequest(String textMessage, long threadId, Integer messageType, String jsonSystemMetadata, String uniqueId, String mTypecode, String token) {
ChatMessage chatMessageQueue = new ChatMessage();
chatMessageQueue.setContent(textMessage);
chatMessageQueue.setType(ChatMessageType.Constants.MESSAGE);
chatMessageQueue.setTokenIssuer("1");
chatMessageQueue.setToken(token);
if (jsonSystemMetadata != null) {
chatMessageQueue.setSystemMetadata(jsonSystemMetadata);
}
chatMessageQueue.setUniqueId(uniqueId);
chatMessageQueue.setTime(1000);
chatMessageQueue.setSubjectId(threadId);
JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessageQueue);
if (Util.isNullOrEmpty(mTypecode)) {
jsonObject.remove("typeCode");
} else {
jsonObject.remove("typeCode");
jsonObject.addProperty("typeCode", mTypecode);
}
if (!Util.isNullOrEmpty(messageType)) {
jsonObject.addProperty("messageType", messageType);
} else {
jsonObject.remove("messageType");
}
return jsonObject;
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class SearchManager method prepareSearchRequest.
public static String prepareSearchRequest(SearchSystemMetadataRequest 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 createTagListRequest.
public static String createTagListRequest(GetTagListRequest request, String uniqueId) {
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.GET_TAG_LIST);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
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 createAddTagRequest.
public static String createAddTagRequest(CreateTagRequest 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.CREATE_TAG);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setContent(content);
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 createAddTagParticipantRequest.
public static String createAddTagParticipantRequest(AddTagParticipantRequest request, String uniqueId) {
JsonArray participants = new JsonArray();
for (Long p : request.getThreadIds()) {
participants.add(p);
}
String content = App.getGson().toJson(participants);
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.ADD_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);
}
Aggregations