Class NutritionLog
Holds information about food logged by a user.
There are two ways of creating a nutrition log based on the food type:
- Identified food: Using the food field, which is a reference to a Food
resource. In this case fields
nutrients,energy,energy_from_fat,total_carbohydrate,total_fat,food_display_namewill be populated based on the referenced food. - Anonymous food: Using the
food_display_namefield and setting thenutrients,energy,energy_from_fat,total_carbohydrate,total_fatfields manually.
The identified food is preferred over the anonymous food. Nutrition logs created from anonymous food are not editable.
Implements
Namespace: Google.DevicesAndServices.Health.V4
Assembly: Google.DevicesAndServices.Health.V4.dll
Syntax
public sealed class NutritionLog : IMessage<NutritionLog>, IEquatable<NutritionLog>, IDeepCloneable<NutritionLog>, IBufferMessage, IMessage
Constructors
NutritionLog()
Declaration
public NutritionLog()
NutritionLog(NutritionLog)
Declaration
public NutritionLog(NutritionLog other)
Parameters
| Type | Name | Description |
|---|---|---|
| NutritionLog | other |
Properties
Energy
Optional. The total energy of the food, measured in kilocalories (kcal).
Declaration
public EnergyQuantity Energy { get; set; }
Property Value
| Type | Description |
|---|---|
| EnergyQuantity |
EnergyFromFat
Optional. The energy from fat, measured in kilocalories (kcal).
Declaration
public EnergyQuantity EnergyFromFat { get; set; }
Property Value
| Type | Description |
|---|---|
| EnergyQuantity |
Food
Optional. The resource name of the Food item. Required when creating a
nutrition log from an identified food. For anonymous food logs, use the
food_display_name field instead.
Declaration
public string Food { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
FoodAsDataPointName
DataPointName-typed view over the Food resource name property.
Declaration
public DataPointName FoodAsDataPointName { get; set; }
Property Value
| Type | Description |
|---|---|
| DataPointName |
FoodDisplayName
The display name of the food. For identified food logs, this is populated automatically from the referenced food.
Declaration
public string FoodDisplayName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Interval
Required. The time window when the food was logged.
Declaration
public SessionTimeInterval Interval { get; set; }
Property Value
| Type | Description |
|---|---|
| SessionTimeInterval |
MealType
Optional. The meal category. One of BREAKFAST, LUNCH, DINNER, or
SNACK.
Declaration
public MealType MealType { get; set; }
Property Value
| Type | Description |
|---|---|
| MealType |
Nutrients
Optional. An array of individual nutrient values for the nutrition log.
Declaration
public RepeatedField<NutrientQuantity> Nutrients { get; }
Property Value
| Type | Description |
|---|---|
| RepeatedField<NutrientQuantity> |
Serving
Optional. The serving information for the logged food.
Declaration
public NutritionLog.Types.Serving Serving { get; set; }
Property Value
| Type | Description |
|---|---|
| NutritionLog.Types.Serving |
TotalCarbohydrate
Optional. The total carbohydrate content, measured in grams.
Declaration
public WeightQuantity TotalCarbohydrate { get; set; }
Property Value
| Type | Description |
|---|---|
| WeightQuantity |
TotalFat
Optional. The total fat content, measured in grams.
Declaration
public WeightQuantity TotalFat { get; set; }
Property Value
| Type | Description |
|---|---|
| WeightQuantity |