Update Meal Plan Settings
Use the
updateMealPlanSettings
mutation to update or overwrite the user's meal plan settings. All the arguments to be sent are optional; however, it will update only the arguments sent in the mutation. The information is saved and it can be later requested by executing the mealPlan query. Name | Type | Description |
update | Object | Update the values added to it. For example, update: { calories: 1600, protein: 20 } |
ovewrite | Object | Overwrite only the values added to it. The ones that were not added will be set as null . For example: overwrite: { format: [BREAKFAST, LUNCH, DINNER] } |
If the
update
and overwrite
arguments are defined at the same time, the overwrite
argument will be the one applied. Use the following arguments within the update and overwrite objects:
Arguments | Type | Description |
calories | Int | Total Calories per day. If using the overwrite and no calories value is defined, the default value is set to 1400. |
carbs | Int | Percent of Carbs |
fat | Int | Percent of Fat |
format | MealTime! | Requested meals per day format. Available options: BREAKFAST, SNACK, LUNCH, DINNER . The list cannot have a null value, i.e, [BREAKFAST, null] . However, it is possible to send the list in the following formats:
If not format is sent, the following format is set as default: [BREAKFAST, SNACK, LUNCH, DINNER] |
omega3 | Float | Percent of Omega 3. |
protein | Int | Percent of Protein |
The following example updates the protein and calories values:
Mutation
Response
mutation updateMealPlanSettings {
updateMealPlanSettings(
update: { calories: 1600, protein: 20 }
) {
success
message
}
}
{
"data": {
"updateMealPlanSettings": {
"success": true,
"message": "Settings updated"
}
}
}
The following example updates the meal format and sets automatically the rest of arguments not send as null:
Mutation
Response
mutation updateMealPlanSettings {
updateMealPlanSettings(
overwrite: { format: [BREAKFAST, LUNCH, DINNER] }
) {
success
message
}
}
{
"data": {
"updateMealPlanSettings": {
"success": true,
"message": "Settings updated"
}
}
}
The following example uses query variables and updates the calories and proteins values:
Mutation
Response
mutation($update: UpdateMPSettingsInput, $overwrite: UpdateMPSettingsInput) {
updateMealPlanSettings(update: $update, overwrite: $overwrite) {
success
message
}
}
{
"data": {
"updateMealPlanSettings": {
"success": true,
"message": "Settings updated"
}
}
}
QUERY VARIABLES
{
"overwrite": {"calories": 1600, "protein": 20}
}
Last modified 1yr ago