| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- using System;
- using System.Net;
- using System.Net.Http.Headers;
- using BlackRockReportFunction.Bussines;
- using Microsoft.Azure.Functions.Worker;
- using Microsoft.Extensions.Logging;
- using BlackRockReportFunction.Models;
- using Newtonsoft.Json;
-
- namespace BlackRockReportFunction
- {
- public class ClockifyApiIntegrationFunction
- {
- private readonly ILogger _logger;
-
- public ClockifyApiIntegrationFunction(ILoggerFactory loggerFactory)
- {
- _logger = loggerFactory.CreateLogger<ClockifyApiIntegrationFunction>();
- }
-
- [Function("ClockifyApiIntegrationFunction")]
- [QueueOutput("queue1")]
- public string Run([TimerTrigger("*/15 * * * * *")] MyInfo myTimer)
- {
- ClockifyReports.InitializeClockifyIntegration();
-
- var testObject = new ClockifyReport
- {
- reportName = "BlackRockReport_20220615",
- reportDescription = "Total (13/06/2022 - 15/06/2022)",
- reportPeople = new List<Person>
- {
- new Person
- {
- fullName = "Nikola Jovanovic",
- records = new List<ClockifyRecord>
- {
- new ClockifyRecord
- {
- recordDescription = "massa placerat duis ultricies lacus sed turpis tincidunt id aliquet risus feugiat in ante metus dictum at tempor commodo ullamcorper",
- recordTime = new TimeOnly(3,15,44),
- amount = 200
- },
- new ClockifyRecord
- {
- recordDescription = "et tortor at risus viverra adipiscing at in tellus integer feugiat scelerisque varius morbi enim nunc faucibus a pellentesque sit",
- recordTime = new TimeOnly(3,15,44),
- amount = 150
- }
- }
- },
- new Person
- {
- fullName = "Boris Stevanovic",
- records = new List<ClockifyRecord>
- {
- new ClockifyRecord
- {
- recordDescription = "iaculis urna id volutpat lacus laoreet non curabitur gravida arcu ac tortor dignissim convallis aenean et tortor at risus viverra",
- recordTime = new TimeOnly(3,15,44),
- amount = 300
- },
- new ClockifyRecord
- {
- recordDescription = "gravida arcu ac tortor dignissim convallis aenean et tortor at risus viverra adipiscing at in tellus integer feugiat scelerisque varius",
- recordTime = new TimeOnly(3,15,44),
- amount = 100
- },
- new ClockifyRecord
- {
- recordDescription = "sit amet massa vitae tortor condimentum lacinia quis vel eros donec ac odio tempor orci dapibus ultrices in iaculis nunc",
- recordTime = new TimeOnly(3,15,44),
- amount = 120
- }
- }
- },
- new Person
- {
- fullName = "Dunja Stevanovic",
- records = new List<ClockifyRecord>
- {
- new ClockifyRecord
- {
- recordDescription = "vulputate mi sit amet mauris commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc",
- recordTime = new TimeOnly(3,15,44),
- amount = 50
- },
- new ClockifyRecord
- {
- recordDescription = "senectus et netus et malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi leo urna molestie at elementum eu",
- recordTime = new TimeOnly(3,15,44),
- amount = 500
- }
- }
- }
- }
- };
-
- _logger.LogInformation($"Data collection successfull!");
-
- return JsonConvert.SerializeObject(testObject);
- }
- }
-
- 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; }
- }
- }
|