예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="query"></param>
        /// <param name="maxResults">default 5, max 20</param>
        /// <param name="offset"> default 0</param>
        /// <returns>
        /// Returns a List of Recipe models
        /// </returns>
        public List <Recipe_Short> RecipeSearch(string query, int maxResults, int offset)
        {
            RecipeSearchParams param = SetUpParams(query, maxResults, offset);
            SpoonacularRecipeShortSearchResult result = QueryAPI(param);

            return(result.results);
            //List<RecipeInformationRootObject> recipeInfoList = ToRecipeInformationList(result);
            //return ToRecipeShortList(recipeInfoList);
        }
예제 #2
0
        /// <summary>
        /// A Spoonacular specific search.  Is MUCH better than the alternatives
        /// </summary>
        /// <param name="query">The query. The only needed value</param>
        /// <param name="number">The number of results to return. Capped by the MAX_RESULTS value</param>
        /// <param name="offset">Number of items to skip. Leave default unless needed</param>
        /// <param name="cuisine">Leave default unless needed</param>
        /// <param name="diet">Leave default unless needed</param>
        /// <param name="excludeIngredients">Leave default unless needed</param>
        /// <param name="intolerances">Leave default unless needed</param>
        /// <param name="limitLicense">Leave default unless needed</param>
        /// <param name="instructionsRequired">Leave default unless needed</param>
        /// <returns></returns>
        public List <Recipe_Short> RecipeSearch(string query,
                                                int number                = 5,
                                                int offset                = 0,
                                                string cuisine            = "",
                                                string diet               = "",
                                                string excludeIngredients = "",
                                                string intolerances       = "",
                                                bool limitLicense         = true,
                                                bool instructionsRequired = true)
        {
            RecipeSearchParams param = SetUpParams(query, number, offset, cuisine, diet, excludeIngredients, intolerances, limitLicense,
                                                   instructionsRequired);
            SpoonacularRecipeShortSearchResult result = QueryAPI(param);

            return(result.results);
        }