public static SearchDialogsResponse FromJson(VkResponse response)
{
var result = new SearchDialogsResponse
{
Users = new List<User>(),
Chats = new List<Chat>(),
Groups = new List<Group>()
};
VkResponseArray responseArray = response;
foreach (var record in responseArray)
{
string type = record["type"];
switch (type)
{
case "profile":
{
result.Users.Add(record);
break;
}
case "chat":
{
result.Chats.Add(record);
break;
}
case "email":
{
// TODO: Add email support.
continue;
}
case "group":
{
result.Groups.Add(record);
break;
}
default:
{
break;
}
}
}
return result;
}