From 35bd3ad1e06c1636023c35922ed0440808d20e56 Mon Sep 17 00:00:00 2001 From: Dmitry Tretyakov <76806170+tretdm@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:31:26 +0700 Subject: [PATCH] VKAPI: add `counters` field in `Users.get` --- VKAPI/Handlers/Users.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/VKAPI/Handlers/Users.php b/VKAPI/Handlers/Users.php index d1c29705..a44fb06c 100644 --- a/VKAPI/Handlers/Users.php +++ b/VKAPI/Handlers/Users.php @@ -2,6 +2,7 @@ namespace openvk\VKAPI\Handlers; use openvk\Web\Models\Entities\{User, Report}; use openvk\Web\Models\Repositories\Users as UsersRepo; +use openvk\Web\Models\Repositories\{Photos, Clubs, Albums, Videos, Notes, Audios}; use openvk\Web\Models\Repositories\Reports; final class Users extends VKAPIRequestHandler @@ -180,7 +181,16 @@ final class Users extends VKAPIRequestHandler break; case "rating": $response[$i]->rating = $usr->getRating(); - break; + break; + case "counters": + $response[$i]->counters = (object) [ + "friends_count" => $usr->getFriendsCount(), + "photos_count" => (new Albums)->getUserPhotosCount($usr), + "videos_count" => (new Videos)->getUserVideosCount($usr), + "audios_count" => (new Audios)->getUserCollectionSize($usr), + "notes_count" => (new Notes)->getUserNotesCount($usr), + ]; + break; } }