| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Net;
- using System.Net.Http.Headers;
- using Microsoft.Azure.Functions.Worker;
- using Microsoft.Extensions.Logging;
-
- namespace BlackRockReportFunction
- {
- public class ClockifyApiIntegrationFunction
- {
- private readonly ILogger _logger;
- public static HttpClient HttpApiClient { get; set; } = new HttpClient();
-
- public ClockifyApiIntegrationFunction(ILoggerFactory loggerFactory)
- {
- _logger = loggerFactory.CreateLogger<ClockifyApiIntegrationFunction>();
- }
-
- public static void InitializeClockifyIntegration()
- {
- HttpApiClient = new HttpClient();
- HttpApiClient.BaseAddress = new Uri("https://reports.api.clockify.me/v1");
- HttpApiClient.DefaultRequestHeaders.Accept.Clear();
- HttpApiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- }
-
- public static void GetReportsFromClockify(string url)
- {
- //adding api key header
- HttpApiClient.DefaultRequestHeaders.Add("X-Api-Key", "*********");
-
- //making request
-
-
- }
-
- [Function("ClockifyApiIntegrationFunction")]
- public void Run([TimerTrigger("*/5 * * * * *")] MyInfo myTimer)
- {
- _logger.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
-
-
- }
-
-
- }
-
- public class MyInfo
- {
- public MyScheduleStatus ScheduleStatus { get; set; }
-
- public bool IsPastDue { get; set; }
- }
-
- public class MyScheduleStatus
- {
- public DateTime Last { get; set; }
-
- public DateTime Next { get; set; }
-
- public DateTime LastUpdated { get; set; }
- }
- }
|