public string GetSearchTweetsQuery(ITweetSearchParameters tweetSearchParameters)
        {
            if (!_searchQueryValidator.IsSearchParameterValid(tweetSearchParameters))
            {
                return(null);
            }

            var searchQuery = GetQuery(tweetSearchParameters.SearchQuery, tweetSearchParameters.Filters);

            if (!_searchQueryValidator.IsSearchTweetsQueryValid(searchQuery))
            {
                return(null);
            }

            StringBuilder query = new StringBuilder();

            query.Append(_searchQueryParameterGenerator.GenerateSearchQueryParameter(searchQuery));
            query.Append(_searchQueryParameterGenerator.GenerateSearchTypeParameter(tweetSearchParameters.SearchType));

            query.Append(_queryParameterGenerator.GenerateSinceIdParameter(tweetSearchParameters.SinceId));
            query.Append(_queryParameterGenerator.GenerateMaxIdParameter(tweetSearchParameters.MaxId));
            query.Append(_queryParameterGenerator.GenerateCountParameter(tweetSearchParameters.MaximumNumberOfResults));

            query.Append(_searchQueryParameterGenerator.GenerateGeoCodeParameter(tweetSearchParameters.GeoCode));
            query.Append(_searchQueryParameterGenerator.GenerateLangParameter(tweetSearchParameters.Lang));
            query.Append(_searchQueryParameterGenerator.GenerateLocaleParameter(tweetSearchParameters.Locale));
            query.Append(_searchQueryParameterGenerator.GenerateSinceParameter(tweetSearchParameters.Since));
            query.Append(_searchQueryParameterGenerator.GenerateUntilParameter(tweetSearchParameters.Until));
            query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(tweetSearchParameters.FormattedCustomQueryParameters));

            return(query.ToString());
        }
        private string GetQuery(string query, TweetSearchFilters tweetSearchFilters)
        {
            query = _searchQueryParameterGenerator.GenerateSearchQueryParameter(query);

            if (tweetSearchFilters == TweetSearchFilters.None)
            {
                return(query);
            }

            foreach (var entitiesTypeFilter in GetFlags(tweetSearchFilters))
            {
                if (entitiesTypeFilter != TweetSearchFilters.None)
                {
                    var filter = entitiesTypeFilter.GetQueryFilterName().ToLowerInvariant();
                    query += string.Format(" filter:{0}", filter);
                }
            }

            return(query);
        }