Suggestions
The SDK provides the ability to fetch a predefined set of suggested foods for logging, depending on the current time of day
iOS Android React Native Flutter
Copy public enum PassioMealTime : String , Codable {
case breakfast
case lunch
case dinner
case snack
}
public func fetchSuggestions ( mealTime : PassioMealTime, completion : @escaping ([PassioFoodDataInfo]) -> Void )
Copy enum class PassioMealTime ( val mealName: String ) {
BREAKFAST ( "breakfast" ),
LUNCH ( "lunch" ),
DINNER ( "dinner" ),
SNACK ( "snack" )
}
fun fetchSuggestions (
mealTime: PassioMealTime ,
callback: ( results : List < PassioFoodDataInfo >) -> Unit
)
Copy export type PassioMealTime = 'breakfast' | 'lunch' | 'dinner' | 'snack'
fetchSuggestions (
mealTime : PassioMealTime
) : Promise < PassioFoodDataInfo [] | null >
Example of fetching suggestions for snack meal time:
banana, coffee, black tea, coke, cheddar cheese, chocolate chip cookies, potato chips, blueberry muffin, plain yogurt, strawberries, ...
UX Tip: Combine these predefined suggestions with user meal logs to provide a list of "quick suggestion" logs. This will enable users to log their meals even faster.
Meal Plans
Meal Plans provide users suggestions which foods to consume depending on their dietary preference and time of day. The Meal Plan api is divided into two functions:
fetchMealPlans
that is used to retrieve all of the possible meal plans. These meal plans usually correlate with a specific diet like "Keto Diet".
fetchMealPlanForDay
is an api that is used to fetch specific foods recommended for a certain day of a target meal plan.
iOS Android React Native Flutter
Copy public func fetchMealPlans ( completion : @escaping ([PassioMealPlan]) -> Void )
public func fetchMealPlanForDay ( mealPlanLabel : String ,
day : Int ,
completion : @escaping ([PassioMealPlanItem]) -> Void )
public struct PassioMealPlan : Codable , Equatable {
public var mealPlanLabel: String ?
public var mealPlanTitle: String ?
public var carbsTarget: Int ?
public var proteinTarget: Int ?
public var fatTarget: Int ?
}
public struct PassioMealPlanItem {
public var dayNumber: Int ?
public var dayTitle: String ?
public var mealTime: PassioMealTime ?
public var meal: PassioFoodDataInfo ?
}
Copy fun fetchMealPlans (callback: ( result : List < PassioMealPlan >) -> Unit )
fun fetchMealPlanForDay (
mealPlanLabel: String ,
day: Int ,
callback: ( result : List < PassioMealPlanItem >) -> Unit
)
data class PassioMealPlan (
val mealPlanTitle: String ,
val mealPlanLabel: String ,
val carbTarget: Int ,
val proteinTarget: Int ,
val fatTarget: Int
)
data class PassioMealPlanItem (
val dayNumber: Int ,
val dayTitle: String ,
val mealTime: PassioMealTime ,
val meal: PassioFoodDataInfo
)
Copy fetchMealPlans (): Promise < PassioMealPlan[] | null >
fetchMealPlanForDay (
mealPlanLabel: string ,
day: number
): Promise < PassioMealPlanItem[] | null >
export interface PassioMealPlan {
carbsTarget ?: number
fatTarget ?: number
mealPlanLabel : string
mealPlanTitle : string
proteinTarget ?: number
}
export interface PassioMealPlanItem {
dayNumber : number
dayTitle : string
mealTime : PassioMealTime
meal : PassioFoodDataInfo
}
Some of the available meal plans:
Heart Healthy Diet, Ketogenic Diet, Managing Obesity, Managing Type 2 Diabetes, Low FODMAP, Healthy Kidney Diet, Balanced Diet, DASH Diet, PCOS Diet, Mediterranean Diet