use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class PinThread method pinThread.
public static String pinThread(RequestPinThread request, String uniqueId) {
long threadId = request.getThreadId();
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.PIN_THREAD);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setSubjectId(threadId);
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 PinThread method unPinThread.
public static String unPinThread(RequestPinThread request, String uniqueId) {
long threadId = request.getThreadId();
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.UNPIN_THREAD);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setSubjectId(threadId);
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 ContactManager method prepareBlockRequest.
public static String prepareBlockRequest(Long contactId, Long userId, Long threadId, String uniqueId, String mtypecode, String token) {
JsonObject contentObject = new JsonObject();
if (!Util.isNullOrEmpty(contactId)) {
contentObject.addProperty("contactId", contactId);
}
if (!Util.isNullOrEmpty(userId)) {
contentObject.addProperty("userId", userId);
}
if (!Util.isNullOrEmpty(threadId)) {
contentObject.addProperty("threadId", threadId);
}
String json = contentObject.toString();
ChatMessage chatMessage = new ChatMessage();
chatMessage.setContent(json);
chatMessage.setToken(token);
chatMessage.setUniqueId(uniqueId);
chatMessage.setTokenIssuer("1");
chatMessage.setType(ChatMessageType.Constants.BLOCK);
chatMessage.setTypeCode(mtypecode);
JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessage);
if (Util.isNullOrEmpty(mtypecode)) {
jsonObject.remove("typeCode");
} else {
jsonObject.remove("typeCode");
jsonObject.addProperty("typeCode", mtypecode);
}
return jsonObject.toString();
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class ContactManager method prepareUnBlockRequest.
public static String prepareUnBlockRequest(Long blockId, Long userId, Long threadId, Long contactId, String uniqueId, String mtypecode, String token) {
ChatMessage chatMessage = new ChatMessage();
JsonObject contentObject = new JsonObject();
if (!Util.isNullOrEmpty(contactId)) {
contentObject.addProperty("contactId", contactId);
}
if (!Util.isNullOrEmpty(userId)) {
contentObject.addProperty("userId", userId);
}
if (!Util.isNullOrEmpty(threadId)) {
contentObject.addProperty("threadId", threadId);
}
String jsonContent = contentObject.toString();
chatMessage.setContent(jsonContent);
chatMessage.setToken(token);
chatMessage.setUniqueId(uniqueId);
chatMessage.setTokenIssuer("1");
chatMessage.setType(ChatMessageType.Constants.UNBLOCK);
JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessage);
jsonObject.remove("contentCount");
jsonObject.remove("systemMetadata");
jsonObject.remove("metadata");
jsonObject.remove("repliedTo");
if (Util.isNullOrEmpty(blockId)) {
jsonObject.remove("subjectId");
} else {
jsonObject.remove("subjectId");
jsonObject.addProperty("subjectId", blockId);
}
if (Util.isNullOrEmpty(mtypecode)) {
jsonObject.remove("typeCode");
} else {
jsonObject.remove("typeCode");
jsonObject.addProperty("typeCode", mtypecode);
}
return jsonObject.toString();
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class ContactManager method createAddContactRequest.
public static String createAddContactRequest(String uniqueId, String typeCode, List<String> firstNames, List<String> lastNames, List<String> userNames, List<String> cellNumbers, List<String> emails, List<String> uniqIds) {
AddContactVO addContactVO = new AddContactVO().setEmailList(emails).setFirstNameList(firstNames).setLastNameList(lastNames).setUserNameList(userNames).setCellphoneNumberList(cellNumbers).setUniqueIdList(uniqIds);
String content = App.getGson().toJson(addContactVO);
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.ADD_CONTACT);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(typeCode != null ? typeCode : CoreConfig.typeCode);
message.setContent(content);
message.setUniqueId(uniqueId);
return App.getGson().toJson(message);
}
Aggregations