Client

object Client

a singleton object to handle all of the http requests to the API

Functions

Link copied to clipboard
suspend fun getImage(mealName: String, imageSize: ImageSize = ImageSize.SMALL): Bitmap?

a function to fetch the image form the API

Link copied to clipboard
suspend fun getIngredientsFromImage(imageUri: Uri): List<String>

returns the ingredients seen on the image captured/uplaoded by the user

Link copied to clipboard
suspend fun getMealByCategory(mutableMeals: SnapshotStateList<Meal?>, category: String)

given a category (e.g beef, vegan, ...) it will fetch the meals from that category and append them to the list

Link copied to clipboard
suspend fun getMealByIngredient(mutableMeals: SnapshotStateList<Meal?>, ingredient: String)

gets a list of Meals that have the ingredient that the user chose

Link copied to clipboard
suspend fun getMealByName(mealName: String): Meal?

obtain the image data given the meal name. This does not return the image bitmap and must be done with using getImage

Link copied to clipboard
suspend fun getRandomMeal(): Meal?

gets a random meal

Link copied to clipboard
suspend fun getRandomMeals(mutableMeals: SnapshotStateList<Meal?>)

similar to getRandomMeals but for several meals