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:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| id | string | The id of the product. | 
fetchTopProducts ⇒ Promise.<Object>
Fetch top products.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| limit | number | The number of top products to fetch. | 
fetchProductsByCategory ⇒ Promise.<Object>
Fetch products by category.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| category | string | The category of the products. | 
searchProducts ⇒ Promise.<Object>
Search products.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| query | string | The search query. | 
| categoryId | string | The id of the category. | 
| sort | string | The sort order. | 
| discount | boolean | Whether to include discounted products. | 
addProduct ⇒ Promise.<Object>
Add a product.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 201.
| Param | Type | Description | 
|---|---|---|
| token | string | The authorization token. | 
| product | Object | The product data. | 
| photo | File | The product photo. | 
deleteProduct ⇒ Promise.<Object>
Delete a product by id.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| id | string | The id of the product. | 
editProduct ⇒ Promise.<Object>
Edit a product.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| token | string | The authorization token. | 
| id | string | The id of the product. | 
| product | Object | The new product data. | 
| photo | File | The new product photo. | 
editProductAvailability ⇒ Promise.<Object>
Edit product availability.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| token | string | The authorization token. | 
| id | string | The id of the product. | 
| availability | boolean | The new availability status. | 
fetchUserProducts ⇒ Promise.<Object>
Fetch user's products.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| token | string | The authorization token. | 
fetchProductsReviewRatings ⇒ Promise.<Object>
Fetch products review ratings.
Kind: global constant
Returns: Promise.<Object> - The response data.
Throws:
ErrorIf the response status is not 200.
| Param | Type | Description | 
|---|---|---|
| token | string | The authorization token. |