interface-wc-api-handler.php 861 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * @version 2.1
  12. */
  13. if ( ! defined( 'ABSPATH' ) ) {
  14. exit; // Exit if accessed directly
  15. }
  16. interface WC_API_Handler {
  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. * Parse the raw request body entity into an array
  28. *
  29. * @since 2.1
  30. * @param string $data
  31. * @return array
  32. */
  33. public function parse_body( $data );
  34. /**
  35. * Generate a response from an array of data
  36. *
  37. * @since 2.1
  38. * @param array $data
  39. * @return string
  40. */
  41. public function generate_response( $data );
  42. }