From f4e23af0db3fbd9bbfa801bfb7ca1867cf088b36 Mon Sep 17 00:00:00 2001 From: johnkelesidis Date: Tue, 29 Aug 2023 17:21:53 +0300 Subject: [PATCH] Add params support to the get group subscribers call --- src/Endpoints/Group.php | 4 ++-- tests/Endpoints/GroupTest.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Endpoints/Group.php b/src/Endpoints/Group.php index 85b3f6b..fd607e2 100644 --- a/src/Endpoints/Group.php +++ b/src/Endpoints/Group.php @@ -67,10 +67,10 @@ public function delete(string $groupId): array /** * @return array */ - public function getSubscribers(string $groupId): array + public function getSubscribers(string $groupId, array $params = []): array { return $this->httpLayer->get( - $this->buildUri($this->endpoint) . "/{$groupId}/subscribers" + $this->buildUri($this->endpoint . "/{$groupId}/subscribers", $params) ); } diff --git a/tests/Endpoints/GroupTest.php b/tests/Endpoints/GroupTest.php index 2665265..d362668 100644 --- a/tests/Endpoints/GroupTest.php +++ b/tests/Endpoints/GroupTest.php @@ -88,6 +88,18 @@ public function test_get_group_subscribers() self::assertEquals("/api/groups/{$this->groupId}/subscribers", $request->getUri()->getPath()); } + public function test_get_group_subscribers_pagination() + { + $this->groups->getSubscribers($this->groupId, [ + 'cursor' => 'next_page_cursor' + ]); + + $request = $this->client->getLastRequest(); + + self::assertEquals('GET', $request->getMethod()); + self::assertEquals("cursor=next_page_cursor", $request->getUri()->getQuery()); + } + public function test_assign_subscriber_to_group() { $subscriberId = '4567';