From 8a084deee559b6d5bff8ff39dac1b785ef2abe1d Mon Sep 17 00:00:00 2001 From: Dentax Date: Tue, 7 Dec 2021 14:13:55 +0100 Subject: [PATCH] Implements Pagination Implements the missing pagination for customers. --- src/Endpoint/CustomersEndpoint.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Endpoint/CustomersEndpoint.php b/src/Endpoint/CustomersEndpoint.php index f8ff79e..267045d 100644 --- a/src/Endpoint/CustomersEndpoint.php +++ b/src/Endpoint/CustomersEndpoint.php @@ -39,16 +39,23 @@ public function __construct(ClientInterface $client, SerializerInterface $serial /** * Get a list of all customers * + * @param int $page The start page + * @param int $pageSize The page size * @return Response\GetCustomersResponse The Response * * @throws QuotaExceededException If the maximum number of calls per second exceeded * @throws Exception If the response cannot be parsed */ - public function getCustomers() + public function getCustomers($page = 1, $pageSize = 50) { + $query = [ + 'page' => max(1, $page), + 'pageSize' => max(1, $pageSize), + ]; + return $this->client->get( 'customers', - [], + $query, Response\GetCustomersResponse::class ); }