1 | <?php namespace Pixelpeter\Woocommerce; |
||
8 | class WoocommerceClient |
||
9 | { |
||
10 | /** |
||
11 | * @var \Automattic\WooCommerce\Client |
||
12 | */ |
||
13 | protected $client; |
||
14 | |||
15 | /** |
||
16 | */ |
||
17 | public function __construct(Client $client) |
||
21 | |||
22 | /** |
||
23 | * POST method. |
||
24 | * |
||
25 | * @param string $endpoint API endpoint. |
||
26 | * @param array $data Request data. |
||
27 | * |
||
28 | * @return array |
||
29 | */ |
||
30 | public function post($endpoint, $data) |
||
34 | |||
35 | /** |
||
36 | * PUT method. |
||
37 | * |
||
38 | * @param string $endpoint API endpoint. |
||
39 | * @param array $data Request data. |
||
40 | * |
||
41 | * @return array |
||
42 | */ |
||
43 | public function put($endpoint, $data) |
||
47 | |||
48 | /** |
||
49 | * GET method. |
||
50 | * |
||
51 | * @param string $endpoint API endpoint. |
||
52 | * @param array $parameters Request parameters. |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | public function get($endpoint, $parameters = []) |
||
60 | |||
61 | /** |
||
62 | * DELETE method. |
||
63 | * |
||
64 | * @param string $endpoint API endpoint. |
||
65 | * @param array $parameters Request parameters. |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | public function delete($endpoint, $parameters = []) |
||
73 | |||
74 | /** |
||
75 | * Get the http request header from the last request |
||
76 | * |
||
77 | * @return \Automattic\WooCommerce\HttpClient\Request |
||
78 | */ |
||
79 | public function getRequest() |
||
83 | |||
84 | /** |
||
85 | * Get the http response headers from the last request |
||
86 | * |
||
87 | * @return \Automattic\WooCommerce\HttpClient\Response |
||
88 | */ |
||
89 | public function getResponse() |
||
93 | |||
94 | /** |
||
95 | * Return the first page number of the result |
||
96 | * |
||
97 | * @return int |
||
98 | */ |
||
99 | public function firstPage() |
||
103 | |||
104 | /** |
||
105 | * Return the last page number of the result |
||
106 | * |
||
107 | * @return int |
||
108 | */ |
||
109 | public function lastPage() |
||
113 | |||
114 | /** |
||
115 | * Return the current page number of the result |
||
116 | * |
||
117 | * @return int |
||
118 | */ |
||
119 | public function currentPage() |
||
123 | |||
124 | /** |
||
125 | * Return the total number of results |
||
126 | * |
||
127 | * @return int |
||
128 | */ |
||
129 | public function totalResults() |
||
133 | |||
134 | /** |
||
135 | * Return the total number of pages for this result |
||
136 | * |
||
137 | * @return mixed |
||
138 | */ |
||
139 | public function totalPages() |
||
143 | |||
144 | /** |
||
145 | * Return the previous page number for the current page |
||
146 | * Will be null if there's no previous page |
||
147 | * |
||
148 | * @return int|null |
||
149 | */ |
||
150 | public function previousPage() |
||
159 | |||
160 | /** |
||
161 | * Return the next page number for the current page |
||
162 | * Will be null if there's no next page |
||
163 | * |
||
164 | * @return int|null |
||
165 | */ |
||
166 | public function nextPage() |
||
175 | |||
176 | /** |
||
177 | * Returns true if there's a next page |
||
178 | * |
||
179 | * @return bool |
||
180 | */ |
||
181 | public function hasNextPage() |
||
185 | |||
186 | /** |
||
187 | * Returns true if there's a previous page |
||
188 | * |
||
189 | * @return bool |
||
190 | */ |
||
191 | public function hasPreviousPage() |
||
195 | |||
196 | /** |
||
197 | * Returns true if there's no next page |
||
198 | * |
||
199 | * @return bool |
||
200 | */ |
||
201 | public function hasNotNextPage() |
||
205 | |||
206 | /** |
||
207 | * Returns true if there's no previous page |
||
208 | * |
||
209 | * @return bool |
||
210 | */ |
||
211 | public function hasNotPreviousPage() |
||
215 | } |
||
216 |