# Auto-Generator

This endpoint generates a meal plan for a specified period of time. How does it work?

* The daily caloric intake is calculated according to specific fields in the user’s profile, i.e. their height, weight, sex and activity levels
* The meal planner then composes a tailor made meal plan, composed of recipes taken from Whisk’s extensive and varied recipe database

| PUT | `/mealplan/v2/generate` |
| --- | ----------------------- |

More info: <https://api.whisk.com/spec/#/MealPlanAPI/GenerateMealPlan2>

## Meal generation settings

To get and update the meal planner settings for each plan, use the following endpoints:

| GET | `/mealplan/v2/settings` |
| --- | ----------------------- |

More info: <https://api.whisk.com/spec/#/MealPlanAPI/GetMealPlanSettings2>

| PUT | `/mealplan/v2/settings` |
| --- | ----------------------- |

More info: <https://api.whisk.com/spec/#/MealPlanAPI/UpdateMealPlanSettings2>

Meal generation settings can also be specified as part of the [generation request](https://api.whisk.com/spec/#/MealPlanAPI/GenerateMealPlan2), in which case the stored settings will be disregarded and overridden.

## Settings model

| ATTRIBUTE                | TYPE    | DESCRIPTION                                                                                                                                                                                                                                                                    |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| servings                 | nubmer  | The number of servings, i,e, people, for which this meal plan is generated.                                                                                                                                                                                                    |
| calorie\_per\_day        | number  | The daily caloric intake which will be used to generate the meal plan, with a ±100 kcal variance.                                                                                                                                                                              |
| week\_template           | array   | Specifies which meals are to be generated in which daily spot. E.g: Monday: Lunch, slot 2 Tuesday: Breakfast, slot 1 and Lunch, slot 2 Wednesday: Breakfast, slot 1 and Lunch, slot 2 Thursday: Breakfast, slot 1 and Lunch, slot 2 Friday: Dinner, slot 3 Weekend: keep empty |
| replace\_only\_generated | boolean | If set to true, meals that were custom-created using the Add Meal endpoint will not be overridden. Only empty daily slots or automatically generated meals will be filled with the newly generated ones.                                                                       |

## User profile

To get and configure User profile you can use [these endpoints](https://api.whisk.com/spec/#/UserAPI):

| GET | `/user/v2/me` |
| --- | ------------- |

| PATCH | `/user/v2/settings` |
| ----- | ------------------- |

This list of user profile preferences could impact the meal recommendation algorithm:

* Age
* Gender
* Health goals
* Height, Weight
* Activity level
* Dietary Preferences
* Allergies and Intolerance
* Disliked Ingredients
* Cooking Preferences
