Black Rock Reporting Azure Function
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ClockifyApiIntegrationFunction.cs 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using System;
  2. using System.Net;
  3. using System.Net.Http.Headers;
  4. using BlackRockReportFunction.Bussines;
  5. using Microsoft.Azure.Functions.Worker;
  6. using Microsoft.Extensions.Logging;
  7. using BlackRockReportFunction.Models;
  8. using Newtonsoft.Json;
  9. namespace BlackRockReportFunction
  10. {
  11. public class ClockifyApiIntegrationFunction
  12. {
  13. private readonly ILogger _logger;
  14. public ClockifyApiIntegrationFunction(ILoggerFactory loggerFactory)
  15. {
  16. _logger = loggerFactory.CreateLogger<ClockifyApiIntegrationFunction>();
  17. }
  18. [Function("ClockifyApiIntegrationFunction")]
  19. [QueueOutput("queue1")]
  20. public string Run([TimerTrigger("*/15 * * * * *")] MyInfo myTimer)
  21. {
  22. ClockifyReports.InitializeClockifyIntegration();
  23. var testObject = new ClockifyReport
  24. {
  25. reportName = "BlackRockReport_20220615",
  26. reportDescription = "Total (13/06/2022 - 15/06/2022)",
  27. reportPeople = new List<Person>
  28. {
  29. new Person
  30. {
  31. fullName = "Nikola Jovanovic",
  32. records = new List<ClockifyRecord>
  33. {
  34. new ClockifyRecord
  35. {
  36. recordDescription = "massa placerat duis ultricies lacus sed turpis tincidunt id aliquet risus feugiat in ante metus dictum at tempor commodo ullamcorper",
  37. recordTime = new TimeOnly(3,15,44),
  38. amount = 200
  39. },
  40. new ClockifyRecord
  41. {
  42. recordDescription = "et tortor at risus viverra adipiscing at in tellus integer feugiat scelerisque varius morbi enim nunc faucibus a pellentesque sit",
  43. recordTime = new TimeOnly(3,15,44),
  44. amount = 150
  45. }
  46. }
  47. },
  48. new Person
  49. {
  50. fullName = "Boris Stevanovic",
  51. records = new List<ClockifyRecord>
  52. {
  53. new ClockifyRecord
  54. {
  55. recordDescription = "iaculis urna id volutpat lacus laoreet non curabitur gravida arcu ac tortor dignissim convallis aenean et tortor at risus viverra",
  56. recordTime = new TimeOnly(3,15,44),
  57. amount = 300
  58. },
  59. new ClockifyRecord
  60. {
  61. recordDescription = "gravida arcu ac tortor dignissim convallis aenean et tortor at risus viverra adipiscing at in tellus integer feugiat scelerisque varius",
  62. recordTime = new TimeOnly(3,15,44),
  63. amount = 100
  64. },
  65. new ClockifyRecord
  66. {
  67. recordDescription = "sit amet massa vitae tortor condimentum lacinia quis vel eros donec ac odio tempor orci dapibus ultrices in iaculis nunc",
  68. recordTime = new TimeOnly(3,15,44),
  69. amount = 120
  70. }
  71. }
  72. },
  73. new Person
  74. {
  75. fullName = "Dunja Stevanovic",
  76. records = new List<ClockifyRecord>
  77. {
  78. new ClockifyRecord
  79. {
  80. recordDescription = "vulputate mi sit amet mauris commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc",
  81. recordTime = new TimeOnly(3,15,44),
  82. amount = 50
  83. },
  84. new ClockifyRecord
  85. {
  86. recordDescription = "senectus et netus et malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi leo urna molestie at elementum eu",
  87. recordTime = new TimeOnly(3,15,44),
  88. amount = 500
  89. }
  90. }
  91. }
  92. }
  93. };
  94. _logger.LogInformation($"Data collection successfull!");
  95. return JsonConvert.SerializeObject(testObject);
  96. }
  97. }
  98. public class MyInfo
  99. {
  100. public MyScheduleStatus ScheduleStatus { get; set; }
  101. public bool IsPastDue { get; set; }
  102. }
  103. public class MyScheduleStatus
  104. {
  105. public DateTime Last { get; set; }
  106. public DateTime Next { get; set; }
  107. public DateTime LastUpdated { get; set; }
  108. }
  109. }