Beispiel #1
0
        public static async Task AddCurrentStarsToTable()
        {
            (_, string json) = GitHubAPI.RequestRepo("scottplot", "scottplot", GetGitHubToken());
            int stars = GitHubAPI.TotalStars(json);

            Functions.StarsTable table = new Functions.StarsTable(GetConnectionString());
            await table.Insert("scottplot", "scottplot", stars, DateTime.Now);
        }
Beispiel #2
0
        public static void RunAsync([TimerTrigger(TRIGGER_DAILY)] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");

            var    db       = new StarsTable(log);
            string userName = "******";
            string repoName = "scottplot";

            // add the latest star count to the database
            string gitHubToken = Environment.GetEnvironmentVariable("GitHubToken", EnvironmentVariableTarget.Process);

            (var _, string json) = GitHubAPI.RequestRepo(userName, repoName, gitHubToken);
            int stars = GitHubAPI.TotalStars(json);

            db.Insert(userName, repoName, stars, DateTime.UtcNow).GetAwaiter().GetResult();

            // plot historical star count as an image and upload it
            var bmp = db.GetGraphBitmap();

            db.UploadImage(bmp).GetAwaiter().GetResult();
        }
Beispiel #3
0
 public static void ViewCurrentStars()
 {
     (_, string json) = GitHubAPI.RequestRepo("scottplot", "scottplot", GetGitHubToken());
     Console.WriteLine($"STARS: {GitHubAPI.TotalStars(json)}");
 }