File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,14 @@ public function delete(string $endpoint): array
4747 return $ this ->request ('DELETE ' , $ endpoint );
4848 }
4949
50+ /**
51+ * Make a PATCH request
52+ */
53+ public function patch (string $ endpoint , array $ data = []): array
54+ {
55+ return $ this ->request ('PATCH ' , $ endpoint , $ data );
56+ }
57+
5058 /**
5159 * Make HTTP request
5260 */
Original file line number Diff line number Diff line change @@ -234,6 +234,34 @@ public function validateProducts(array $productsData): void
234234 $ this ->validator ->validateProducts ($ productsData );
235235 }
236236
237+ /**
238+ * Update specific fields of multiple products in bulk
239+ *
240+ * @param string $index
241+ * @param array $updates Array of updates in format: [['id' => 'product_id', 'fields' => ['field' => 'value']]]
242+ * @return array Response from the API
243+ * @throws ValidationException
244+ */
245+ public function updateProductsBulk (string $ index , array $ updates ): array
246+ {
247+ $ this ->validator ->validateIndex ($ index );
248+
249+ if (empty ($ updates )) {
250+ return [
251+ 'status ' => 'success ' ,
252+ 'message ' => 'No updates provided ' ,
253+ 'updated_count ' => 0 ,
254+ ];
255+ }
256+
257+ $ data = [
258+ 'index_name ' => $ index ,
259+ 'updates ' => $ updates ,
260+ ];
261+
262+ return $ this ->httpClient ->patch ('api/v1/sync/update-products ' , $ data );
263+ }
264+
237265 /**
238266 * Build embeddable fields configuration with localized fields
239267 */
You can’t perform that action at this time.
0 commit comments