From 76d75542fd26214f8ece1f11c82327b47fcb82e1 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Mon, 1 Jun 2015 00:19:03 +0300 Subject: [PATCH] Get user subscribers by id. --- .../PointToolsBundle/Service/UserApi.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php b/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php index 352d1cc..5de211f 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php @@ -59,6 +59,25 @@ class UserApi extends AbstractApi return $users; } + /** + * Get user subscribers by user id + * + * @param int $id + * @return User[] + */ + public function getUserSubscribersById($id) + { + if (!is_numeric($id)) { + throw new \InvalidArgumentException('$id must be an integer'); + } + + $usersList = $this->getGetRequestData('/api/user/id/' . (int) $id . '/subscribers', [], true); + + $users = $this->getUsersFromList($usersList); + + return $users; + } + /** * @return User[] */