Search in sources :

Example 1 with MultipleChannelFeedApiResponse

use of com.applozic.mobicomkit.MultipleChannelFeedApiResponse in project Applozic-Android-SDK by AppLozic.

the class ChannelClientService method createMultipleChannels.

public List<ChannelFeed> createMultipleChannels(List<ChannelInfo> channels) {
    List<ChannelFeed> channelFeeds = null;
    try {
        String jsonFromObject = GsonUtils.getJsonFromObject(channels, new TypeToken<List<ChannelInfo>>() {
        }.getType());
        String createChannelResponse = httpRequestUtils.postData(getCreateMultipleChannelUrl(), "application/json", "application/json", jsonFromObject);
        Utils.printLog(context, TAG, "Create Multiple channel Response :" + createChannelResponse);
        MultipleChannelFeedApiResponse channelFeedApiResponse = (MultipleChannelFeedApiResponse) GsonUtils.getObjectFromJson(createChannelResponse, MultipleChannelFeedApiResponse.class);
        if (channelFeedApiResponse != null && channelFeedApiResponse.isSuccess()) {
            channelFeeds = channelFeedApiResponse.getResponse();
        }
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
    return channelFeeds;
}
Also used : TypeToken(com.google.gson.reflect.TypeToken) ChannelInfo(com.applozic.mobicomkit.api.people.ChannelInfo) SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed) MultipleChannelFeedApiResponse(com.applozic.mobicomkit.MultipleChannelFeedApiResponse)

Aggregations

MultipleChannelFeedApiResponse (com.applozic.mobicomkit.MultipleChannelFeedApiResponse)1 ChannelInfo (com.applozic.mobicomkit.api.people.ChannelInfo)1 ChannelFeed (com.applozic.mobicomkit.feed.ChannelFeed)1 SyncChannelFeed (com.applozic.mobicomkit.sync.SyncChannelFeed)1 TypeToken (com.google.gson.reflect.TypeToken)1