Beispiel #1
0
        public void Favorite(TwitterStatus t)
        {
            new Task(() =>
            {
                try
                {
                    foreach (ExtendedOAuthTokens o in m.NowTokens)
                    {
                        var f = TwitterFavorite.Create(o.OAuthTokens, t.Id);

                        if (f.Result != RequestResult.Success)
                        {
                            if (f.Result == RequestResult.RateLimited)
                            {
                                MConsole.WriteLine(o.UserName + " has been RateLimited. ResetDate must be " + f.RateLimiting.ResetDate.ToString() + ".");
                            }
                            else
                            {
                                MConsole.WriteLine("Some error happened : " + f.ErrorMessage);
                            }
                        }
                        else
                        {
                            MConsole.WriteLine("Success to favorite [" + t.User.ScreenName + ": " + t.Text + "] as " + o.UserName);
                        }
                    }
                }
                catch (Exception e)
                {
                    MConsole.WriteLine("Some error happened : " + e.Message);
                }
            }).Start();
        }
        public async void MakeRequestForTwitterFavorites()
        {
            var credentials = TestSettings.GetToken <Twitter, OAuth1Credentials>();

            if (credentials.IsTokenExpired)
            {
                throw new Exception("Expired credentials!!!");
            }

            var request  = new TwitterFavorite();
            var response = await new OAuthRequester(credentials)
                           .MakeOAuthRequestAsync <TwitterFavorite, TwitterFavoriteResponse>(request)
                           .ConfigureAwait(false);

            Assert.NotNull(response);
        }
Beispiel #3
0
        public void GroupFavorites()
        {
            // Get the first list, from @twit_er_izer
            TwitterResponse <TwitterStatusCollection> request1 = TwitterFavorite.List(new ListFavoritesOptions
            {
                UserNameOrId = "twit_er_izer"
            });

            // Get the second list, from @mschilling
            TwitterResponse <TwitterStatusCollection> request2 = TwitterFavorite.List(new ListFavoritesOptions
            {
                UserNameOrId = "mschilling"
            });

            //var combinedList = from t in request1.ResponseObject.Union(request2.ResponseObject)
            //                   group t by t.Id into g
            //                   select g.First();
        }
Beispiel #4
0
 public void PostFavorite(object statusId)
 {
     if (TwitterFavorite.PostFavorite((string)statusId))
     {
     }
 }