public async Task <IEnumerable <TweetApiDto> > GetTimeline(string id) { Guard.WhenArgument(id, "User Id").IsNullOrEmpty().Throw(); var twitterAccounts = await this.UserRepository.GetAllFavoriteTwitterAccounts(id); Guard.WhenArgument(twitterAccounts, "Twitter Accounts").IsNull().Throw(); var twitterAccountsDto = this.MappingProvider.ProjectTo <TwitterAccount, TwitterAccountDto>(twitterAccounts); Guard.WhenArgument(twitterAccountsDto, "Twitter AccountsDto").IsNull().Throw(); var sb = new StringBuilder(); foreach (var twitterAccount in twitterAccountsDto) { sb.Append($"{twitterAccount.Id},"); } if (sb.Length == 0) { return(new List <TweetApiDto>()); } sb.Length--; var timeline = await twitterService.GetTimeline(sb.ToString()); Guard.WhenArgument(timeline, "Timeline").IsNull().Throw(); return(timeline); }
/// <summary> /// Get the twitter timeline for our configured account. /// </summary> private async void GetEventTimeline() { if (_twitterService.AccessGranted) { TwitterBtnContent = _loader.GetString("ChangeAccTwitter"); ShowTwitterProgress = true; var result = await _twitterService.GetTimeline(); Timeline = Newtonsoft.Json.JsonConvert.DeserializeObject <ObservableCollection <TwitterItem> >(result); ShowTwitterProgress = false; } }