| 1 |
<?php |
| 2 |
/** |
| 3 |
* Per-resource catalog proxy contract. |
| 4 |
* |
| 5 |
* @package WCPOS\WooCommercePOS\API\V2\Proxy |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WCPOS\WooCommercePOS\API\V2\Proxy; |
| 9 |
|
| 10 |
use WP_REST_Request; |
| 11 |
|
| 12 |
/** |
| 13 |
* Vary only the three resource-specific phases of a catalog proxy read. |
| 14 |
*/ |
| 15 |
interface Proxy_Behavior { |
| 16 |
/** |
| 17 |
* Adjust query parameters before forwarding them to wc/v3. |
| 18 |
* |
| 19 |
* @param array $params Query parameters to forward. |
| 20 |
* @param WP_REST_Request $request Original proxy request. |
| 21 |
* |
| 22 |
* @return array |
| 23 |
*/ |
| 24 |
public function forwarded_params( array $params, WP_REST_Request $request ): array; |
| 25 |
|
| 26 |
/** |
| 27 |
* Install resource hooks around one forward and unwind them afterward. |
| 28 |
* |
| 29 |
* @param callable $forward Forward operation. |
| 30 |
* |
| 31 |
* @return mixed |
| 32 |
*/ |
| 33 |
public function around( callable $forward ); |
| 34 |
|
| 35 |
/** |
| 36 |
* Apply resource-specific response shaping. |
| 37 |
* |
| 38 |
* @param mixed $data Response data. |
| 39 |
* |
| 40 |
* @return mixed |
| 41 |
*/ |
| 42 |
public function post_process( $data ); |
| 43 |
} |
| 44 |
|