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:
+15
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user