Search in sources :

Example 41 with AsyncMessage

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

the class BotManager method createStopBotRequest.

public static String createStopBotRequest(StartAndStopBotRequest request, String uniqueId) throws PodChatException {
    validateThreadId(request.getThreadId());
    validateBotName(request.getBotName());
    JsonObject content = new JsonObject();
    content.addProperty("botName", request.getBotName());
    AsyncMessage message = new AsyncMessage();
    message.setContent(content.toString());
    message.setToken(CoreConfig.token);
    message.setType(ChatMessageType.Constants.STOP_BOT);
    message.setTokenIssuer(CoreConfig.tokenIssuer);
    message.setUniqueId(uniqueId);
    message.setSubjectId(request.getThreadId());
    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 42 with AsyncMessage

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

the class BotManager method createGetUserBotsRequest.

public static String createGetUserBotsRequest(GetUserBotsRequest request, String uniqueId) throws PodChatException {
    AsyncMessage message = new AsyncMessage();
    message.setToken(CoreConfig.token);
    message.setType(ChatMessageType.Constants.GET_USER_BOTS);
    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)

Example 43 with AsyncMessage

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

the class AssistantManager method createDeActiveAssistantRequest.

public static String createDeActiveAssistantRequest(DeActiveAssistantRequest request, String uniqueId) {
    String content = App.getGson().toJson(request.getAssistantVos());
    AsyncMessage message = new ChatMessage();
    message.setType(ChatMessageType.Constants.DEACTIVE_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 44 with AsyncMessage

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

the class AssistantManager method createGetAssistantsRequest.

public static String createGetAssistantsRequest(GetAssistantRequest request, String uniqueId) {
    JsonObject content = new JsonObject();
    content.addProperty("contactType", request.getTypeCode() != null ? request.getTypeCode() : CoreConfig.typeCode);
    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_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 45 with AsyncMessage

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

the class AssistantManager method createUnBlockAssistantRequest.

public static String createUnBlockAssistantRequest(BlockUnblockAssistantRequest request, String uniqueId) {
    String content = App.getGson().toJson(request.getAssistantVos());
    AsyncMessage message = new ChatMessage();
    message.setType(ChatMessageType.Constants.UNBLOCK_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)

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