Example #1
0
        public override async Task <TweetsCollection> search(string searchTerm, long?id, bool?searchOlder)
        {
            TwitAuthenticateResponse authentication = await generateAuthentication();

            var searchResultsToDisplay = await fetchResults(authentication, searchTerm, id, searchOlder);

            return(searchResultsToDisplay);
        }
Example #2
0
        protected override async Task <TweetsCollection> fetchResults(TwitAuthenticateResponse authentication, string searchTerm, long?id, bool?searchOlder)
        {
            var                httpClient     = new HttpClient();
            StringBuilder      baseAddress    = buildWebAddressString(searchTerm, id, searchOlder);
            HttpRequestMessage requestResults = new HttpRequestMessage(HttpMethod.Get, baseAddress.ToString());

            requestResults.Headers.Add("Authorization", authentication.token_type + " " + authentication.access_token);
            var response = await httpClient.SendAsync(requestResults);

            string resultsAsJson = await response.Content.ReadAsStringAsync();

            var deserializedResults = deserializeObject <TweetsCollection>(resultsAsJson);

            deserializedResults.biggestTweetId  = deserializedResults.searchResults.Max(t => t.id);
            deserializedResults.smallestTweetId = deserializedResults.searchResults.Min(t => t.id);
            return(deserializedResults);
        }
Example #3
0
 protected abstract Task <TweetsCollection> fetchResults(TwitAuthenticateResponse authentication, string searchTerm, long?id, bool?searchOlder);