예제 #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;
 }
예제 #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);
        }
예제 #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);
 }
예제 #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() ?? "");
        }
예제 #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() ?? "");
        }
예제 #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);
        }
예제 #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());
        }
예제 #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());
        }
예제 #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());
        }
예제 #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());
        }