| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | import apiFetch from '@wordpress/api-fetch'; |
| 2 | +import { addQueryArgs } from '@wordpress/url'; | |
| 3 | + | |
| 2 | 4 | import APIError from './exceptions/APIError'; |
| 3 | 5 | |
| 4 | 6 | const v1Prefix = '/image-optimizer/v1'; |
| 5 | 7 | |
| @@ -51,8 +53,19 @@ | ||
| 51 | 53 | path: `${ v1Prefix }/optimize/status`, |
| 52 | 54 | data: { |
| 53 | 55 | image_ids: imageIds, |
| 54 | 56 | }, |
| 57 | + } ); | |
| 58 | + } | |
| 59 | + | |
| 60 | + static async getOptimizationDetails( imageId ) { | |
| 61 | + const queryParams = { | |
| 62 | + image_id: imageId, | |
| 63 | + }; | |
| 64 | + | |
| 65 | + return API.request( { | |
| 66 | + method: 'GET', | |
| 67 | + path: addQueryArgs( `${ v1Prefix }/stats/optimization-details`, queryParams ), | |
| 55 | 68 | } ); |
| 56 | 69 | } |
| 57 | 70 | } |
| 58 | 71 | |