| 1 |
<?php |
| 2 |
/** |
| 3 |
* Optional fast-path contract for a catalog proxy behavior. |
| 4 |
* |
| 5 |
* @package WCPOS\WooCommercePOS\API\V2\Proxy |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WCPOS\WooCommercePOS\API\V2\Proxy; |
| 9 |
|
| 10 |
use WP_REST_Request; |
| 11 |
use WP_REST_Response; |
| 12 |
|
| 13 |
/** |
| 14 |
* Lets a behavior answer one narrow request shape without the wc/v3 forward. |
| 15 |
* |
| 16 |
* A separate interface rather than a new {@see Proxy_Behavior} method, so |
| 17 |
* existing Proxy_Behavior implementations outside this plugin keep working. |
| 18 |
*/ |
| 19 |
interface Fast_Path_Behavior { |
| 20 |
/** |
| 21 |
* Answer the request directly when it is this behavior's fast-path shape. |
| 22 |
* |
| 23 |
* The response is returned as-is: no wc/v3 forward, no |
| 24 |
* `woocommerce_pos_sync_proxy_response` filter, no post-processing. |
| 25 |
* |
| 26 |
* @param WP_REST_Request $request Original proxy request. |
| 27 |
* |
| 28 |
* @return null|WP_REST_Response Null when the request is not the fast-path shape. |
| 29 |
*/ |
| 30 |
public function fast_response( WP_REST_Request $request ): ?WP_REST_Response; |
| 31 |
} |
| 32 |
|