use of im.actor.core.api.rpc.RequestLoadMembers in project actor-platform by actorapp.
the class GroupsModule method loadMembers.
public Promise<GroupMembersSlice> loadMembers(int gid, int limit, byte[] next) {
return getGroups().getValueAsync(gid).flatMap(group -> api(new RequestLoadMembers(new ApiGroupOutPeer(group.getGroupId(), group.getAccessHash()), limit, next))).chain(r -> updates().loadRequiredPeers(r.getUsers(), new ArrayList<>())).map(r -> {
ArrayList<GroupMember> members = new ArrayList<>();
for (ApiMember p : r.getMembers()) {
boolean isAdmin = p.isAdmin() != null ? p.isAdmin() : false;
members.add(new GroupMember(p.getUid(), p.getInviterUid(), p.getInviterUid(), isAdmin));
}
return new GroupMembersSlice(members, r.getNext());
});
}
Aggregations