public class RecipeRepository extends Object
Constructor and Description |
---|
RecipeRepository(Context context)
This is the constructor for the RecipeRepository.
|
Modifier and Type | Method and Description |
---|---|
Completable |
delete(Recipe recipe)
This is the method used to delete a recipe from the SmartCheff database.
|
LiveData<List<Recipe>> |
findById(Recipe id)
This method finds a recipe by id.
|
LiveData<Recipe> |
findByName(Recipe name)
This is the method used to find a recipe by name.
|
LiveData<List<Recipe>> |
findRecipeUsingIngredient(Recipe id)
This method is used to find a recipe the uses specific ingredients.
|
LiveData<List<Recipe>> |
getAll()
This method is used to get all the recipes in the SmartCheff database.
|
Single<RecipeDto> |
retrieve(long id)
This method makes a request to the api service using the recipes id to get all the details of the recipe.
|
Completable |
save(Recipe recipe)
This is the method used to save a recipe to the SmartCheff database.
|
Single<List<RecipeDto>> |
search(Collection<String> ingredients)
This method makes a request to the api service using ingredients to find recipes.
|
public RecipeRepository(Context context)
context
- is reference to a Context object.public Completable save(Recipe recipe)
recipe
- is a reference to a Recipe object.public Completable delete(Recipe recipe)
recipe
- is a reference to a Recipe object.public LiveData<List<Recipe>> getAll()
public LiveData<Recipe> findByName(Recipe name)
name
- is the name of a recipe.public LiveData<List<Recipe>> findRecipeUsingIngredient(Recipe id)
id
- is the primary key of a recipe.public LiveData<List<Recipe>> findById(Recipe id)
id
- is the primary key of a recipe.public Single<List<RecipeDto>> search(Collection<String> ingredients)
ingredients
- is the ingredients inputted by the user.