1 | <?php |
||
18 | class Client |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * WooCommerce REST API Client version. |
||
23 | */ |
||
24 | const VERSION = '3.0.0'; |
||
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 | * POST method. |
||
48 | * |
||
49 | * @param string $endpoint API endpoint. |
||
50 | * @param array $data Request data. |
||
51 | * |
||
52 | * @return \stdClass |
||
53 | */ |
||
54 | public function post($endpoint, $data) |
||
58 | |||
59 | /** |
||
60 | * PUT method. |
||
61 | * |
||
62 | * @param string $endpoint API endpoint. |
||
63 | * @param array $data Request data. |
||
64 | * |
||
65 | * @return \stdClass |
||
66 | */ |
||
67 | public function put($endpoint, $data) |
||
71 | |||
72 | /** |
||
73 | * GET method. |
||
74 | * |
||
75 | * @param string $endpoint API endpoint. |
||
76 | * @param array $parameters Request parameters. |
||
77 | * |
||
78 | * @return \stdClass |
||
79 | */ |
||
80 | public function get($endpoint, $parameters = []) |
||
84 | |||
85 | /** |
||
86 | * DELETE method. |
||
87 | * |
||
88 | * @param string $endpoint API endpoint. |
||
89 | * @param array $parameters Request parameters. |
||
90 | * |
||
91 | * @return \stdClass |
||
92 | */ |
||
93 | public function delete($endpoint, $parameters = []) |
||
97 | |||
98 | /** |
||
99 | * OPTIONS method. |
||
100 | * |
||
101 | * @param string $endpoint API endpoint. |
||
102 | * |
||
103 | * @return \stdClass |
||
104 | */ |
||
105 | public function options($endpoint) |
||
109 | } |
||
110 |