From 8624980484c5cebad90106628ddabfb4c5711f60 Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Wed, 7 Aug 2024 20:58:28 +0200 Subject: [PATCH 1/3] Allow paged filter --- src/Picqer/Financials/Moneybird/Actions/Filterable.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Picqer/Financials/Moneybird/Actions/Filterable.php b/src/Picqer/Financials/Moneybird/Actions/Filterable.php index 4d99be2..05d7572 100644 --- a/src/Picqer/Financials/Moneybird/Actions/Filterable.php +++ b/src/Picqer/Financials/Moneybird/Actions/Filterable.php @@ -11,18 +11,24 @@ trait Filterable /** * @param array $filters + * @param int|null $perPage Number of results per page + * @param int|null $page Page to load, typically starts at 1 * @return mixed * * @throws \Picqer\Financials\Moneybird\Exceptions\ApiException */ - public function filter(array $filters) + public function filter(array $filters, ?int $perPage = null, ?int $page = null) { $filterList = []; foreach ($filters as $key => $value) { $filterList[] = $key . ':' . $value; } - $result = $this->connection()->get($this->getFilterEndpoint(), ['filter' => implode(',', $filterList)]); + $result = $this->connection()->get($this->getFilterEndpoint(), [ + 'filter' => implode(',', $filterList), + 'per_page' => $perPage, + 'page' => $page, + ], false); return $this->collectionFromResult($result); } From 542bc578e1cac88c495d35363bb2779af4152db6 Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Wed, 7 Aug 2024 21:10:39 +0200 Subject: [PATCH 2/3] Update Filterable.php --- src/Picqer/Financials/Moneybird/Actions/Filterable.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Picqer/Financials/Moneybird/Actions/Filterable.php b/src/Picqer/Financials/Moneybird/Actions/Filterable.php index 05d7572..4c609df 100644 --- a/src/Picqer/Financials/Moneybird/Actions/Filterable.php +++ b/src/Picqer/Financials/Moneybird/Actions/Filterable.php @@ -11,13 +11,13 @@ trait Filterable /** * @param array $filters - * @param int|null $perPage Number of results per page - * @param int|null $page Page to load, typically starts at 1 + * @param int|null $perPage Number of results per page + * @param int|null $page Page to load, typically starts at 1 * @return mixed * * @throws \Picqer\Financials\Moneybird\Exceptions\ApiException */ - public function filter(array $filters, ?int $perPage = null, ?int $page = null) + public function filter(array $filters, $perPage = null, $page = null) { $filterList = []; foreach ($filters as $key => $value) { @@ -27,7 +27,7 @@ public function filter(array $filters, ?int $perPage = null, ?int $page = null) $result = $this->connection()->get($this->getFilterEndpoint(), [ 'filter' => implode(',', $filterList), 'per_page' => $perPage, - 'page' => $page, + 'page' => $page, ], false); return $this->collectionFromResult($result); From e75f8646ceeea504950a2db8e849fab321f037c1 Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Wed, 7 Aug 2024 21:11:11 +0200 Subject: [PATCH 3/3] Update Filterable.php --- src/Picqer/Financials/Moneybird/Actions/Filterable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Picqer/Financials/Moneybird/Actions/Filterable.php b/src/Picqer/Financials/Moneybird/Actions/Filterable.php index 4c609df..3b9f62d 100644 --- a/src/Picqer/Financials/Moneybird/Actions/Filterable.php +++ b/src/Picqer/Financials/Moneybird/Actions/Filterable.php @@ -11,8 +11,8 @@ trait Filterable /** * @param array $filters - * @param int|null $perPage Number of results per page - * @param int|null $page Page to load, typically starts at 1 + * @param int|null $perPage Number of results per page + * @param int|null $page Page to load, typically starts at 1 * @return mixed * * @throws \Picqer\Financials\Moneybird\Exceptions\ApiException