@@ -31,6 +31,12 @@ public protocol ProductsRemoteProtocol {
3131 productCategory: ProductCategory ? ,
3232 excludedProductIDs: [ Int64 ] ,
3333 completion: @escaping ( Result < [ Product ] , Error > ) -> Void )
34+ func searchProductsBySKU( for siteID: Int64 ,
35+ keyword: String ,
36+ useLegacyEndpoint: Bool ,
37+ pageNumber: Int ,
38+ pageSize: Int ,
39+ completion: @escaping ( Result < [ Product ] , Error > ) -> Void )
3440 func searchSku( for siteID: Int64 ,
3541 sku: String ,
3642 completion: @escaping ( Result < String , Error > ) -> Void )
@@ -238,6 +244,23 @@ public final class ProductsRemote: Remote, ProductsRemoteProtocol {
238244 enqueue ( request, mapper: mapper, completion: completion)
239245 }
240246
247+ public func searchProductsBySKU( for siteID: Int64 ,
248+ keyword: String ,
249+ useLegacyEndpoint: Bool ,
250+ pageNumber: Int ,
251+ pageSize: Int ,
252+ completion: @escaping ( Result < [ Product ] , Error > ) -> Void ) {
253+ let parameters = [
254+ ParameterKey . sku: keyword,
255+ ParameterKey . page: String ( pageNumber) ,
256+ ParameterKey . perPage: String ( pageSize)
257+ ]
258+ let path = Path . products
259+ let request = JetpackRequest ( wooApiVersion: . mark3, method: . get, siteID: siteID, path: path, parameters: parameters)
260+ let mapper = ProductListMapper ( siteID: siteID)
261+ enqueue ( request, mapper: mapper, completion: completion)
262+ }
263+
241264 /// Retrieves a product SKU if available.
242265 ///
243266 /// - Parameters:
0 commit comments