use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class ThreadManager method createMutaulGroupRequest.
public static String createMutaulGroupRequest(GetMutualGroupRequest request, String uniqueId) {
JsonObject content = (JsonObject) App.getGson().toJsonTree(request);
content.remove("useCache");
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.MUTUAL_GROUPS);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setContent(content.toString());
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 ThreadManager method prepareRenameThreadRequest.
public static String prepareRenameThreadRequest(long threadId, String title, String uniqueId, String mTypeCode, String token) {
ChatMessage chatMessage = new ChatMessage();
chatMessage.setType(ChatMessageType.Constants.RENAME);
chatMessage.setSubjectId(threadId);
chatMessage.setContent(title);
chatMessage.setToken(token);
chatMessage.setTokenIssuer("1");
chatMessage.setUniqueId(uniqueId);
chatMessage.setTypeCode(mTypeCode);
String asyncContent = App.getGson().toJson(chatMessage);
return asyncContent;
}
use of com.fanap.podchat.mainmodel.ChatMessage in project pod-chat-android-sdk by FanapSoft.
the class ThreadManager method prepareSetRoleRequest.
public static String prepareSetRoleRequest(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.SET_ROLE_TO_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 ThreadManager method createCloseThreadRequest.
public static String createCloseThreadRequest(CloseThreadRequest request, String uniqueId) throws PodChatException {
validateThreadId(request, uniqueId);
AsyncMessage message = new ChatMessage();
message.setType(ChatMessageType.Constants.CLOSE_THREAD);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
message.setSubjectId(request.getThreadId());
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 ThreadManager method getChatMessage.
@NonNull
private static ChatMessage getChatMessage(String contentThreadChat, String uniqueId, String typeCode, String token) {
ChatMessage chatMessage = new ChatMessage();
chatMessage.setContent(contentThreadChat);
chatMessage.setType(ChatMessageType.Constants.INVITATION);
chatMessage.setToken(token);
chatMessage.setUniqueId(uniqueId);
chatMessage.setTokenIssuer("1");
if (typeCode != null && !typeCode.isEmpty()) {
chatMessage.setTypeCode(typeCode);
} else {
chatMessage.setTypeCode(typeCode);
}
return chatMessage;
}
Aggregations