Search in sources :

Example 61 with AsyncMessage

use of com.fanap.podchat.mainmodel.AsyncMessage 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);
}
Also used : ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage)

Example 62 with AsyncMessage

use of com.fanap.podchat.mainmodel.AsyncMessage 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);
}
Also used : ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) AddContactVO(com.fanap.podchat.chat.contact.model.AddContactVO)

Example 63 with AsyncMessage

use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.

the class ContactManager method createRemoveContactRequest.

public static String createRemoveContactRequest(String uniqueId, String typeCode, List<String> userIds) {
    String content = App.getGson().toJson(userIds);
    AsyncMessage message = new ChatMessage();
    message.setType(ChatMessageType.Constants.REMOVE_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);
}
Also used : ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage)

Example 64 with AsyncMessage

use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method createGetActiveCallsRequest.

public static String createGetActiveCallsRequest(GetActiveCallsRequest request, String uniqueId) {
    request.setCount(request.getCount() > 0 ? request.getCount() : 50);
    JsonObject content = (JsonObject) App.getGson().toJsonTree(request);
    content.remove("useCache");
    AsyncMessage message = new AsyncMessage();
    message.setContent(content.toString());
    message.setType(ChatMessageType.Constants.GET_CALLS_TO_JOIN);
    message.setToken(CoreConfig.token);
    message.setTokenIssuer(CoreConfig.tokenIssuer);
    message.setUniqueId(uniqueId);
    message.setTypeCode(Util.isNullOrEmpty(request.getTypeCode()) ? CoreConfig.typeCode : request.getTypeCode());
    JsonObject jsonObject = (JsonObject) App.getGson().toJsonTree(message);
    jsonObject.remove("subjectId");
    return jsonObject.toString();
}
Also used : AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) JsonObject(com.google.gson.JsonObject)

Example 65 with AsyncMessage

use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.

the class CallAsyncRequestsManager method createCallClientErrorsRequestMessage.

public static String createCallClientErrorsRequestMessage(CallClientErrorsRequest request, String uniqueId) throws PodChatException {
    if (request.getCallId() <= 0)
        throw new PodChatException("Invalid call id", ChatConstant.ERROR_CODE_INVALID_THREAD_ID, uniqueId);
    AsyncMessage message = new AsyncMessage();
    JsonObject contentObj = new JsonObject();
    contentObj.addProperty("code", request.getErrorCode());
    message.setType(ChatMessageType.Constants.CALL_CLIENT_ERRORS);
    message.setContent(contentObj.toString());
    message.setToken(CoreConfig.token);
    message.setTokenIssuer(CoreConfig.tokenIssuer);
    message.setUniqueId(uniqueId);
    message.setSubjectId(request.getCallId());
    message.setTypeCode(Util.isNotNullOrEmpty(request.getTypeCode()) ? request.getTypeCode() : CoreConfig.typeCode);
    JsonObject messageObj = (JsonObject) App.getGson().toJsonTree(message);
    return messageObj.toString();
}
Also used : PodChatException(com.fanap.podchat.util.PodChatException) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) JsonObject(com.google.gson.JsonObject)

Aggregations

AsyncMessage (com.fanap.podchat.mainmodel.AsyncMessage)78 JsonObject (com.google.gson.JsonObject)53 ChatMessage (com.fanap.podchat.mainmodel.ChatMessage)20 PodChatException (com.fanap.podchat.util.PodChatException)7 JsonElement (com.google.gson.JsonElement)6 JsonArray (com.google.gson.JsonArray)5 ChatMessageContent (com.fanap.podchat.mainmodel.ChatMessageContent)4 ArrayList (java.util.ArrayList)4 SendClientDTO (com.fanap.podchat.call.model.SendClientDTO)3 RoomIntegrityException (com.fanap.podchat.persistance.RoomIntegrityException)3 PodThreadManager (com.fanap.podchat.util.PodThreadManager)3 CreateCallVO (com.fanap.podchat.call.model.CreateCallVO)2 TurnCallParticipantVideoOffRequest (com.fanap.podchat.call.request_model.TurnCallParticipantVideoOffRequest)2 Invitee (com.fanap.podchat.mainmodel.Invitee)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)2 TypeToken (com.google.gson.reflect.TypeToken)2 SentryException (io.sentry.core.protocol.SentryException)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 JSONException (org.json.JSONException)2