Ejemplo n.º 1
0
 private static TwitterService CreateTwitterService(TwitterCredentials credentials)
 {
     var service = new TwitterService(credentials.ConsumerKey, credentials.ConsumerSecret);
     if (!string.IsNullOrEmpty(credentials.AccessToken) || !string.IsNullOrEmpty(credentials.AccessTokenSecret))
     {
         service.AuthenticateWith(credentials.AccessToken, credentials.AccessTokenSecret);
     }
     return service;
 }
Ejemplo n.º 2
0
        private static TwitterService CreateTwitterService(TwitterCredentials credentials)
        {
            var service = new TwitterService(credentials.ConsumerKey, credentials.ConsumerSecret);

            if (!string.IsNullOrEmpty(credentials.AccessToken) || !string.IsNullOrEmpty(credentials.AccessTokenSecret))
            {
                service.AuthenticateWith(credentials.AccessToken, credentials.AccessTokenSecret);
            }
            return(service);
        }
Ejemplo n.º 3
0
 public async Task MainAsync(string[] args)
 {
     var credentials = new TwitterCredentials
     {
     };
     await PullUser(new []{ "", "", "" }, credentials);
     //await PullTweetsForScreenName("", credentials);
     //await PullReceivedDirectMessages(credentials);
     //await PullSentDirectMessages(credentials);
 }
Ejemplo n.º 4
0
        private static async Task PullUser(IEnumerable <string> screennames, TwitterCredentials credentials)
        {
            var service = CreateTwitterService(credentials);

            var r = await service.ListFriendshipsForAsync(new ListFriendshipsForOptions
            {
                ScreenName = screennames
            });

            Console.WriteLine(r.Value?.ToString() ?? "");
        }
Ejemplo n.º 5
0
        private static async Task PullUser(IEnumerable<string> screennames, TwitterCredentials credentials)
        {
            var service = CreateTwitterService(credentials);

            var r = await service.ListFriendshipsForAsync(new ListFriendshipsForOptions
            {
                ScreenName = screennames
            });
            
            Console.WriteLine(r.Value?.ToString() ?? "");
        }
Ejemplo n.º 6
0
        public async Task MainAsync(string[] args)
        {
            var credentials = new TwitterCredentials
            {
            };

            await PullUser(new [] { "", "", "" }, credentials);

            //await PullTweetsForScreenName("", credentials);
            //await PullReceivedDirectMessages(credentials);
            //await PullSentDirectMessages(credentials);
        }
Ejemplo n.º 7
0
        private static async Task PullTweetsForScreenName(string screenName, TwitterCredentials credentials)
        {
            var service = CreateTwitterService(credentials);

            var r = await service.ListTweetsOnUserTimelineAsync(new ListTweetsOnUserTimelineOptions
            {
                ScreenName = screenName,
                Count = 200,
                SinceId = 100
            });
            Console.WriteLine(r.Value == null ? 0 : r.Value.Count());
        }
Ejemplo n.º 8
0
        private static async Task PullTweetsForScreenName(string screenName, TwitterCredentials credentials)
        {
            var service = CreateTwitterService(credentials);

            var r = await service.ListTweetsOnUserTimelineAsync(new ListTweetsOnUserTimelineOptions
            {
                ScreenName = screenName,
                Count      = 200,
                SinceId    = 100
            });

            Console.WriteLine(r.Value == null ? 0 : r.Value.Count());
        }
Ejemplo n.º 9
0
        private static async Task PullSentDirectMessages(TwitterCredentials credentials)
        {
            var service = new TwitterService(credentials.ConsumerKey, credentials.ConsumerSecret);
            if (!string.IsNullOrEmpty(credentials.AccessToken) || !string.IsNullOrEmpty(credentials.AccessTokenSecret))
            {
                service.AuthenticateWith(credentials.AccessToken, credentials.AccessTokenSecret);
            }

            var r = await service.ListDirectMessagesSentAsync(new ListDirectMessagesSentOptions
            {
                Count = 200
            });
            Console.WriteLine(r.Value == null ? 0 : r.Value.Count());
        }
Ejemplo n.º 10
0
        private static async Task PullSentDirectMessages(TwitterCredentials credentials)
        {
            var service = new TwitterService(credentials.ConsumerKey, credentials.ConsumerSecret);

            if (!string.IsNullOrEmpty(credentials.AccessToken) || !string.IsNullOrEmpty(credentials.AccessTokenSecret))
            {
                service.AuthenticateWith(credentials.AccessToken, credentials.AccessTokenSecret);
            }

            var r = await service.ListDirectMessagesSentAsync(new ListDirectMessagesSentOptions
            {
                Count = 200
            });

            Console.WriteLine(r.Value == null ? 0 : r.Value.Count());
        }