Package com.cis.gorecipe.service
Class SpoonacularServiceImpl
java.lang.Object
com.cis.gorecipe.service.SpoonacularServiceImpl
- All Implemented Interfaces:
SpoonacularService
This class handles all interfacing with the Spoonacular Food and Recipe API
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.slf4j.Logger(package private) RecipeRepositoryFields inherited from interface com.cis.gorecipe.service.SpoonacularService
APIHOST, APIKEY, client, parser -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
logger
org.slf4j.Logger logger -
recipeRepository
RecipeRepository recipeRepository
-
-
Constructor Details
-
SpoonacularServiceImpl
-
-
Method Details
-
sendGetRequest
- Parameters:
url- spoonacular API to get- Returns:
- API results deserialized as JSON
- Throws:
Exception
-
parseRecipe
- Parameters:
result- the JSON object representation of the recipe- Returns:
- a Recipe object containing the information parsed from the JSON
-
search
- Specified by:
searchin interfaceSpoonacularService- Parameters:
parameters- a map of the search parameters for the Spoonacular API (see https://rapidapi.com/spoonacular/api/recipe-food-nutrition/)- Returns:
- a list of Recipe objects returned by the search
- Throws:
Exception
-
recommend
- Specified by:
recommendin interfaceSpoonacularService- Parameters:
userRecipes- the list of recipes saved to a specific user account- Returns:
- a list of recommended recipes based on the saved recipes
- Throws:
Exception
-