Search in sources :

Example 26 with AsyncMessage

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

the class HashTagManager method getHashTagList.

public static String getHashTagList(RequestGetHashTagList request, String uniqueId) {
    long threadId = request.getThreadId();
    JsonObject criteriaVO = new JsonObject();
    long count = request.getCount() > 0 ? request.getCount() : 50;
    criteriaVO.addProperty("count", count);
    criteriaVO.addProperty("offset", request.getOffset());
    criteriaVO.addProperty("hashtag", request.getHashtag());
    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);
}
Also used : AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) JsonObject(com.google.gson.JsonObject)

Example 27 with AsyncMessage

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

the class AssistantManager method createGetBlockedAssistantsRequest.

public static String createGetBlockedAssistantsRequest(GetBlockedAssistantsRequest request, String uniqueId) {
    JsonObject content = new JsonObject();
    content.addProperty("contactType", request.getTypeCode());
    if ((Long) request.getOffset() != null) {
        content.addProperty("offset", request.getOffset());
    }
    if ((Long) request.getCount() != null) {
        content.addProperty("count", request.getCount());
    } else {
        content.addProperty("count", 50);
    }
    AsyncMessage message = new ChatMessage();
    message.setType(ChatMessageType.Constants.GET_BLOCKED_ASSISTANTS);
    message.setToken(CoreConfig.token);
    message.setTokenIssuer(CoreConfig.tokenIssuer);
    message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
    message.setContent(App.getGson().toJson(content));
    message.setUniqueId(uniqueId);
    return App.getGson().toJson(message);
}
Also used : ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) JsonObject(com.google.gson.JsonObject)

Example 28 with AsyncMessage

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

the class AssistantManager method createBlockAssistantsRequest.

public static String createBlockAssistantsRequest(BlockUnblockAssistantRequest request, String uniqueId) {
    String content = App.getGson().toJson(request.getAssistantVos());
    AsyncMessage message = new ChatMessage();
    message.setType(ChatMessageType.Constants.BLOCK_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);
}
Also used : ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage)

Example 29 with AsyncMessage

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

the class AssistantManager method createGetAssistantHistoryRequest.

public static String createGetAssistantHistoryRequest(GetAssistantHistoryRequest request, String uniqueId) {
    JsonObject content = new JsonObject();
    AsyncMessage message = new ChatMessage();
    message.setType(ChatMessageType.Constants.GET_ASSISTANT_HISTORY);
    message.setToken(CoreConfig.token);
    message.setTokenIssuer(CoreConfig.tokenIssuer);
    message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
    message.setContent(App.getGson().toJson(content));
    message.setUniqueId(uniqueId);
    return App.getGson().toJson(message);
}
Also used : ChatMessage(com.fanap.podchat.mainmodel.ChatMessage) AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage) JsonObject(com.google.gson.JsonObject)

Example 30 with AsyncMessage

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

the class BotManager method createDefineBotCommandRequest.

public static String createDefineBotCommandRequest(DefineBotCommandRequest request, String uniqueId) throws PodChatException {
    validateCommands(request.getCommandList());
    AsyncMessage message = new AsyncMessage();
    message.setContent(App.getGson().toJson(request));
    message.setToken(CoreConfig.token);
    message.setType(ChatMessageType.Constants.DEFINE_BOT_COMMAND);
    message.setTokenIssuer(CoreConfig.tokenIssuer);
    message.setUniqueId(uniqueId);
    message.setTypeCode(request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
    return App.getGson().toJson(message);
}
Also used : AsyncMessage(com.fanap.podchat.mainmodel.AsyncMessage)

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