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()); }
public string GetSearchTweetsQuery(ISearchTweetsParameters searchTweetsParameters) { if (searchTweetsParameters == null) { throw new ArgumentNullException("Search parameters cannot be null"); } var searchQuery = GetQuery(searchTweetsParameters.SearchQuery, searchTweetsParameters.Filters); _searchQueryValidator.ThrowIfSearchParametersIsNotValid(searchTweetsParameters); var query = new StringBuilder(Resources.Search_SearchTweets); query.AddParameterToQuery("q", searchQuery); query.AddParameterToQuery("geocode", _searchQueryParameterGenerator.GenerateGeoCodeParameter(searchTweetsParameters.GeoCode)); query.Append(_searchQueryParameterGenerator.GenerateSearchTypeParameter(searchTweetsParameters.SearchType)); query.Append(_queryParameterGenerator.GenerateSinceIdParameter(searchTweetsParameters.SinceId)); query.Append(_queryParameterGenerator.GenerateMaxIdParameter(searchTweetsParameters.MaxId)); query.Append(_queryParameterGenerator.GenerateCountParameter(searchTweetsParameters.MaximumNumberOfResults)); query.Append(_searchQueryParameterGenerator.GenerateLangParameter(searchTweetsParameters.Lang)); query.Append(_searchQueryParameterGenerator.GenerateLocaleParameter(searchTweetsParameters.Locale)); query.Append(_searchQueryParameterGenerator.GenerateSinceParameter(searchTweetsParameters.Since)); query.Append(_searchQueryParameterGenerator.GenerateUntilParameter(searchTweetsParameters.Until)); query.AddFormattedParameterToQuery(_queryParameterGenerator.GenerateTweetModeParameter(_tweetinviSettingsAccessor.CurrentThreadSettings.TweetMode)); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(searchTweetsParameters.FormattedCustomQueryParameters)); return(query.ToString()); }
public string GetSearchTweetsQuery(ISearchTweetsParameters parameters, ComputedTweetMode tweetMode) { var query = new StringBuilder(Resources.Search_SearchTweets); query.AddParameterToQuery("q", GenerateQueryParameter(parameters.Query, parameters.Filters)); query.AddParameterToQuery("geocode", _searchQueryParameterGenerator.GenerateGeoCodeParameter(parameters.GeoCode)); query.AddParameterToQuery("lang", parameters.Lang?.GetLanguageCode()); query.AddParameterToQuery("locale", parameters.Locale); query.AddParameterToQuery("result_type", parameters.SearchType?.ToString().ToLowerInvariant()); _queryParameterGenerator.AddMinMaxQueryParameters(query, parameters); query.AddFormattedParameterToQuery(_searchQueryParameterGenerator.GenerateSinceParameter(parameters.Since)); query.AddFormattedParameterToQuery(_searchQueryParameterGenerator.GenerateUntilParameter(parameters.Until)); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("tweet_mode", tweetMode); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }