1 | <?php namespace Pixelpeter\Woocommerce; |
||
8 | class WoocommerceClient |
||
9 | { |
||
10 | /** |
||
11 | * @var \Automattic\WooCommerce\Client |
||
12 | */ |
||
13 | protected $client; |
||
14 | |||
15 | /** |
||
16 | * @var bool |
||
17 | */ |
||
18 | protected $usingLowerCaseHeaders = false; |
||
19 | |||
20 | /** |
||
21 | */ |
||
22 | public function __construct(Client $client) |
||
26 | |||
27 | /** |
||
28 | * POST method. |
||
29 | * |
||
30 | * @param string $endpoint API endpoint. |
||
31 | * @param array $data Request data. |
||
32 | * |
||
33 | * @return array |
||
34 | */ |
||
35 | public function post($endpoint, $data) |
||
39 | |||
40 | /** |
||
41 | * PUT method. |
||
42 | * |
||
43 | * @param string $endpoint API endpoint. |
||
44 | * @param array $data Request data. |
||
45 | * |
||
46 | * @return array |
||
47 | */ |
||
48 | public function put($endpoint, $data) |
||
52 | |||
53 | /** |
||
54 | * GET method. |
||
55 | * |
||
56 | * @param string $endpoint API endpoint. |
||
57 | * @param array $parameters Request parameters. |
||
58 | * |
||
59 | * @return array |
||
60 | */ |
||
61 | public function get($endpoint, $parameters = []) |
||
65 | |||
66 | /** |
||
67 | * DELETE method. |
||
68 | * |
||
69 | * @param string $endpoint API endpoint. |
||
70 | * @param array $parameters Request parameters. |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | public function delete($endpoint, $parameters = []) |
||
78 | |||
79 | /** |
||
80 | * Get the http request header from the last request |
||
81 | * |
||
82 | * @return \Automattic\WooCommerce\HttpClient\Request |
||
83 | */ |
||
84 | public function getRequest() |
||
88 | |||
89 | /** |
||
90 | * Get the http response headers from the last request |
||
91 | * |
||
92 | * @return \Automattic\WooCommerce\HttpClient\Response |
||
93 | */ |
||
94 | public function getResponse() |
||
98 | |||
99 | /** |
||
100 | * Return the first page number of the result |
||
101 | * |
||
102 | * @return int |
||
103 | */ |
||
104 | public function firstPage() |
||
108 | |||
109 | /** |
||
110 | * Return the last page number of the result |
||
111 | * |
||
112 | * @return int |
||
113 | */ |
||
114 | public function lastPage() |
||
118 | |||
119 | /** |
||
120 | * Return the current page number of the result |
||
121 | * |
||
122 | * @return int |
||
123 | */ |
||
124 | public function currentPage() |
||
128 | |||
129 | /** |
||
130 | * Return the total number of results |
||
131 | * |
||
132 | * @return int |
||
133 | */ |
||
134 | public function totalResults() |
||
138 | |||
139 | /** |
||
140 | * Return the total number of pages for this result |
||
141 | * |
||
142 | * @return mixed |
||
143 | */ |
||
144 | public function totalPages() |
||
148 | |||
149 | /** |
||
150 | * Return the previous page number for the current page |
||
151 | * Will be null if there's no previous page |
||
152 | * |
||
153 | * @return int|null |
||
154 | */ |
||
155 | public function previousPage() |
||
164 | |||
165 | /** |
||
166 | * Return the next page number for the current page |
||
167 | * Will be null if there's no next page |
||
168 | * |
||
169 | * @return int|null |
||
170 | */ |
||
171 | public function nextPage() |
||
180 | |||
181 | /** |
||
182 | * Returns true if there's a next page |
||
183 | * |
||
184 | * @return bool |
||
185 | */ |
||
186 | public function hasNextPage() |
||
190 | |||
191 | /** |
||
192 | * Returns true if there's a previous page |
||
193 | * |
||
194 | * @return bool |
||
195 | */ |
||
196 | public function hasPreviousPage() |
||
200 | |||
201 | /** |
||
202 | * Returns true if there's no next page |
||
203 | * |
||
204 | * @return bool |
||
205 | */ |
||
206 | public function hasNotNextPage() |
||
210 | |||
211 | /** |
||
212 | * Returns true if there's no previous page |
||
213 | * |
||
214 | * @return bool |
||
215 | */ |
||
216 | public function hasNotPreviousPage() |
||
220 | |||
221 | /** |
||
222 | * Set if headers should be indexed using lower case |
||
223 | */ |
||
224 | public function useLowerCaseHeaders() |
||
228 | |||
229 | /** |
||
230 | * Set if headers should be case sensitive |
||
231 | */ |
||
232 | public function useCaseSensitiveHeaders() |
||
236 | |||
237 | /** |
||
238 | * Convert header to correct case |
||
239 | * |
||
240 | * @param $header |
||
241 | * |
||
242 | * @return string |
||
243 | */ |
||
244 | public function getHeaderWithCase($header) { |
||
247 | } |
||
248 |