interface-wc-api-handler.php 841 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. if ( ! defined( 'ABSPATH' ) ) {
  13. exit; // Exit if accessed directly
  14. }
  15. interface WC_API_Handler {
  16. /**
  17. * Get the content type for the response
  18. *
  19. * This should return the proper HTTP content-type for the response
  20. *
  21. * @since 2.1
  22. * @return string
  23. */
  24. public function get_content_type();
  25. /**
  26. * Parse the raw request body entity into an array
  27. *
  28. * @since 2.1
  29. * @param string $data
  30. * @return array
  31. */
  32. public function parse_body( $data );
  33. /**
  34. * Generate a response from an array of data
  35. *
  36. * @since 2.1
  37. * @param array $data
  38. * @return string
  39. */
  40. public function generate_response( $data );
  41. }