typedoc-vitepress-theme-example / products / ProductInventory
ProductInventory
Class representing a product inventory.
Constructors
new ProductInventory()
new ProductInventory(): ProductInventory
Returns
Properties
products
private products: ProductDetails[] = [];
Methods
addProduct()
addProduct(product): ProductDetails
Add a new product to the inventory.
Parameters
• product: ProductDetails
The product to be added.
Returns
The added product details.
getAllProducts()
getAllProducts(): ProductDetails[]
Get all products in the inventory.
Returns
An array of all product details.
getProductById()
getProductById(productId): ProductDetails
Get product details by ID.
Parameters
• productId: string
The ID of the product.
Returns
The product details with the specified ID.
getProductsByCategory()
getProductsByCategory(category): ProductDetails[]
Get products by category.
Parameters
• category: ProductCategory
The product category.
Returns
An array of product details in the specified category.
removeProduct()
removeProduct(productId): ProductDetails
Remove a product from the inventory.
Parameters
• productId: string
The ID of the product to be removed.
Returns
The removed product details.
updateProductDetails()
updateProductDetails(productId, updatedDetails): ProductDetails
Update product details.
Parameters
• productId: string
The ID of the product to be updated.
• updatedDetails: ProductDetails
The updated product details.
Returns
The updated product details.