Пример #1
0
        public comparing_two_users_followers_tests()
        {
            var            customerKey    = ConfigurationManager.AppSettings["CustomerKey"];
            var            customerSecret = ConfigurationManager.AppSettings["CustomerSecret"];
            ITokenProvider tokenProvider  = new OAuthTwitterToken();

            _compareUsersFollowers = new CompareUsersFollowers(tokenProvider.GetAsync(customerKey, customerSecret).Result);
        }
Пример #2
0
        public get_info_about_user_tests()
        {
            var            customerKey    = ConfigurationManager.AppSettings["CustomerKey"];
            var            customerSecret = ConfigurationManager.AppSettings["CustomerSecret"];
            ITokenProvider tokenProvider  = new OAuthTwitterToken();

            _userInformation = new UserInformation(tokenProvider.GetAsync(customerKey, customerSecret).Result);
        }
Пример #3
0
        private async Task <string> Execute(string name)
        {
            string url = $"https://api.twitter.com/1.1/friends/list.json?screen_name={name}";

            var httpClient = new HttpClient();

            string         customerKey    = ConfigurationManager.AppSettings["CustomerKey"];
            string         customerSecret = ConfigurationManager.AppSettings["CustomerSecret"];
            ITokenProvider tokenProvider  = new OAuthTwitterToken();
            string         token          = await tokenProvider.GetAsync(customerKey, customerSecret);

            httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);

            return(httpClient.GetAsync(url).Result.Content.ReadAsStringAsync().Result);
        }