コード例 #1
0
 public void Init()
 {
     var dataHelper = new DataHelper(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "/App_Data/apps.json");
     var apps = dataHelper.GetApps();
     _twitter = apps.First(a => a.SiteName == "Twitter");
     _searchHelper = new SearchHelper();
 }
コード例 #2
0
        public List<UserProfile> SearchTwitter(SocialApp app, string searchText)
        {
            var userProfiles = new List<UserProfile>();
            // Initialize a new OAuth client from the consumer key and secret
            var client = new TwitterOAuthClient(app.ApiKey, app.ApiSecret, app.Token, app.TokenSecret);

            var service = TwitterService.CreateFromOAuthClient(client);

            var response = service.Users.Search(searchText);

            //TO DO Url is returning null so had to hard code it with screen name , look at this later
            return response.Body.Select(u => new UserProfile
                {
                    ImageUrl = u.ProfileImageUrl,
                    Name = u.Name,
                    ProfileLink = "https://twitter.com/"  + u.ScreenName
                }).ToList();
        }