Esempio n. 1
0
        static void Main(string[] args)
        {
            //see README.md for info on how to set secrets on your system
            var apiKey            = Environment.GetEnvironmentVariable("TwitterApiKey");
            var apiKeySecret      = Environment.GetEnvironmentVariable("TwitterApiKeySecret");
            var accessToken       = Environment.GetEnvironmentVariable("TwitterAccessToken");
            var accessTokenSecret = Environment.GetEnvironmentVariable("TwitterAccessTokenSecret");

            if (apiKey != null && apiKeySecret != null && accessToken != null && accessTokenSecret != null)
            {
                var twitterClient    = new TwitterHttpClient(apiKey, apiKeySecret, accessToken, accessTokenSecret);
                var gitHubHttpClient = new GitHubHttpClient();
                var runHistory       = new RunHistory();

                var app = new UpdateTwitterStatus(twitterClient, gitHubHttpClient, runHistory);
                app.Run().Wait();
            }
            else
            {
                Console.Error.WriteLine("Could not read Twitter secrets from environment variables. Aborting.");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor sets API clients and run history
 /// </summary>
 /// <param name="twitterClient"> Twitter API client </param>
 /// <param name="gitHubClient"> Github API client </param>
 /// <param name="runHistory"> The run history of tweets posted </param>
 public UpdateTwitterStatus(TwitterHttpClient twitterClient, GitHubHttpClient gitHubClient, RunHistory runHistory)
 {
     this.twitterClient    = twitterClient;
     this.gitHubHttpClient = gitHubClient;
     this.RunHistory       = runHistory;
 }