use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class AssistantManager method createRegisterAssistantRequest.
public static String createRegisterAssistantRequest(RegisterAssistantRequest request, String uniqueId) {
String content = App.getGson().toJson(request.getAssistantVos());
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.REGISTER_ASSISTANT);
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.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class Mention method getMentionList.
public static String getMentionList(RequestGetMentionList request, String uniqueId) {
long threadId = request.getThreadId();
JsonObject criteriaVO = new JsonObject();
if (request.getAllMentioned() != null && request.getAllMentioned())
criteriaVO.addProperty("allMentioned", true);
if (request.getUnreadMentioned() != null && request.getUnreadMentioned())
criteriaVO.addProperty("unreadMentioned", true);
long count = request.getCount() > 0 ? request.getCount() : 50;
criteriaVO.addProperty("count", count);
criteriaVO.addProperty("offset", request.getOffset());
AsyncMessage message = new AsyncMessage();
message.setContent(criteriaVO.toString());
message.setType(ChatMessageType.Constants.GET_HISTORY);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
message.setSubjectId(threadId);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
return App.getGson().toJson(message);
}
use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class MessageManager method generateDeleteMessageRequest.
public static AsyncMessage generateDeleteMessageRequest(boolean deleteForAll, String uniqueId, long messageId, String typecode, String token) {
AsyncMessage asyncMessage = new AsyncMessage();
JsonObject contentObj = new JsonObject();
contentObj.addProperty("deleteForAll", deleteForAll);
asyncMessage.setContent(contentObj.toString());
asyncMessage.setToken(token);
asyncMessage.setTokenIssuer("1");
asyncMessage.setType(ChatMessageType.Constants.DELETE_MESSAGE);
asyncMessage.setUniqueId(uniqueId);
asyncMessage.setSubjectId(messageId);
asyncMessage.setTypeCode(typecode);
return asyncMessage;
}
use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class MessageManager method prepareDeleteMultipleRequest.
public static String prepareDeleteMultipleRequest(RequestDeleteMessage request, List<String> uniqueIds, String token, String typcode) {
List<Long> messageIds = request.getMessageIds();
boolean deleteForAll = request.isDeleteForAll();
AsyncMessage asyncMessage = new AsyncMessage();
JsonObject contentObj = new JsonObject();
JsonElement messageIdsElement = App.getGson().toJsonTree(messageIds, new TypeToken<List<Long>>() {
}.getType());
JsonElement uniqueIdsElement = App.getGson().toJsonTree(uniqueIds, new TypeToken<List<String>>() {
}.getType());
contentObj.add("ids", messageIdsElement.getAsJsonArray());
contentObj.add("uniqueIds", uniqueIdsElement.getAsJsonArray());
contentObj.addProperty("deleteForAll", deleteForAll);
asyncMessage.setContent(contentObj.toString());
asyncMessage.setToken(token);
asyncMessage.setTokenIssuer("1");
asyncMessage.setType(ChatMessageType.Constants.DELETE_MESSAGE);
JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(asyncMessage);
jsonObject.remove("subjectId");
if (Util.isNullOrEmpty(typcode)) {
jsonObject.remove("typeCode");
} else {
jsonObject.remove("typeCode");
jsonObject.addProperty("typeCode", typcode);
}
String asyncContent = jsonObject.toString();
return asyncContent;
}
use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class ThreadManager method createChangeThreadTypeRequest.
public static String createChangeThreadTypeRequest(ChangeThreadTypeRequest request, String uniqueId) throws PodChatException {
JsonObject content = new JsonObject();
content.addProperty("type", request.getType());
if (request.getUniqname() != null)
content.addProperty("uniqueName", request.getUniqname());
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.CHANGE_THREAD_TYPE);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setContent(content.toString());
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setSubjectId(request.getThreadId());
message.setUniqueId(uniqueId);
return App.getGson().toJson(message);
}
Aggregations