Skip to main content

fetchProducts

Constants​

fetchProductById ⇒ Promise.<Object>

Fetch a product by id.

fetchTopProducts ⇒ Promise.<Object>

Fetch top products.

fetchProductsByCategory ⇒ Promise.<Object>

Fetch products by category.

searchProducts ⇒ Promise.<Object>

Search products.

addProduct ⇒ Promise.<Object>

Add a product.

deleteProduct ⇒ Promise.<Object>

Delete a product by id.

editProduct ⇒ Promise.<Object>

Edit a product.

editProductAvailability ⇒ Promise.<Object>

Edit product availability.

fetchUserProducts ⇒ Promise.<Object>

Fetch user's products.

fetchProductsReviewRatings ⇒ Promise.<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.