public void WriteException(Exception ex)
        {
            SlackClient slackClient = new SlackClient();
            string      slackSecret = _provider.GetApiConfigSettings().SlackSecret;

            slackClient.WriteTextMessageToChannel(slackSecret, $"{ex.Message}\n\n{ex.StackTrace}");
        }
        GetRecipientsFromSearch(SearchParams searchParams)
        {
            // error handling
            if (string.IsNullOrEmpty(searchParams.SearchTerm))
            {
                return(BadSearchParameterResult(searchParams.SearchTerm, "Search term cannot be empty or null."));
            }

            if (searchParams.From < 0)
            {
                return(BadSearchParameterResult(searchParams.SearchTerm, "Parameter From is less than zero.  Please provide a value greater than or equal to zero and less than the To parameter."));
            }
            else if (searchParams.To < 0)
            {
                return(BadSearchParameterResult(searchParams.SearchTerm, "Parameter To is less than zero.  Please provide a value greater than the To parameter."));
            }
            else if (searchParams.From >= searchParams.To)
            {
                return(BadSearchParameterResult(searchParams.SearchTerm, "Parameter From is greater than or equal to parameter To.  Please provide a From parameter that is less that the To parameter."));
            }

            string appId       = _apiConfigProvider.GetApiConfigSettings().AppId;
            string appKey      = _apiConfigProvider.GetApiConfigSettings().AppKey;
            string slackSecret = _apiConfigProvider.GetApiConfigSettings().SlackSecret;

            if (string.IsNullOrEmpty(appId))
            {
                return(MissingConfigurationResult(searchParams.SearchTerm, "Configuration Error: Missing AppId."));
            }
            if (string.IsNullOrEmpty(appKey))
            {
                return(MissingConfigurationResult(searchParams.SearchTerm, "Configuration Error: Missing AppKey."));
            }
            if (string.IsNullOrEmpty(slackSecret))
            {
                return(MissingConfigurationResult(searchParams.SearchTerm, "Configuration Error: Missing SlackSecret."));
            }

            RecipePayload data = await _recipeSearchProvider.RunSearch(searchParams, appId, appKey);

            return(data);
        }
 public ApiConfigSettings GetSettings()
 {
     return(_provider.GetApiConfigSettings());
 }