public TwitterUser GetUser(string screenName)
        {
            if (string.IsNullOrEmpty(screenName))
            {
                return(new TwitterUser());
            }

            string url     = "https://api.twitter.com/1/users/lookup.json";
            string fullUrl = string.Format("{0}?screen_name={1}&include_entities=true", url, screenName);

            string signatureString           = _oAuthCreationService.CreateSignature(url);
            string authorizationHeaderParams = _oAuthCreationService.CreateAuthorizationHeaderParameter(
                signatureString, _oAuthCreationService.OAuthTimeStamp);

            string         method       = "POST";
            HttpWebRequest request      = _httpRequestResponse.GetRequest(fullUrl, authorizationHeaderParams, method);
            var            responseText = _httpRequestResponse.GetResponse(request);
            TwitterUser    user         = _mapUser.MapProfileInfo(responseText);

            return(user);
        }
        public TwitterStatusViewModel GetStatus(string userName)
        {
            /*
             * https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=twitterapi&count=200
             * */

            string url =
                string.Format(
                    @"https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name={0}&count=200",
                    userName);
            string signatureString           = _oAuthCreationService.CreateSignature(url);
            string authorizationHeaderParams = _oAuthCreationService.CreateAuthorizationHeaderParameter(
                signatureString, _oAuthCreationService.OAuthTimeStamp);

            string                    method       = "GET";
            HttpWebRequest            request      = _httpRequestResponse.GetRequest(url, authorizationHeaderParams, method);
            string                    responseText = _httpRequestResponse.GetResponse(request);
            IList <TwitterStatusItem> response     = _mapStatus.Map(responseText);
            var viewModel = _analyzeStatusesService.Anylize(response);

            return(viewModel);
        }
        public IList <SearchResponse> Search(SearchRequest search)
        {
            if (search == null || string.IsNullOrEmpty(search.Q))
            {
                return(new List <SearchResponse>());
            }

            /*
             * http://search.twitter.com/search.json?q=blue%20angels&rpp=5&include_entities=true&result_type=mixed
             * */
            string query = _httpServer.UrlEncode(search.Q);

            string url     = "http://search.twitter.com/search.json";
            string fullUrl = string.Format("{0}?q={1}&rpp=25&include_entities=true", url, query);

            if (!string.IsNullOrEmpty(search.ResultType))
            {
                fullUrl = string.Format("{0}&result_type={1}", fullUrl, search.ResultType);
            }

            if (search.GeoInfoCode != null && !string.IsNullOrEmpty(search.GeoInfoCode.Latitude))
            {
                fullUrl = string.Format("{0}&geocode={1}", fullUrl, search.GeoInfoCode.Code);
            }

            string signatureString           = _oAuthCreationService.CreateSignature(url);
            string authorizationHeaderParams = _oAuthCreationService.CreateAuthorizationHeaderParameter(
                signatureString, _oAuthCreationService.OAuthTimeStamp);

            string         method         = "GET";
            HttpWebRequest request        = _httpRequestResponse.GetRequest(fullUrl, authorizationHeaderParams, method);
            var            responseText   = _httpRequestResponse.GetResponse(request);
            var            searchResponse = _mapSearch.Map(responseText);

            return(searchResponse);
        }