Fetch Nutrients
get nutrients value using PassioFoodItemNutrients
To retrieve all macro and micronutrient values using fetchNutrientsForPassioFoodItem
, by passing a passioFoodItem
, you would typically follow these steps:
/**
* fetch a map of nutrients for passio Food Item with calculated weight
* @param passioFoodItem - The passioFoodItem for the attributes query.
* @param weight - The weight for the query.
* @returns A `Promise` resolving to a `PassioNutrient` object if the record exists in the database or `null` if not.
*/
fetchNutrientsForPassioFoodItem(
passioFoodItem: PassioFoodItem,
weight: UnitMass
): PassioNutrients
/**
* fetch a map of nutrients for passio Food Item with default selected size
* @param passioFoodItem - The passioFoodItem for the attributes query.
* @returns A `Promise` resolving to a `PassioNutrient` object if the record exists in the database or `null` if not.
*/
fetchNutrientsSelectedSizeForPassioFoodItem(
passioFoodItem: PassioFoodItem
): PassioNutrients
/**
* fetch a map of nutrients for passio Food Item with reference weight Unit("gram",100)
* @param passioFoodItem - The passioFoodItem for the attributes query.
* @returns A `Promise` resolving to a `PassioNutrient` object if the record exists in the database or `null` if not.
*/
fetchNutrientsReferenceForPassioFoodItem(
passioFoodItem: PassioFoodItem
): PassioNutrients
PassioSDK.fetchNutrientsForPassioFoodItem(passioFoodItem,weight)
PassioSDK.fetchNutrientsSelectedSizeForPassioFoodItemFoodItem(passioFoodItem)
PassioSDK.fetchNutrientsReferenceForPassioFoodItem(passioFoodItem)
You will receive PassioNutrients
interface PassioNutrients {
weight?: UnitMass
vitaminA?: UnitMass
alcohol?: UnitMass
calcium?: UnitMass
calories?: UnitMass
carbs?: UnitMass
cholesterol?: UnitMass
fat?: UnitMass
fibers?: UnitMass
iodine?: UnitMass
iron?: UnitMass
magnesium?: UnitMass
monounsaturatedFat?: UnitMass
phosphorus?: UnitMass
polyunsaturatedFat?: UnitMass
potassium?: UnitMass
protein?: UnitMass
satFat?: UnitMass
sodium?: UnitMass
sugarAlcohol?: UnitMass
sugars?: UnitMass
sugarsAdded?: UnitMass
transFat?: UnitMass
vitaminB12?: UnitMass
vitaminB12Added?: UnitMass
vitaminB6?: UnitMass
vitaminC?: UnitMass
vitaminD?: UnitMass
vitaminE?: UnitMass
vitaminEAdded?: UnitMass
}
Last updated