chore(docs): Generated References (#5743)
Generated the following references: - `entities` - `inventory` - `js-client` - `pricing` - `product` - `services` - `stock-location` - `workflows` Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
dc6b815b12
commit
cdd42dbdcd
@@ -1491,11 +1491,57 @@ export interface IProductModuleService {
|
||||
sharedContext?: Context
|
||||
): Promise<ProductVariantDTO[]>
|
||||
|
||||
/**
|
||||
* This method is used to update a product's variants.
|
||||
*
|
||||
* @param {UpdateProductVariantDTO[]} data - The product variants to update.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<ProductVariantDTO[]>} The updated product variants's details.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* initialize as initializeProductModule,
|
||||
* } from "@medusajs/product"
|
||||
* import {
|
||||
* UpdateProductVariantDTO
|
||||
* } from "@medusajs/product/dist/types/services/product-variant"
|
||||
*
|
||||
* async function updateProductVariants (items: UpdateProductVariantDTO[]) {
|
||||
* const productModule = await initializeProductModule()
|
||||
*
|
||||
* const productVariants = await productModule.updateVariants(items)
|
||||
*
|
||||
* // do something with the product variants or return them
|
||||
* }
|
||||
*/
|
||||
updateVariants(
|
||||
data: UpdateProductVariantDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductVariantDTO[]>
|
||||
|
||||
/**
|
||||
* This method is used to create variants for a product.
|
||||
*
|
||||
* @param {CreateProductVariantDTO[]} data - The product variants to create.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<ProductVariantDTO[]>} The created product variants' details.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* initialize as initializeProductModule,
|
||||
* } from "@medusajs/product"
|
||||
*
|
||||
* async function createProductVariants (items: {
|
||||
* product_id: string,
|
||||
* title: string
|
||||
* }[]) {
|
||||
* const productModule = await initializeProductModule()
|
||||
*
|
||||
* const productVariants = await productModule.createVariants(items)
|
||||
*
|
||||
* // do something with the product variants or return them
|
||||
* }
|
||||
*/
|
||||
createVariants(
|
||||
data: CreateProductVariantDTO[],
|
||||
sharedContext?: Context
|
||||
@@ -2437,7 +2483,7 @@ export interface IProductModuleService {
|
||||
*
|
||||
* @param {string[]} productIds - The IDs of the products to restore.
|
||||
* @param {RestoreReturn<TReturnableLinkableKeys>} config -
|
||||
* Configurations determining which relations to restore along with the each of the products. You can pass to its `returnLinkableKeys`
|
||||
* Configurations determining which relations to restore along with each of the products. You can pass to its `returnLinkableKeys`
|
||||
* property any of the product's relation attribute names, such as `variant_id`.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<Record<string, string[]> | void>}
|
||||
@@ -2466,6 +2512,32 @@ export interface IProductModuleService {
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
/**
|
||||
* This method is used to restore product varaints that were soft deleted. Product variants are soft deleted when they're not
|
||||
* provided in a product's details passed to the {@link update} method.
|
||||
*
|
||||
* @param {string[]} variantIds - The IDs of the variants to restore.
|
||||
* @param {RestoreReturn<TReturnableLinkableKeys>} config -
|
||||
* Configurations determining which relations to restore along with each of the product variants. You can pass to its `returnLinkableKeys`
|
||||
* property any of the product variant's relation attribute names.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<Record<string, string[]> | void>}
|
||||
* An object that includes the IDs of related records that were restored. The object's keys are the ID attribute names of the product variant entity's relations
|
||||
* and its value is an array of strings, each being the ID of the record associated with the product variant through this relation.
|
||||
*
|
||||
* If there are no related records that were restored, the promise resolved to `void`.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* initialize as initializeProductModule,
|
||||
* } from "@medusajs/product"
|
||||
*
|
||||
* async function restoreProductVariants (ids: string[]) {
|
||||
* const productModule = await initializeProductModule()
|
||||
*
|
||||
* await productModule.restoreVariants(ids)
|
||||
* }
|
||||
*/
|
||||
restoreVariants<TReturnableLinkableKeys extends string = string>(
|
||||
variantIds: string[],
|
||||
config?: RestoreReturn<TReturnableLinkableKeys>,
|
||||
|
||||
Reference in New Issue
Block a user