Skip to content

typedoc-vitepress-theme-example / products / ProductInventory

ProductInventory

Class representing a product inventory.

Constructors

new ProductInventory()

ts
new ProductInventory(): ProductInventory

Returns

ProductInventory

Properties

products

ts
private products: ProductDetails[] = [];

Methods

addProduct()

ts
addProduct(product): ProductDetails

Add a new product to the inventory.

Parameters

product: ProductDetails

The product to be added.

Returns

ProductDetails

The added product details.


getAllProducts()

ts
getAllProducts(): ProductDetails[]

Get all products in the inventory.

Returns

ProductDetails[]

An array of all product details.


getProductById()

ts
getProductById(productId): ProductDetails

Get product details by ID.

Parameters

productId: string

The ID of the product.

Returns

ProductDetails

The product details with the specified ID.


getProductsByCategory()

ts
getProductsByCategory(category): ProductDetails[]

Get products by category.

Parameters

category: ProductCategory

The product category.

Returns

ProductDetails[]

An array of product details in the specified category.


removeProduct()

ts
removeProduct(productId): ProductDetails

Remove a product from the inventory.

Parameters

productId: string

The ID of the product to be removed.

Returns

ProductDetails

The removed product details.


updateProductDetails()

ts
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

ProductDetails

The updated product details.