private void LoadTwitterLogin(TwitterCredentials twitterCreds) { _twitterHttpClient = new TwitterHttpClient(twitterCreds); _loginUser = _twitterHttpClient.GetAuthenticatedUser(); if (_loginUser == null) { WindowTitle = SelectedUserModelIsNullMessage = $"Login user {twitterCreds.ScreenName} not authenticated"; GroupModelList = new List <GroupModel>(); SelectedUserModel = null; return; } _selectedTwitterLogin = twitterCreds.ScreenName; _logingGoupSettingsFileName = $"{twitterCreds.ScreenName}_GroupSettings.json"; List <Group> groupList = LoadGroupsFromFile(); var groupModelList = groupList.Select(x => new GroupModel(x.Name, GetGroupImagePath(x.Name)) { GroupScreenNamelList = x.ScreenNameList }) .ToList(); RefreshFriends(groupModelList); WindowTitle = $"Login: {_loginUser.Name} (@{_loginUser.ScreenName})"; SelectedUserModelIsNullMessage = "Click on a user on the left"; SelectedUserModel = null; }
public Task <HttpResponseMessage> GetLocationBasedConnection(string location) { if (_httpClient != null) { throw new NotSupportedException("Multiple connections with one instance of TwitterConnector is not allowed"); } TwitterQueryCollection collection = new TwitterQueryCollection(); //{southwest}long,lat,{northeast}long,lat //The polygon which covers the whole world //collection.Add("locations", "-165.0,-75.0,165.0,75.0"); collection.Add("locations", location); _httpClient = new TwitterHttpClient(_creds, _signatureEntity, collection); _httpClient.Timeout = TimeSpan.FromMilliseconds(Timeout.Infinite); var filterContent = new StringContent(collection.ToString()); filterContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); var filterRequest = new HttpRequestMessage(HttpMethod.Post, filterEndpointUri); filterRequest.Content = filterContent; return(_httpClient.SendAsync(filterRequest, HttpCompletionOption.ResponseHeadersRead)); }
public MainViewModel() { _twitterHttpClient = new TwitterHttpClient(App.TwitterCreds); RefreshCommand = new DelegateCommand(ExecuteRefreshCommand); OpenUrlCommand = new DelegateCommand <string>(ExecuteOpenUrlCommand); RefreshUserTweetsRetweetsCommand = new DelegateCommand(ExecuteRefreshUserTweetsRetweetsCommand); _groupNameImageChoiceDic = new Dictionary <string, GroupImageChoice>(); _lastUsedGroupImageChoice = GroupImageChoice.None; }
public Task <HttpResponseMessage> GetSampleFirehoseConnection() { if (_httpClient != null) { throw new NotSupportedException("Multiple connections with one instance of TwitterConnector is not allowed"); } _httpClient = new TwitterHttpClient(_creds, _signatureEntity); _httpClient.Timeout = TimeSpan.FromMilliseconds(Timeout.Infinite); return(_httpClient.GetAsync(sampleEndpointUri, HttpCompletionOption.ResponseHeadersRead)); }
private bool TwitterLogin(TwitterCredentials twitterCreds) { _twitterHttpClient = new TwitterHttpClient(twitterCreds); _loginUser = _twitterHttpClient.GetAuthenticatedUser(); if (_loginUser == null) { return(false); } WindowTitle = $"Prism Twitter Reader Login: {_loginUser.Name} (@{_loginUser.ScreenName})"; CurrentStatusMessage = "Click a 'Show' button to load the corresponding module"; return(true); }
public void Setup() { TwitterCredentials twitterCreds = null; string jsonFilePath = Path.Combine( @"e:\FileSync\SyncProjects\TwitterReader\TwitterReader\", @"TwitterCredentials.json"); Assert.IsTrue(File.Exists(jsonFilePath)); twitterCreds = JsonHelper.DeserializeFromFile <TwitterCredentials>(jsonFilePath); Assert.IsNotNull(twitterCreds); _client = new TwitterHttpClient(twitterCreds); Assert.IsNotNull(_client); }
public TwitterHttpClientTests() { _auth = A.Fake <IAuthCredentials>(); _httpClient = A.Fake <IHttpClient>(); _client = new TwitterHttpClient(_httpClient, _auth); }
public TwitterExplorer() { twitterClient = new TwitterHttpClient(); neo4jClient = new Client(); }