feat(medusa, medusa-js, medusa-react): Bulk add Products to a SalesChannel (#1833)

This commit is contained in:
Adrien de Peretti
2022-07-14 16:39:44 +02:00
committed by GitHub
parent cdd91974f9
commit f35ea5156a
12 changed files with 377 additions and 20 deletions
@@ -6,6 +6,7 @@ import {
AdminSalesChannelsDeleteRes,
AdminSalesChannelsListRes,
AdminDeleteSalesChannelsChannelProductsBatchReq,
AdminPostSalesChannelsChannelProductsBatchReq,
} from "@medusajs/medusa"
import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
@@ -104,6 +105,22 @@ class AdminSalesChannelsResource extends BaseResource {
const path = `/admin/sales-channels/${salesChannelId}/products/batch`
return this.client.request("DELETE", path, payload, {}, customHeaders)
}
/**
* Add products to a sales channel
* @experimental This feature is under development and may change in the future.
* To use this feature please enable featureflag `sales_channels` in your medusa backend project.
* @description Add products to a sales channel
* @returns a medusa sales channel
*/
addProducts(
salesChannelId: string,
payload: AdminPostSalesChannelsChannelProductsBatchReq,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminSalesChannelsRes> {
const path = `/admin/sales-channels/${salesChannelId}/products/batch`
return this.client.request("POST", path, payload, {}, customHeaders)
}
}
export default AdminSalesChannelsResource