Add customer search method with filters and pagination to endpoint

- Introduced `search` method in `economic_customers_endpoint` to retrieve customers based on filters and pagination parameters.
- Enhanced response handling with JSON decoding for structured data retrieval.
This commit is contained in:
Jeppe Bundgaard
2025-10-06 16:38:11 +02:00
parent f59852375f
commit 276ad2154f
@@ -22,6 +22,21 @@ class economic_customers_endpoint
return json_decode($response);
}
/**
* Get customers by filters
* @param array $filters Example: ['filter' => 'value']
* @param array $pagination Example: ['maxPageSize' => 100, 'skipPages' => 0]
* @return object {collection: [product], pagination: {maxPageSize: number, skipPages: number, results: number}}
*/
public function search(array $filters = [], array $pagination = []): object
{
$response = $this->send_request(
'/customers/?filter=' . self::filters($filters) . self::pagination($pagination),
'GET');
// Return the response as an object
return json_decode($response);
}
/**
* Does a customer exist?
* @param int $customer_number