public IEnumerable <ISearchResultsDTO> SearchTweetsWithMetadata(ISearchTweetsParameters searchTweetsParameters) { if (searchTweetsParameters == null) { throw new ArgumentException("TweetSearch Parameters cannot be null"); } var result = new List <ISearchResultsDTO>(); if (searchTweetsParameters.MaximumNumberOfResults > 100) { result = SearchTweetsRecursively(searchTweetsParameters); } else { string httpQuery = _searchQueryGenerator.GetSearchTweetsQuery(searchTweetsParameters); var searchTweetResult = GetSearchTweetResultsFromQuery(httpQuery); if (searchTweetResult == null) { return(null); } result.Add(searchTweetResult); } UpdateMatchingTweets(result, searchTweetsParameters); return(result); }
private void ParseFilter(ISearchTweetsParameters parameters, IQueryConfiguration queryConfiguration) { switch (queryConfiguration.Filter) { case Filters.Hashtag: { parameters.Filters = TweetSearchFilters.Hashtags; break; } case Filters.Image: { parameters.Filters = TweetSearchFilters.Images; break; } case Filters.News: { parameters.Filters = TweetSearchFilters.News; break; } case Filters.None: { parameters.Filters = TweetSearchFilters.None; break; } case Filters.Video: { parameters.Filters = TweetSearchFilters.Videos; break; } } }
public ITwitterIterator <ITweet, long?> GetSearchTweetsIterator(ISearchTweetsParameters parameters) { var pageIterator = _client.Raw.Search.GetSearchTweetsIterator(parameters); return(new TwitterIteratorProxy <ITwitterResult <ISearchResultsDTO>, ITweet, long?>(pageIterator, twitterResult => _client.Factories.CreateTweets(twitterResult?.DataTransferObject?.TweetDTOs))); }
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.Append(_queryParameterGenerator.GenerateTweetModeParameter(_tweetinviSettingsAccessor.CurrentThreadSettings.TweetMode)); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(searchTweetsParameters.FormattedCustomQueryParameters)); return query.ToString(); }
public void Validate(ISearchTweetsParameters parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } }
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 async Task <ISearchResults> SearchTweetsWithMetadata(ISearchTweetsParameters parameters) { var pageIterator = _client.Raw.Search.GetSearchTweetsIterator(parameters); var page = await pageIterator.NextPage().ConfigureAwait(false); return(_client.Factories.CreateSearchResult(page?.Content?.DataTransferObject)); }
private bool IsAtLeasOneRequiredCriteriaSet(ISearchTweetsParameters searchTweetsParameters) { bool isSearchQuerySet = !string.IsNullOrEmpty(searchTweetsParameters.SearchQuery); bool isSearchQueryValid = IsSearchQueryValid(searchTweetsParameters.SearchQuery); bool isGeoCodeSet = IsGeoCodeValid(searchTweetsParameters.GeoCode); bool isEntitiesTypeSet = searchTweetsParameters.Filters != TweetSearchFilters.None; return (isSearchQuerySet && isSearchQueryValid) || isGeoCodeSet || isEntitiesTypeSet; }
private bool IsAtLeasOneRequiredCriteriaSet(ISearchTweetsParameters searchTweetsParameters) { bool isSearchQuerySet = !string.IsNullOrEmpty(searchTweetsParameters.SearchQuery); bool isSearchQueryValid = IsSearchQueryValid(searchTweetsParameters.SearchQuery); bool isGeoCodeSet = IsGeoCodeValid(searchTweetsParameters.GeoCode); bool isEntitiesTypeSet = searchTweetsParameters.Filters != TweetSearchFilters.None; return((isSearchQuerySet && isSearchQueryValid) || isGeoCodeSet || isEntitiesTypeSet); }
public IEnumerable<string> SearchTweets(ISearchTweetsParameters searchTweetsParameters) { if (searchTweetsParameters.MaximumNumberOfResults > 100) { return SearchTweetsRecursively(searchTweetsParameters); } string query = _searchQueryGenerator.GetSearchTweetsQuery(searchTweetsParameters); return new[] { GetJsonResultFromQuery(query) }; }
private void ParseSearchDates(ISearchTweetsParameters parameters, IQueryConfiguration queryConfiguration) { if (queryConfiguration.SinceDate.CompareTo(QueryConfiguration.NONE_DATE) != 0) { parameters.Since = queryConfiguration.SinceDate; } if (queryConfiguration.UntilDate.CompareTo(QueryConfiguration.NONE_DATE) != 0) { parameters.Until = queryConfiguration.UntilDate; } }
public IEnumerable <string> SearchTweets(ISearchTweetsParameters searchTweetsParameters) { if (searchTweetsParameters.MaximumNumberOfResults > 100) { return(SearchTweetsRecursively(searchTweetsParameters)); } string query = _searchQueryGenerator.GetSearchTweetsQuery(searchTweetsParameters); return(new[] { GetJsonResultFromQuery(query) }); }
public IEnumerable <ITweetDTO> SearchTweets(ISearchTweetsParameters searchTweetsParameters) { var searchResults = SearchTweetsWithMetadata(searchTweetsParameters); if (searchResults == null) { return(null); } return(searchResults.SelectMany(x => x.MatchingTweetDTOs)); }
private void ParseLocation(ISearchTweetsParameters parameters, IQueryConfiguration queryConfiguration) { //if (queryConfiguration.Location == Locations.Colombia) //{ // parameters.Locale = "Colombia"; //} //else if(queryConfiguration.Location == Locations.USA) //{ // parameters.Locale = "USA"; //} }
public void ThrowIfSearchParametersIsNotValid(ISearchTweetsParameters searchTweetsParameters) { if (searchTweetsParameters == null) { throw new ArgumentNullException("Search parameters cannot be null"); } if (!IsAtLeasOneRequiredCriteriaSet(searchTweetsParameters)) { throw new ArgumentException("At least one of the required parameters needs to be valid (query, geocode or filter)."); } }
private void ParseLanguage(ISearchTweetsParameters parameters, IQueryConfiguration queryConfiguration) { if (queryConfiguration.Language == Languages.English) { parameters.Lang = LanguageFilter.English; } else if (queryConfiguration.Language == Languages.Spanish) { parameters.Lang = LanguageFilter.Spanish; } }
private void ParseSearchDates(ISearchTweetsParameters parameters, IQueryConfiguration queryConfiguration) { if (queryConfiguration.SinceDate.CompareTo(QueryConfiguration.NONE_DATE) != 0) { DateTime since = new DateTime(queryConfiguration.SinceDate.Year, queryConfiguration.SinceDate.Month, queryConfiguration.SinceDate.Day); parameters.Since = since; } if (queryConfiguration.UntilDate.CompareTo(QueryConfiguration.NONE_DATE) != 0) { DateTime until = new DateTime(queryConfiguration.UntilDate.Year, queryConfiguration.UntilDate.Month, queryConfiguration.UntilDate.Day); parameters.Until = until; } }
private void ParseSearchType(ISearchTweetsParameters parameters, IQueryConfiguration queryConfiguration) { if (queryConfiguration.SearchType == SearchTypes.Mixed) { parameters.SearchType = SearchResultType.Mixed; } else if (queryConfiguration.SearchType == SearchTypes.Popular) { parameters.SearchType = SearchResultType.Popular; } else if (queryConfiguration.SearchType == SearchTypes.Recent) { parameters.SearchType = SearchResultType.Recent; } }
private List <ISearchResultsDTO> SearchTweetsRecursively(ISearchTweetsParameters searchTweetsParameters) { var searchParameter = _searchQueryHelper.CloneTweetSearchParameters(searchTweetsParameters); searchParameter.MaximumNumberOfResults = Math.Min(searchParameter.MaximumNumberOfResults, 100); string query = _searchQueryGenerator.GetSearchTweetsQuery(searchParameter); var currentResult = GetSearchTweetResultsFromQuery(query); if (currentResult == null) { return(new List <ISearchResultsDTO>()); } var result = new List <ISearchResultsDTO> { currentResult }; var tweets = currentResult.TweetDTOs; var totalTweets = currentResult.TweetDTOs.ToList(); while (totalTweets.Count < searchTweetsParameters.MaximumNumberOfResults) { if (tweets.IsEmpty()) { // If Twitter does not have any result left, stop the search break; } var oldestTweetId = _tweetHelper.GetOldestTweetId(tweets); searchParameter.MaxId = oldestTweetId - 1; searchParameter.MaximumNumberOfResults = Math.Min(searchTweetsParameters.MaximumNumberOfResults - totalTweets.Count, 100); query = _searchQueryGenerator.GetSearchTweetsQuery(searchParameter); currentResult = GetSearchTweetResultsFromQuery(query); if (currentResult == null) { break; } tweets = currentResult.TweetDTOs; totalTweets.AddRange(tweets); result.Add(currentResult); } return(result); }
private IEnumerable <string> SearchTweetsRecursively(ISearchTweetsParameters searchTweetsParameters) { var searchParameter = _searchQueryHelper.CloneTweetSearchParameters(searchTweetsParameters); searchParameter.MaximumNumberOfResults = Math.Min(searchParameter.MaximumNumberOfResults, 100); string query = _searchQueryGenerator.GetSearchTweetsQuery(searchParameter); var json = GetJsonResultFromQuery(query); var jsonResult = new List <string> { json }; var currentResult = _searchQueryHelper.GetTweetsFromJsonResponse(json); var tweetDTOResult = currentResult; if (tweetDTOResult == null) { return(jsonResult); } while (tweetDTOResult.Count < searchTweetsParameters.MaximumNumberOfResults) { if (currentResult.IsNullOrEmpty()) { // If Twitter does not any result left, stop the search break; } var oldestTweetId = _tweetHelper.GetOldestTweetId(currentResult); searchParameter.MaxId = oldestTweetId - 1; searchParameter.MaximumNumberOfResults = Math.Min(searchTweetsParameters.MaximumNumberOfResults - tweetDTOResult.Count, 100); query = _searchQueryGenerator.GetSearchTweetsQuery(searchParameter); json = GetJsonResultFromQuery(query); if (json != null) { jsonResult.Add(json); } currentResult = _searchQueryHelper.GetTweetsFromJsonResponse(json); tweetDTOResult.AddRangeSafely(currentResult); } return(jsonResult); }
private void InitData() { _searchQuery = TestHelper.GenerateString(); _searchQueryParameter = TestHelper.GenerateString(); _searchResultType = SearchResultType.Mixed; _searchTypeParameter = TestHelper.GenerateString(); _maximumNumberOfResults = TestHelper.GenerateRandomInt(); _maximumNumberOfResultsParameter = TestHelper.GenerateString(); _sinceId = TestHelper.GenerateRandomLong(); _sinceIdParameter = TestHelper.GenerateString(); _maxId = TestHelper.GenerateRandomLong(); _maxIdParameter = TestHelper.GenerateString(); _since = DateTime.Now.AddMinutes(TestHelper.GenerateRandomInt()); _sinceParameter = TestHelper.GenerateString(); _until = DateTime.Now.AddMinutes(TestHelper.GenerateRandomInt()); _untilParameter = TestHelper.GenerateString(); _locale = TestHelper.GenerateString(); _localeParameter = TestHelper.GenerateString(); _lang = LanguageFilter.French; _languageParameter = TestHelper.GenerateString(); _geoCode = A.Fake <IGeoCode>(); _geoCodeParameter = TestHelper.GenerateString(); _searchTweetsParameters = A.Fake <ISearchTweetsParameters>(); _searchTweetsParameters.SearchQuery = _searchQuery; _searchTweetsParameters.SearchType = _searchResultType; _searchTweetsParameters.MaximumNumberOfResults = _maximumNumberOfResults; _searchTweetsParameters.SinceId = _sinceId; _searchTweetsParameters.MaxId = _maxId; _searchTweetsParameters.Since = _since; _searchTweetsParameters.Until = _until; _searchTweetsParameters.Locale = _locale; _searchTweetsParameters.Lang = _lang; _searchTweetsParameters.GeoCode = _geoCode; }
public ISearchTweetsParameters CloneTweetSearchParameters(ISearchTweetsParameters searchTweetsParameters) { var clone = new SearchTweetsParameters(searchTweetsParameters.SearchQuery) { Filters = searchTweetsParameters.Filters, GeoCode = searchTweetsParameters.GeoCode, Lang = searchTweetsParameters.Lang, Locale = searchTweetsParameters.Locale, MaxId = searchTweetsParameters.MaxId, MaximumNumberOfResults = searchTweetsParameters.MaximumNumberOfResults, SearchType = searchTweetsParameters.SearchType, Since = searchTweetsParameters.Since, SinceId = searchTweetsParameters.SinceId, TweetSearchType = searchTweetsParameters.TweetSearchType, Until = searchTweetsParameters.Until }; return(clone); }
private IEnumerable<string> SearchTweetsRecursively(ISearchTweetsParameters searchTweetsParameters) { var searchParameter = _searchQueryHelper.CloneTweetSearchParameters(searchTweetsParameters); searchParameter.MaximumNumberOfResults = Math.Min(searchParameter.MaximumNumberOfResults, 100); string query = _searchQueryGenerator.GetSearchTweetsQuery(searchParameter); var json = GetJsonResultFromQuery(query); var jsonResult = new List<string> { json }; var currentResult = _searchQueryHelper.GetTweetsFromJsonResponse(json); var tweetDTOResult = currentResult; if (tweetDTOResult == null) { return jsonResult; } while (tweetDTOResult.Count < searchTweetsParameters.MaximumNumberOfResults) { if (currentResult.IsNullOrEmpty()) { // If Twitter does not any result left, stop the search break; } var oldestTweetId = _tweetHelper.GetOldestTweetId(currentResult); searchParameter.MaxId = oldestTweetId - 1; searchParameter.MaximumNumberOfResults = Math.Min(searchTweetsParameters.MaximumNumberOfResults - tweetDTOResult.Count, 100); query = _searchQueryGenerator.GetSearchTweetsQuery(searchParameter); json = GetJsonResultFromQuery(query); if (json != null) { jsonResult.Add(json); } currentResult = _searchQueryHelper.GetTweetsFromJsonResponse(json); tweetDTOResult.AddRangeSafely(currentResult); } return jsonResult; }
public SearchTweetsParameters(ISearchTweetsParameters source) : base(source) { if (source == null) { Filters = TweetSearchFilters.None; PageSize = TwitterLimits.DEFAULTS.SEARCH_TWEETS_MAX_PAGE_SIZE; return; } Query = source.Query; Locale = source.Locale; Lang = source.Lang; GeoCode = new GeoCode(source.GeoCode); SearchType = source.SearchType; Since = source.Since; Until = source.Until; Filters = source.Filters; IncludeEntities = source.IncludeEntities; TweetMode = source.TweetMode; }
public override IList <IPublication> SearchPublications(IQueryConfiguration queryConfiguration) { IList <IPublication> publications = new List <IPublication>(); int totalPublications = queryConfiguration.MaxPublicationCount; int totalSearchesByKeyword = queryConfiguration.MaxPublicationCount / queryConfiguration.Keywords.Count; queryConfiguration.MaxPublicationCount = totalSearchesByKeyword + 1000; foreach (var key in queryConfiguration.Keywords) { ISearchTweetsParameters parameters = ParseSearchTweetsParameters(queryConfiguration, key); IEnumerable <ITweet> tweets = Search.SearchTweets(parameters); ParseTweets(tweets, publications, queryConfiguration); if (publications.Count > totalPublications) { break; } } queryConfiguration.MaxPublicationCount = totalPublications; publications = ReorganizeSearches(publications, queryConfiguration.MaxPublicationCount); return(publications); }
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()); }
public override IList <IPublication> SearchPublications(IQueryConfiguration queryConfiguration) { IQueryConfiguration myQuery = (IQueryConfiguration)queryConfiguration.Clone(); if (myQuery.SinceDate.CompareTo(myQuery.UntilDate) > 0) { throw new ArgumentException("until date must be longer than since date "); } IList <IPublication> publications = new List <IPublication>(); int totalPublications = myQuery.MaxPublicationCount; TimeSpan rangeTime = myQuery.UntilDate.Subtract(myQuery.SinceDate); int totalDays = (int)(rangeTime.TotalDays == 0 ? 1 : rangeTime.TotalDays + 1); if (totalDays > 10 || myQuery.UntilDate.CompareTo(DateTime.Now.AddDays(-7)) < 0) { //throw new ArgumentException("You can't search longer than a week"); totalDays = 7; myQuery.UntilDate = DateTime.Now; myQuery.SinceDate = myQuery.UntilDate.AddDays(-7); } List <DateTime> dates = Enumerable.Range(0, totalDays).Select(x => myQuery.SinceDate.AddDays(x)).ToList(); int totalSearchesByDate = queryConfiguration.MaxPublicationCount / totalDays; queryConfiguration.MaxPublicationCount = totalSearchesByDate + 1000; foreach (var key in queryConfiguration.Keywords) { ISearchTweetsParameters parameters = ParseSearchTweetsParameters(myQuery, key); IList <ITweet> tweets = Search.SearchTweets(parameters).ToList(); ParseTweets(tweets, publications, queryConfiguration); if (publications.Count > totalPublications) { break; } } queryConfiguration.MaxPublicationCount = totalPublications; publications = ReorganizeSearches(publications, queryConfiguration.MaxPublicationCount); return(publications); }
public void Validate(ISearchTweetsParameters parameters) { _searchClientRequiredParametersValidator.Validate(parameters); var isSearchQuerySet = !string.IsNullOrEmpty(parameters.Query); var isSearchQueryValid = IsSearchQueryValid(parameters.Query); var isGeoCodeSet = IsGeoCodeValid(parameters.GeoCode); var isEntitiesTypeSet = parameters.Filters != TweetSearchFilters.None; var isSearchValid = (isSearchQuerySet && isSearchQueryValid) || isGeoCodeSet || isEntitiesTypeSet; if (!isSearchValid) { throw new ArgumentException("At least one of the required parameters needs to be valid (query, geocode or filter)."); } var maxPageSize = _client.Config.Limits.SEARCH_TWEETS_MAX_PAGE_SIZE; if (parameters.PageSize > maxPageSize) { throw new TwitterArgumentLimitException($"{nameof(parameters.PageSize)}", maxPageSize, nameof(_client.Config.Limits.SEARCH_TWEETS_MAX_PAGE_SIZE), "page size"); } }
public void TestInitialize() { _fakeBuilder = new FakeClassBuilder <SearchQueryExecutor>(); _fakeSearchQueryGenerator = _fakeBuilder.GetFake <ISearchQueryGenerator>(); _fakeSearchQueryHelper = _fakeBuilder.GetFake <ISearchQueryHelper>(); _fakeTwitterAccessor = _fakeBuilder.GetFake <ITwitterAccessor>(); _fakeTweetHelper = _fakeBuilder.GetFake <ITweetHelper>(); _fakeSearchQueryParameterGenerator = _fakeBuilder.GetFake <ISearchQueryParameterGenerator>(); _searchQuery = TestHelper.GenerateString(); _httpQuery = TestHelper.GenerateString(); _statusesJson = TestHelper.GenerateString(); _originalTweetDTO = GenerateTweetDTO(true); _retweetDTO = GenerateTweetDTO(false); _jObject = new JObject(); _jObject["statuses"] = _statusesJson; _tweetDTOs = new[] { A.Fake <ITweetWithSearchMetadataDTO>() }; _searchResultDTO = A.Fake <ISearchResultsDTO>(); _searchResultDTO.CallsTo(x => x.TweetDTOs).Returns(_tweetDTOs); _searchTweetsParameter = A.Fake <ISearchTweetsParameters>(); _fakeSearchQueryParameterGenerator.CallsTo(x => x.CreateSearchTweetParameter(_searchQuery)).Returns(_searchTweetsParameter); }
/// <summary> /// Search tweets with some additional metadata information /// </summary> public static ISearchResult SearchTweetsWithMetadata(ISearchTweetsParameters searchTweetsParameters) { return SearchController.SearchTweetsWithMetadata(searchTweetsParameters); }
public static async Task <IEnumerable <ITweet> > SearchTweets(ISearchTweetsParameters searchTweetsParameters) { return(await Sync.ExecuteTaskAsync(() => Search.SearchTweets(searchTweetsParameters))); }
public Task <ITwitterResult <ISearchResultsDTO> > SearchTweets(ISearchTweetsParameters parameters, ITwitterRequest request) { request.Query.Url = _searchQueryGenerator.GetSearchTweetsQuery(parameters, request.ExecutionContext.TweetMode); request.Query.HttpMethod = HttpMethod.GET; return(_twitterAccessor.ExecuteRequest <ISearchResultsDTO>(request)); }
public ITwitterPageIterator <ITwitterResult <ISearchResultsDTO>, long?> GetSearchTweetsIterator(ISearchTweetsParameters parameters) { _validator.Validate(parameters); var request = TwitterClient.CreateRequest(); return(_searchController.GetSearchTweetsIterator(parameters, request)); }
public async Task <ITweet[]> SearchTweets(ISearchTweetsParameters parameters) { var iterator = GetSearchTweetsIterator(parameters); return((await iterator.NextPage().ConfigureAwait(false)).ToArray()); }
/// <summary> /// Search tweets based on multiple parameters /// </summary> public static IEnumerable<ITweet> SearchTweets(ISearchTweetsParameters searchTweetsParameters) { return SearchController.SearchTweets(searchTweetsParameters); }
public static async Task<IEnumerable<ITweet>> SearchTweets(ISearchTweetsParameters searchTweetsParameters) { return await Sync.ExecuteTaskAsync(() => Search.SearchTweets(searchTweetsParameters)); }
public void Validate(ISearchTweetsParameters parameters) { _searchClientParametersValidator.Validate(parameters); }
/// <summary> /// Search tweets based on multiple parameters. /// </summary> /// <returns>This can returns a collection of json responses when the MaximumNumberOfResults parameter is bigger than 100</returns> public static IEnumerable<string> SearchTweets(ISearchTweetsParameters searchTweetsParameters) { return SearchJsonController.SearchTweets(searchTweetsParameters); }