I want to retrieve the list of channels for a user containing unread messages. The best solution I have found so far (please correct me if I'm wrong) is using channel descriptors.
// Example for a single page
client.getUserChannelDescriptors().then(function(paginator) {
for (var i = 0; i < paginator.items.length; i++) {
var descriptor = paginator.items[i].descriptor;
if (descriptor.unread_messages_count > 0) {
console.log("Channel found, id: " + descriptor.uniqueName);
}
}
});
My question: is there a way to order in the paginator object so I could retrieve channels with unread messages first so I wouldn't have to go through the whole list of channels?