use of com.fanap.podchat.mainmodel.AsyncMessage 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.AsyncMessage 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);
}
use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class ParticipantsManager method prepareAddParticipantsRequest.
public static String prepareAddParticipantsRequest(RequestAddParticipants request, String uniqueId, String mTypeCode, String token) {
JsonArray participantsJsonArray = new JsonArray();
if (request.getContactIds() != null) {
for (Long p : request.getContactIds()) {
participantsJsonArray.add(p);
}
} else if (request.getUserNames() != null) {
for (String username : request.getUserNames()) {
Invitee invitee = new Invitee();
invitee.setId(username);
invitee.setIdType(InviteType.Constants.TO_BE_USER_USERNAME);
JsonElement jsonElement = App.getGson().toJsonTree(invitee);
participantsJsonArray.add(jsonElement);
}
} else {
for (Long coreUserId : request.getCoreUserIds()) {
Invitee invitee = new Invitee();
invitee.setId(coreUserId);
invitee.setIdType(InviteType.Constants.TO_BE_USER_ID);
JsonElement jsonElement = App.getGson().toJsonTree(invitee);
participantsJsonArray.add(jsonElement);
}
}
AsyncMessage chatMessage = new AsyncMessage();
chatMessage.setTokenIssuer("1");
chatMessage.setToken(token);
chatMessage.setContent(participantsJsonArray.toString());
chatMessage.setSubjectId(request.getThreadId());
chatMessage.setUniqueId(uniqueId);
chatMessage.setType(ChatMessageType.Constants.ADD_PARTICIPANT);
chatMessage.setTypeCode(mTypeCode);
JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(chatMessage);
return jsonObject.toString();
}
use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class PinMessage method unPinMessage.
public static String unPinMessage(RequestPinMessage request, String uniqueId) {
long messageId = request.getMessageId();
AsyncMessage message = new AsyncMessage();
message.setSubjectId(messageId);
message.setToken(CoreConfig.token);
message.setType(ChatMessageType.Constants.UNPIN_MESSAGE);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
message.setTypeCode(!Util.isNullOrEmpty(request.getTypeCode()) ? 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 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);
}
Aggregations