@@ 153-231 (lines=79) @@ | ||
150 | * |
|
151 | * @return array |
|
152 | */ |
|
153 | public function get_item_schema() { |
|
154 | $schema = array( |
|
155 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
156 | 'title' => 'customer_download', |
|
157 | 'type' => 'object', |
|
158 | 'properties' => array( |
|
159 | 'download_url' => array( |
|
160 | 'description' => __( 'Download file URL.', 'woocommerce' ), |
|
161 | 'type' => 'string', |
|
162 | 'context' => array( 'view' ), |
|
163 | 'readonly' => true, |
|
164 | ), |
|
165 | 'download_id' => array( |
|
166 | 'description' => __( 'Download ID (MD5).', 'woocommerce' ), |
|
167 | 'type' => 'string', |
|
168 | 'context' => array( 'view' ), |
|
169 | 'readonly' => true, |
|
170 | ), |
|
171 | 'product_id' => array( |
|
172 | 'description' => __( 'Downloadable product ID.', 'woocommerce' ), |
|
173 | 'type' => 'integer', |
|
174 | 'context' => array( 'view' ), |
|
175 | 'readonly' => true, |
|
176 | ), |
|
177 | 'download_name' => array( |
|
178 | 'description' => __( 'Downloadable file name.', 'woocommerce' ), |
|
179 | 'type' => 'string', |
|
180 | 'context' => array( 'view' ), |
|
181 | 'readonly' => true, |
|
182 | ), |
|
183 | 'order_id' => array( |
|
184 | 'description' => __( 'Order ID.', 'woocommerce' ), |
|
185 | 'type' => 'integer', |
|
186 | 'context' => array( 'view' ), |
|
187 | 'readonly' => true, |
|
188 | ), |
|
189 | 'order_key' => array( |
|
190 | 'description' => __( 'Order key.', 'woocommerce' ), |
|
191 | 'type' => 'string', |
|
192 | 'context' => array( 'view' ), |
|
193 | 'readonly' => true, |
|
194 | ), |
|
195 | 'downloads_remaining' => array( |
|
196 | 'description' => __( 'Amount of downloads remaining.', 'woocommerce' ), |
|
197 | 'type' => 'string', |
|
198 | 'context' => array( 'view' ), |
|
199 | 'readonly' => true, |
|
200 | ), |
|
201 | 'access_expires' => array( |
|
202 | 'description' => __( "The date when the download access expires, in the site's timezone.", 'woocommerce' ), |
|
203 | 'type' => 'string', |
|
204 | 'context' => array( 'view' ), |
|
205 | 'readonly' => true, |
|
206 | ), |
|
207 | 'file' => array( |
|
208 | 'description' => __( 'File details.', 'woocommerce' ), |
|
209 | 'type' => 'array', |
|
210 | 'context' => array( 'view' ), |
|
211 | 'readonly' => true, |
|
212 | 'properties' => array( |
|
213 | 'name' => array( |
|
214 | 'description' => __( 'File name.', 'woocommerce' ), |
|
215 | 'type' => 'string', |
|
216 | 'context' => array( 'view' ), |
|
217 | 'readonly' => true, |
|
218 | ), |
|
219 | 'file' => array( |
|
220 | 'description' => __( 'File URL.', 'woocommerce' ), |
|
221 | 'type' => 'string', |
|
222 | 'context' => array( 'view' ), |
|
223 | 'readonly' => true, |
|
224 | ), |
|
225 | ), |
|
226 | ), |
|
227 | ), |
|
228 | ); |
|
229 | ||
230 | return $this->add_additional_fields_schema( $schema ); |
|
231 | } |
|
232 | ||
233 | /** |
|
234 | * Get the query params for collections. |
@@ 286-362 (lines=77) @@ | ||
283 | * |
|
284 | * @return array |
|
285 | */ |
|
286 | public function get_item_schema() { |
|
287 | $schema = array( |
|
288 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
289 | 'title' => 'sales_report', |
|
290 | 'type' => 'object', |
|
291 | 'properties' => array( |
|
292 | 'total_sales' => array( |
|
293 | 'description' => __( 'Gross sales in the period.', 'woocommerce' ), |
|
294 | 'type' => 'string', |
|
295 | 'context' => array( 'view' ), |
|
296 | 'readonly' => true, |
|
297 | ), |
|
298 | 'net_sales' => array( |
|
299 | 'description' => __( 'Net sales in the period.', 'woocommerce' ), |
|
300 | 'type' => 'string', |
|
301 | 'context' => array( 'view' ), |
|
302 | 'readonly' => true, |
|
303 | ), |
|
304 | 'average_sales' => array( |
|
305 | 'description' => __( 'Average net daily sales.', 'woocommerce' ), |
|
306 | 'type' => 'string', |
|
307 | 'context' => array( 'view' ), |
|
308 | 'readonly' => true, |
|
309 | ), |
|
310 | 'total_orders' => array( |
|
311 | 'description' => __( 'Total of orders placed.', 'woocommerce' ), |
|
312 | 'type' => 'integer', |
|
313 | 'context' => array( 'view' ), |
|
314 | 'readonly' => true, |
|
315 | ), |
|
316 | 'total_items' => array( |
|
317 | 'description' => __( 'Total of items purchased.', 'woocommerce' ), |
|
318 | 'type' => 'integer', |
|
319 | 'context' => array( 'view' ), |
|
320 | 'readonly' => true, |
|
321 | ), |
|
322 | 'total_tax' => array( |
|
323 | 'description' => __( 'Total charged for taxes.', 'woocommerce' ), |
|
324 | 'type' => 'string', |
|
325 | 'context' => array( 'view' ), |
|
326 | 'readonly' => true, |
|
327 | ), |
|
328 | 'total_shipping' => array( |
|
329 | 'description' => __( 'Total charged for shipping.', 'woocommerce' ), |
|
330 | 'type' => 'string', |
|
331 | 'context' => array( 'view' ), |
|
332 | 'readonly' => true, |
|
333 | ), |
|
334 | 'total_refunds' => array( |
|
335 | 'description' => __( 'Total of refunded orders.', 'woocommerce' ), |
|
336 | 'type' => 'integer', |
|
337 | 'context' => array( 'view' ), |
|
338 | 'readonly' => true, |
|
339 | ), |
|
340 | 'total_discount' => array( |
|
341 | 'description' => __( 'Total of coupons used.', 'woocommerce' ), |
|
342 | 'type' => 'integer', |
|
343 | 'context' => array( 'view' ), |
|
344 | 'readonly' => true, |
|
345 | ), |
|
346 | 'totals_grouped_by' => array( |
|
347 | 'description' => __( 'Group type.', 'woocommerce' ), |
|
348 | 'type' => 'string', |
|
349 | 'context' => array( 'view' ), |
|
350 | 'readonly' => true, |
|
351 | ), |
|
352 | 'totals' => array( |
|
353 | 'description' => __( 'Totals.', 'woocommerce' ), |
|
354 | 'type' => 'array', |
|
355 | 'context' => array( 'view' ), |
|
356 | 'readonly' => true, |
|
357 | ), |
|
358 | ), |
|
359 | ); |
|
360 | ||
361 | return $this->add_additional_fields_schema( $schema ); |
|
362 | } |
|
363 | ||
364 | /** |
|
365 | * Get the query params for collections. |