1 | <?php |
||
18 | class Client |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * WooCommerce REST API Client version. |
||
23 | */ |
||
24 | const VERSION = '1.1.3'; |
||
25 | |||
26 | /** |
||
27 | * HttpClient instance. |
||
28 | * |
||
29 | * @var HttpClient |
||
30 | */ |
||
31 | public $http; |
||
32 | |||
33 | /** |
||
34 | * Initialize client. |
||
35 | * |
||
36 | * @param string $url Store URL. |
||
37 | * @param string $consumerKey Consumer key. |
||
38 | * @param string $consumerSecret Consumer secret. |
||
39 | * @param array $options Options (version, timeout, verify_ssl). |
||
40 | */ |
||
41 | public function __construct($url, $consumerKey, $consumerSecret, $options = []) |
||
45 | |||
46 | /** |
||
47 | * Get headers from last response |
||
48 | * @return array |
||
49 | */ |
||
50 | public function getHeaders() |
||
56 | |||
57 | /** |
||
58 | * POST method. |
||
59 | * |
||
60 | * @param string $endpoint API endpoint. |
||
61 | * @param array $data Request data. |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | public function post($endpoint, $data) |
||
69 | |||
70 | /** |
||
71 | * PUT method. |
||
72 | * |
||
73 | * @param string $endpoint API endpoint. |
||
74 | * @param array $data Request data. |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | public function put($endpoint, $data) |
||
82 | |||
83 | /** |
||
84 | * GET method. |
||
85 | * |
||
86 | * @param string $endpoint API endpoint. |
||
87 | * @param array $parameters Request parameters. |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | public function get($endpoint, $parameters = []) |
||
95 | |||
96 | /** |
||
97 | * DELETE method. |
||
98 | * |
||
99 | * @param string $endpoint API endpoint. |
||
100 | * @param array $parameters Request parameters. |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | public function delete($endpoint, $parameters = []) |
||
108 | |||
109 | /** |
||
110 | * OPTIONS method. |
||
111 | * |
||
112 | * @param string $endpoint API endpoint. |
||
113 | * |
||
114 | * @return array |
||
115 | */ |
||
116 | public function options($endpoint) |
||
120 | } |
||
121 |