1 <?php
2 /**
3 * WooCommerce API
4 *
5 * Defines an interface that API request/response handlers should implement
6 *
7 * @author WooThemes
8 * @category API
9 * @package WooCommerce/API
10 * @since 2.1
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15 interface WC_API_Handler {
16
17 /**
18 * Get the content type for the response
19 *
20 * This should return the proper HTTP content-type for the response
21 *
22 * @since 2.1
23 * @return string
24 */
25 public function get_content_type();
26
27 /**
28 * Parse the raw request body entity into an array
29 *
30 * @since 2.1
31 * @param string $data
32 * @return array
33 */
34 public function parse_body( $data );
35
36 /**
37 * Generate a response from an array of data
38 *
39 * @since 2.1
40 * @param array $data
41 * @return string
42 */
43 public function generate_response( $data );
44
45 }
46