Skip to main content

fetchProducts

Constants

fetchProductByIdPromise.<Object>

Fetch a product by id.

fetchTopProductsPromise.<Object>

Fetch top products.

fetchProductsByCategoryPromise.<Object>

Fetch products by category.

searchProductsPromise.<Object>

Search products.

addProductPromise.<Object>

Add a product.

deleteProductPromise.<Object>

Delete a product by id.

editProductPromise.<Object>

Edit a product.

editProductAvailabilityPromise.<Object>

Edit product availability.

fetchUserProductsPromise.<Object>

Fetch user's products.

fetchProductsReviewRatingsPromise.<Object>

Fetch products review ratings.

fetchProductById ⇒ Promise.<Object>

Fetch a product by id.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
idstringThe id of the product.

fetchTopProducts ⇒ Promise.<Object>

Fetch top products.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
limitnumberThe number of top products to fetch.

fetchProductsByCategory ⇒ Promise.<Object>

Fetch products by category.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
categorystringThe category of the products.

searchProducts ⇒ Promise.<Object>

Search products.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
querystringThe search query.
categoryIdstringThe id of the category.
sortstringThe sort order.
discountbooleanWhether to include discounted products.

addProduct ⇒ Promise.<Object>

Add a product.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 201.
ParamTypeDescription
tokenstringThe authorization token.
productObjectThe product data.
photoFileThe product photo.

deleteProduct ⇒ Promise.<Object>

Delete a product by id.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
idstringThe id of the product.

editProduct ⇒ Promise.<Object>

Edit a product.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
tokenstringThe authorization token.
idstringThe id of the product.
productObjectThe new product data.
photoFileThe new product photo.

editProductAvailability ⇒ Promise.<Object>

Edit product availability.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
tokenstringThe authorization token.
idstringThe id of the product.
availabilitybooleanThe new availability status.

fetchUserProducts ⇒ Promise.<Object>

Fetch user's products.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
tokenstringThe authorization token.

fetchProductsReviewRatings ⇒ Promise.<Object>

Fetch products review ratings.

Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:

  • Error If the response status is not 200.
ParamTypeDescription
tokenstringThe authorization token.