use of com.applozic.mobicomkit.feed.ChannelFeedListResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelClientService method getGroupInfoFromGroupIds.
public ChannelFeedListResponse getGroupInfoFromGroupIds(List<String> groupIds, List<String> clientGroupIds) {
ChannelFeedListResponse apiResponse = null;
try {
StringBuilder parameters = new StringBuilder("?");
if (groupIds != null) {
for (String groupId : groupIds) {
if (!TextUtils.isEmpty(groupId)) {
parameters.append(GROUPIDS + "=" + groupId + "&");
}
}
}
if (clientGroupIds != null) {
for (String clientGroupId : clientGroupIds) {
if (!TextUtils.isEmpty(clientGroupId)) {
if (groupIds != null && groupIds.contains(clientGroupId)) {
continue;
} else {
parameters.append(CLIENT_GROUPIDs + "=" + clientGroupId + "&");
}
}
}
}
String url = getGroupInfoFromGroupIdsUrl() + parameters;
String response = httpRequestUtils.getResponse(url, "application/json", "application/json");
apiResponse = (ChannelFeedListResponse) GsonUtils.getObjectFromJson(response, ChannelFeedListResponse.class);
if (apiResponse != null) {
Utils.printLog(context, TAG, "Group Info from groupIds/clientGroupIds response : " + apiResponse.getStatus());
}
} catch (Exception e) {
Utils.printLog(context, TAG, e.getMessage());
}
return apiResponse;
}
use of com.applozic.mobicomkit.feed.ChannelFeedListResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelService method getMembersFromContactGroupList.
public ChannelFeed[] getMembersFromContactGroupList(List<String> groupIdList, List<String> groupNames, String groupType) {
List<ChannelFeed> channelFeedList;
ChannelFeedListResponse channelFeedListResponse = channelClientService.getMemebersFromContactGroupIds(groupIdList, groupNames, groupType);
if (channelFeedListResponse != null && channelFeedListResponse.getStatus().equals(ChannelFeedListResponse.SUCCESS)) {
channelFeedList = channelFeedListResponse.getResponse();
processChannelFeedList(channelFeedList.toArray(new ChannelFeed[channelFeedList.size()]), false);
return channelFeedList.toArray(new ChannelFeed[channelFeedList.size()]);
}
return null;
}
use of com.applozic.mobicomkit.feed.ChannelFeedListResponse in project Applozic-Android-SDK by AppLozic.
the class AlGetMembersFromContactGroupListTask method doInBackground.
@Override
protected AlGetMembersModel doInBackground(Void... voids) {
AlGetMembersModel model = new AlGetMembersModel();
try {
ChannelFeedListResponse response = ChannelClientService.getInstance(context.get()).getMemebersFromContactGroupIds(groupIds, groupNames, groupType);
if (response != null) {
if (ChannelFeedListResponse.SUCCESS.equals(response.getStatus())) {
Set<String> contactIds = new HashSet<String>();
if (!response.getResponse().isEmpty()) {
ChannelService.getInstance(context.get()).processChannelFeedList(response.getResponse().toArray(new ChannelFeed[response.getResponse().size()]), false);
for (ChannelFeed feed : response.getResponse()) {
contactIds.addAll(feed.getContactGroupMembersId());
}
model.setMembers(contactIds.toArray(new String[contactIds.size()]));
UserService.getInstance(context.get()).processUserDetailsByUserIds(contactIds);
model.setResponse("Successfully fetched");
}
} else if (response.getErrorResponse() != null) {
model.setResponse(GsonUtils.getJsonFromObject(response.getErrorResponse(), ErrorResponseFeed[].class));
}
} else {
model.setResponse("Some Error occurred");
}
} catch (Exception e) {
e.printStackTrace();
model.setException(e);
}
return model;
}
use of com.applozic.mobicomkit.feed.ChannelFeedListResponse in project Applozic-Android-SDK by AppLozic.
the class ChannelClientService method getMemebersFromContactGroupIds.
public ChannelFeedListResponse getMemebersFromContactGroupIds(List<String> groupIds, List<String> groupNames, String groupType) {
ChannelFeedListResponse channelFeedListResponse = null;
try {
StringBuilder parameters = new StringBuilder("?");
if (!TextUtils.isEmpty(groupType)) {
parameters.append(GROUPTYPE + "=" + groupType + "&");
}
if (groupIds != null) {
for (String groupId : groupIds) {
if (!TextUtils.isEmpty(groupId)) {
parameters.append(GROUP_ID + "=" + groupId + "&");
}
}
}
if (groupNames != null) {
for (String groupName : groupNames) {
if (!TextUtils.isEmpty(groupName)) {
parameters.append(GROUP_NAME + "=" + groupName + "&");
}
}
}
String url = getMembersFromContactGroupListUrl() + parameters;
String response = httpRequestUtils.getResponse(url, "application/json", "application/json");
channelFeedListResponse = (ChannelFeedListResponse) GsonUtils.getObjectFromJson(response, ChannelFeedListResponse.class);
if (channelFeedListResponse != null) {
Utils.printLog(context, TAG, "Get Memebers from Contact Group List of Type Response : " + channelFeedListResponse.getStatus());
}
} catch (Exception e) {
e.printStackTrace();
}
return channelFeedListResponse;
}
Aggregations