@kingstinct/react-native-healthkit 13.4.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/ReactNativeHealthkit.podspec +1 -0
  2. package/app.plugin.ts +40 -2
  3. package/ios/BackgroundDeliveryManager.swift +196 -0
  4. package/ios/CategoryTypeModule.swift +1 -1
  5. package/ios/CoreModule.swift +24 -0
  6. package/ios/CorrelationTypeModule.swift +2 -35
  7. package/ios/ElectrocardiogramModule.swift +2 -34
  8. package/ios/HeartbeatSeriesModule.swift +2 -34
  9. package/ios/MedicationModule.swift +3 -35
  10. package/ios/PredicateHelpers.swift +2 -2
  11. package/ios/QuantityTypeModule.swift +11 -11
  12. package/ios/Serializers.swift +58 -90
  13. package/ios/StateOfMindModule.swift +2 -34
  14. package/ios/WorkoutProxy.swift +3 -149
  15. package/ios/generated/HealthkitGenerated.swift +52 -0
  16. package/lib/commonjs/generated/healthkit.generated.js +745 -0
  17. package/lib/commonjs/healthkit.ios.js +51 -17
  18. package/lib/commonjs/healthkit.js +120 -34
  19. package/lib/commonjs/specs/QuantityTypeModule.nitro.js +1 -0
  20. package/lib/commonjs/type-tests/generated-typing.js +2 -0
  21. package/lib/commonjs/types/CategoryType.js +19 -99
  22. package/lib/commonjs/types/Medication.js +2 -0
  23. package/lib/commonjs/types/MetadataEnums.js +17 -0
  24. package/lib/commonjs/types/QuantityType.js +4 -15
  25. package/lib/commonjs/types/WeatherCondition.js +2 -32
  26. package/lib/commonjs/types/Workouts.js +3 -98
  27. package/lib/commonjs/types/index.js +2 -0
  28. package/lib/module/generated/healthkit.generated.js +742 -0
  29. package/lib/module/healthkit.ios.js +49 -15
  30. package/lib/module/healthkit.js +94 -20
  31. package/lib/module/specs/QuantityTypeModule.nitro.js +1 -0
  32. package/lib/module/type-tests/generated-typing.js +1 -0
  33. package/lib/module/types/CategoryType.js +2 -98
  34. package/lib/module/types/Medication.js +1 -0
  35. package/lib/module/types/MetadataEnums.js +1 -0
  36. package/lib/module/types/QuantityType.js +2 -14
  37. package/lib/module/types/WeatherCondition.js +1 -32
  38. package/lib/module/types/Workouts.js +2 -98
  39. package/lib/module/types/index.js +2 -0
  40. package/lib/typescript/generated/healthkit.generated.d.ts +1006 -0
  41. package/lib/typescript/healthkit.d.ts +39 -36
  42. package/lib/typescript/healthkit.ios.d.ts +64 -53
  43. package/lib/typescript/hooks/useMostRecentQuantitySample.d.ts +3 -2
  44. package/lib/typescript/hooks/useMostRecentWorkout.d.ts +2 -2
  45. package/lib/typescript/hooks/useQuantitySampleById.d.ts +5 -4
  46. package/lib/typescript/hooks/useStatisticsForQuantity.d.ts +2 -2
  47. package/lib/typescript/hooks/useSubscribeToQuantitySamples.d.ts +1 -1
  48. package/lib/typescript/modules.d.ts +2 -2
  49. package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +3 -3
  50. package/lib/typescript/specs/CoreModule.nitro.d.ts +15 -0
  51. package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +20 -9
  52. package/lib/typescript/type-tests/generated-typing.d.ts +1 -0
  53. package/lib/typescript/types/CategoryType.d.ts +10 -104
  54. package/lib/typescript/types/CategoryTypeIdentifier.d.ts +1 -61
  55. package/lib/typescript/types/CorrelationType.d.ts +8 -2
  56. package/lib/typescript/types/ElectrocardiogramSample.d.ts +8 -1
  57. package/lib/typescript/types/HeartbeatSeries.d.ts +8 -1
  58. package/lib/typescript/types/InterfaceVerification.d.ts +14 -1
  59. package/lib/typescript/types/Medication.d.ts +10 -0
  60. package/lib/typescript/types/MetadataEnums.d.ts +1 -0
  61. package/lib/typescript/types/QuantitySample.d.ts +9 -1
  62. package/lib/typescript/types/QuantityType.d.ts +14 -18
  63. package/lib/typescript/types/QuantityTypeIdentifier.d.ts +1 -671
  64. package/lib/typescript/types/QueryOptions.d.ts +8 -4
  65. package/lib/typescript/types/Shared.d.ts +12 -41
  66. package/lib/typescript/types/StateOfMind.d.ts +8 -1
  67. package/lib/typescript/types/Subscriptions.d.ts +11 -11
  68. package/lib/typescript/types/WeatherCondition.d.ts +1 -30
  69. package/lib/typescript/types/Workouts.d.ts +18 -104
  70. package/lib/typescript/types/index.d.ts +2 -0
  71. package/lib/typescript/utils/getMostRecentQuantitySample.d.ts +2 -1
  72. package/lib/typescript/utils/getMostRecentWorkout.d.ts +2 -1
  73. package/lib/typescript/utils/getPreferredUnit.d.ts +2 -1
  74. package/lib/typescript/utils/getQuantitySampleById.d.ts +2 -1
  75. package/lib/typescript/utils/subscribeToQuantitySamples.d.ts +1 -1
  76. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +55 -109
  77. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +12 -18
  78. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +5 -14
  79. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +18 -2
  80. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +1 -13
  81. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +1 -13
  82. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +2 -14
  83. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +1 -13
  84. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +19 -28
  85. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +2 -14
  86. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +2 -115
  87. package/nitrogen/generated/ios/swift/CategorySample.swift +4 -329
  88. package/nitrogen/generated/ios/swift/CategoryTypeIdentifier.swift +112 -108
  89. package/nitrogen/generated/ios/swift/CategoryTypeIdentifierWriteable.swift +292 -0
  90. package/nitrogen/generated/ios/swift/CorrelationSample.swift +4 -347
  91. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +4 -329
  92. package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +30 -30
  93. package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +30 -30
  94. package/nitrogen/generated/ios/swift/GeneralForm.swift +4 -4
  95. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +4 -329
  96. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
  97. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +1 -1
  98. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -0
  99. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +38 -0
  100. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +6 -6
  101. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +6 -6
  102. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +1 -27
  103. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +2 -340
  104. package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +4 -329
  105. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +492 -492
  106. package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -329
  107. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +380 -384
  108. package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +372 -376
  109. package/nitrogen/generated/ios/swift/{QueryOptionsWithAnchorAndUnit.swift → QueryOptionsWithAnchorAndStringUnit.swift} +5 -5
  110. package/nitrogen/generated/ios/swift/{QueryOptionsWithSortOrderAndUnit.swift → QueryOptionsWithSortOrderAndStringUnit.swift} +5 -5
  111. package/nitrogen/generated/ios/swift/QueryStatisticsResponseFromSingleSource.swift +37 -37
  112. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +492 -492
  113. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +482 -486
  114. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +4 -329
  115. package/nitrogen/generated/ios/swift/{StatisticsQueryOptions.swift → StatisticsQueryOptionsWithStringUnit.swift} +5 -5
  116. package/nitrogen/generated/ios/swift/WorkoutSample.swift +4 -402
  117. package/nitrogen/generated/shared/c++/CategorySample.hpp +8 -100
  118. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +153 -149
  119. package/nitrogen/generated/shared/c++/CategoryTypeIdentifierWriteable.hpp +328 -0
  120. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +9 -105
  121. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -99
  122. package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +13 -13
  123. package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +13 -13
  124. package/nitrogen/generated/shared/c++/GeneralForm.hpp +7 -7
  125. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +8 -100
  126. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +5 -2
  127. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +2 -0
  128. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -2
  129. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +15 -15
  130. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +1 -27
  131. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +2 -37
  132. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -99
  133. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +565 -565
  134. package/nitrogen/generated/shared/c++/QuantitySample.hpp +8 -100
  135. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +407 -411
  136. package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +398 -402
  137. package/nitrogen/generated/shared/c++/{QueryOptionsWithAnchorAndUnit.hpp → QueryOptionsWithAnchorAndStringUnit.hpp} +11 -11
  138. package/nitrogen/generated/shared/c++/{QueryOptionsWithSortOrderAndUnit.hpp → QueryOptionsWithSortOrderAndStringUnit.hpp} +11 -11
  139. package/nitrogen/generated/shared/c++/QueryStatisticsResponseFromSingleSource.hpp +12 -12
  140. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +559 -559
  141. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +541 -545
  142. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +8 -100
  143. package/nitrogen/generated/shared/c++/{StatisticsQueryOptions.hpp → StatisticsQueryOptionsWithStringUnit.hpp} +11 -11
  144. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +7 -120
  145. package/package.json +5 -2
  146. package/src/generated/healthkit-schema.json +3680 -0
  147. package/src/generated/healthkit.generated.ts +1307 -0
  148. package/src/healthkit.ios.ts +225 -19
  149. package/src/healthkit.ts +181 -55
  150. package/src/hooks/useMostRecentQuantitySample.ts +6 -5
  151. package/src/hooks/useMostRecentWorkout.ts +2 -2
  152. package/src/hooks/useQuantitySampleById.ts +6 -5
  153. package/src/hooks/useStatisticsForQuantity.ts +2 -1
  154. package/src/hooks/useSubscribeToQuantitySamples.ts +1 -1
  155. package/src/modules.ts +7 -2
  156. package/src/specs/CategoryTypeModule.nitro.ts +8 -5
  157. package/src/specs/CoreModule.nitro.ts +20 -0
  158. package/src/specs/QuantityTypeModule.nitro.ts +81 -7
  159. package/src/test-setup.ts +2 -0
  160. package/src/type-tests/generated-typing.ts +133 -0
  161. package/src/types/CategoryType.ts +52 -148
  162. package/src/types/CategoryTypeIdentifier.ts +5 -134
  163. package/src/types/CorrelationType.ts +13 -3
  164. package/src/types/ElectrocardiogramSample.ts +13 -1
  165. package/src/types/HeartbeatSeries.ts +13 -1
  166. package/src/types/InterfaceVerification.ts +38 -1
  167. package/src/types/Medication.ts +19 -0
  168. package/src/types/MetadataEnums.ts +15 -0
  169. package/src/types/QuantitySample.ts +14 -2
  170. package/src/types/QuantityType.ts +22 -122
  171. package/src/types/QuantityTypeIdentifier.ts +5 -772
  172. package/src/types/QueryOptions.ts +11 -4
  173. package/src/types/Shared.ts +22 -49
  174. package/src/types/StateOfMind.ts +13 -1
  175. package/src/types/Subscriptions.ts +19 -13
  176. package/src/types/WeatherCondition.ts +1 -31
  177. package/src/types/Workouts.ts +44 -108
  178. package/src/types/index.ts +2 -0
  179. package/src/utils/getMostRecentQuantitySample.ts +4 -3
  180. package/src/utils/getMostRecentWorkout.ts +5 -2
  181. package/src/utils/getPreferredUnit.ts +5 -4
  182. package/src/utils/getQuantitySampleById.ts +4 -3
  183. package/src/utils/subscribeToQuantitySamples.ts +5 -3
  184. package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +0 -44
  185. package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +0 -40
  186. package/nitrogen/generated/ios/swift/WeatherCondition.swift +0 -144
  187. package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +0 -67
  188. package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +0 -62
  189. package/nitrogen/generated/shared/c++/WeatherCondition.hpp +0 -88
@@ -15,6 +15,8 @@
15
15
 
16
16
  // Forward declaration of `CategorySample` to properly resolve imports.
17
17
  namespace margelo::nitro::healthkit { struct CategorySample; }
18
+ // Forward declaration of `CategoryTypeIdentifierWriteable` to properly resolve imports.
19
+ namespace margelo::nitro::healthkit { enum class CategoryTypeIdentifierWriteable; }
18
20
  // Forward declaration of `CategoryTypeIdentifier` to properly resolve imports.
19
21
  namespace margelo::nitro::healthkit { enum class CategoryTypeIdentifier; }
20
22
  // Forward declaration of `QueryOptionsWithSortOrder` to properly resolve imports.
@@ -27,10 +29,11 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
27
29
  #include "CategorySample.hpp"
28
30
  #include <optional>
29
31
  #include <NitroModules/Promise.hpp>
30
- #include "CategoryTypeIdentifier.hpp"
32
+ #include "CategoryTypeIdentifierWriteable.hpp"
31
33
  #include <chrono>
32
34
  #include <NitroModules/AnyMap.hpp>
33
35
  #include <vector>
36
+ #include "CategoryTypeIdentifier.hpp"
34
37
  #include "QueryOptionsWithSortOrder.hpp"
35
38
  #include "CategorySamplesWithAnchorResponse.hpp"
36
39
  #include "QueryOptionsWithAnchor.hpp"
@@ -66,7 +69,7 @@ namespace margelo::nitro::healthkit {
66
69
 
67
70
  public:
68
71
  // Methods
69
- virtual std::shared_ptr<Promise<std::optional<CategorySample>>> saveCategorySample(CategoryTypeIdentifier identifier, double value, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const std::optional<std::shared_ptr<AnyMap>>& metadata) = 0;
72
+ virtual std::shared_ptr<Promise<std::optional<CategorySample>>> saveCategorySample(CategoryTypeIdentifierWriteable identifier, double value, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const std::optional<std::shared_ptr<AnyMap>>& metadata) = 0;
70
73
  virtual std::shared_ptr<Promise<std::vector<CategorySample>>> queryCategorySamples(CategoryTypeIdentifier identifier, const QueryOptionsWithSortOrder& options) = 0;
71
74
  virtual std::shared_ptr<Promise<CategorySamplesWithAnchorResponse>> queryCategorySamplesWithAnchor(CategoryTypeIdentifier identifier, const QueryOptionsWithAnchor& options) = 0;
72
75
 
@@ -17,6 +17,8 @@ namespace margelo::nitro::healthkit {
17
17
  prototype.registerHybridMethod("enableBackgroundDelivery", &HybridCoreModuleSpec::enableBackgroundDelivery);
18
18
  prototype.registerHybridMethod("disableBackgroundDelivery", &HybridCoreModuleSpec::disableBackgroundDelivery);
19
19
  prototype.registerHybridMethod("disableAllBackgroundDelivery", &HybridCoreModuleSpec::disableAllBackgroundDelivery);
20
+ prototype.registerHybridMethod("configureBackgroundTypes", &HybridCoreModuleSpec::configureBackgroundTypes);
21
+ prototype.registerHybridMethod("clearBackgroundTypes", &HybridCoreModuleSpec::clearBackgroundTypes);
20
22
  prototype.registerHybridMethod("isHealthDataAvailable", &HybridCoreModuleSpec::isHealthDataAvailable);
21
23
  prototype.registerHybridMethod("isHealthDataAvailableAsync", &HybridCoreModuleSpec::isHealthDataAvailableAsync);
22
24
  prototype.registerHybridMethod("isProtectedDataAvailable", &HybridCoreModuleSpec::isProtectedDataAvailable);
@@ -43,15 +43,15 @@ namespace margelo::nitro::healthkit { enum class SampleTypeIdentifierWriteable;
43
43
  #include <NitroModules/Promise.hpp>
44
44
  #include "ObjectTypeIdentifier.hpp"
45
45
  #include "UpdateFrequency.hpp"
46
+ #include <string>
47
+ #include <vector>
46
48
  #include <memory>
47
49
  #include "HybridSourceProxySpec.hpp"
48
50
  #include "IdentifierWithUnit.hpp"
49
- #include <vector>
50
51
  #include "QuantityTypeIdentifier.hpp"
51
52
  #include <optional>
52
53
  #include "SampleTypeIdentifier.hpp"
53
54
  #include "FilterForSamples.hpp"
54
- #include <string>
55
55
  #include "OnChangeCallbackArgs.hpp"
56
56
  #include <functional>
57
57
  #include "AuthorizationStatus.hpp"
@@ -95,6 +95,8 @@ namespace margelo::nitro::healthkit {
95
95
  virtual std::shared_ptr<Promise<bool>> enableBackgroundDelivery(ObjectTypeIdentifier typeIdentifier, UpdateFrequency updateFrequency) = 0;
96
96
  virtual std::shared_ptr<Promise<bool>> disableBackgroundDelivery(ObjectTypeIdentifier typeIdentifier) = 0;
97
97
  virtual std::shared_ptr<Promise<bool>> disableAllBackgroundDelivery() = 0;
98
+ virtual std::shared_ptr<Promise<bool>> configureBackgroundTypes(const std::vector<std::string>& typeIdentifiers, UpdateFrequency updateFrequency) = 0;
99
+ virtual std::shared_ptr<Promise<bool>> clearBackgroundTypes() = 0;
98
100
  virtual bool isHealthDataAvailable() = 0;
99
101
  virtual std::shared_ptr<Promise<bool>> isHealthDataAvailableAsync() = 0;
100
102
  virtual bool isProtectedDataAvailable() = 0;
@@ -21,22 +21,22 @@ namespace margelo::nitro::healthkit { enum class AggregationStyle; }
21
21
  namespace margelo::nitro::healthkit { struct QuantitySample; }
22
22
  // Forward declaration of `QuantityTypeIdentifierWriteable` to properly resolve imports.
23
23
  namespace margelo::nitro::healthkit { enum class QuantityTypeIdentifierWriteable; }
24
- // Forward declaration of `QueryOptionsWithSortOrderAndUnit` to properly resolve imports.
25
- namespace margelo::nitro::healthkit { struct QueryOptionsWithSortOrderAndUnit; }
24
+ // Forward declaration of `QueryOptionsWithSortOrderAndStringUnit` to properly resolve imports.
25
+ namespace margelo::nitro::healthkit { struct QueryOptionsWithSortOrderAndStringUnit; }
26
26
  // Forward declaration of `QueryStatisticsResponse` to properly resolve imports.
27
27
  namespace margelo::nitro::healthkit { struct QueryStatisticsResponse; }
28
28
  // Forward declaration of `StatisticsOptions` to properly resolve imports.
29
29
  namespace margelo::nitro::healthkit { enum class StatisticsOptions; }
30
- // Forward declaration of `StatisticsQueryOptions` to properly resolve imports.
31
- namespace margelo::nitro::healthkit { struct StatisticsQueryOptions; }
30
+ // Forward declaration of `StatisticsQueryOptionsWithStringUnit` to properly resolve imports.
31
+ namespace margelo::nitro::healthkit { struct StatisticsQueryOptionsWithStringUnit; }
32
32
  // Forward declaration of `IntervalComponents` to properly resolve imports.
33
33
  namespace margelo::nitro::healthkit { struct IntervalComponents; }
34
34
  // Forward declaration of `QueryStatisticsResponseFromSingleSource` to properly resolve imports.
35
35
  namespace margelo::nitro::healthkit { struct QueryStatisticsResponseFromSingleSource; }
36
36
  // Forward declaration of `QuantitySamplesWithAnchorResponse` to properly resolve imports.
37
37
  namespace margelo::nitro::healthkit { struct QuantitySamplesWithAnchorResponse; }
38
- // Forward declaration of `QueryOptionsWithAnchorAndUnit` to properly resolve imports.
39
- namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
38
+ // Forward declaration of `QueryOptionsWithAnchorAndStringUnit` to properly resolve imports.
39
+ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndStringUnit; }
40
40
 
41
41
  #include "QuantityTypeIdentifier.hpp"
42
42
  #include <string>
@@ -48,14 +48,14 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
48
48
  #include <chrono>
49
49
  #include <NitroModules/AnyMap.hpp>
50
50
  #include <vector>
51
- #include "QueryOptionsWithSortOrderAndUnit.hpp"
51
+ #include "QueryOptionsWithSortOrderAndStringUnit.hpp"
52
52
  #include "QueryStatisticsResponse.hpp"
53
53
  #include "StatisticsOptions.hpp"
54
- #include "StatisticsQueryOptions.hpp"
54
+ #include "StatisticsQueryOptionsWithStringUnit.hpp"
55
55
  #include "IntervalComponents.hpp"
56
56
  #include "QueryStatisticsResponseFromSingleSource.hpp"
57
57
  #include "QuantitySamplesWithAnchorResponse.hpp"
58
- #include "QueryOptionsWithAnchorAndUnit.hpp"
58
+ #include "QueryOptionsWithAnchorAndStringUnit.hpp"
59
59
 
60
60
  namespace margelo::nitro::healthkit {
61
61
 
@@ -91,12 +91,12 @@ namespace margelo::nitro::healthkit {
91
91
  virtual bool isQuantityCompatibleWithUnit(QuantityTypeIdentifier identifier, const std::string& unit) = 0;
92
92
  virtual AggregationStyle aggregationStyle(QuantityTypeIdentifier identifier) = 0;
93
93
  virtual std::shared_ptr<Promise<std::optional<QuantitySample>>> saveQuantitySample(QuantityTypeIdentifierWriteable identifier, const std::string& unit, double value, std::chrono::system_clock::time_point start, std::chrono::system_clock::time_point end, const std::optional<std::shared_ptr<AnyMap>>& metadata) = 0;
94
- virtual std::shared_ptr<Promise<std::vector<QuantitySample>>> queryQuantitySamples(QuantityTypeIdentifier identifier, const QueryOptionsWithSortOrderAndUnit& options) = 0;
95
- virtual std::shared_ptr<Promise<QueryStatisticsResponse>> queryStatisticsForQuantity(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, const std::optional<StatisticsQueryOptions>& options) = 0;
96
- virtual std::shared_ptr<Promise<std::vector<QueryStatisticsResponse>>> queryStatisticsCollectionForQuantity(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, std::chrono::system_clock::time_point anchorDate, const IntervalComponents& intervalComponents, const std::optional<StatisticsQueryOptions>& options) = 0;
97
- virtual std::shared_ptr<Promise<std::vector<QueryStatisticsResponseFromSingleSource>>> queryStatisticsForQuantitySeparateBySource(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, const std::optional<StatisticsQueryOptions>& options) = 0;
98
- virtual std::shared_ptr<Promise<std::vector<QueryStatisticsResponseFromSingleSource>>> queryStatisticsCollectionForQuantitySeparateBySource(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, std::chrono::system_clock::time_point anchorDate, const IntervalComponents& intervalComponents, const std::optional<StatisticsQueryOptions>& options) = 0;
99
- virtual std::shared_ptr<Promise<QuantitySamplesWithAnchorResponse>> queryQuantitySamplesWithAnchor(QuantityTypeIdentifier identifier, const QueryOptionsWithAnchorAndUnit& options) = 0;
94
+ virtual std::shared_ptr<Promise<std::vector<QuantitySample>>> queryQuantitySamples(QuantityTypeIdentifier identifier, const QueryOptionsWithSortOrderAndStringUnit& options) = 0;
95
+ virtual std::shared_ptr<Promise<QueryStatisticsResponse>> queryStatisticsForQuantity(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, const std::optional<StatisticsQueryOptionsWithStringUnit>& options) = 0;
96
+ virtual std::shared_ptr<Promise<std::vector<QueryStatisticsResponse>>> queryStatisticsCollectionForQuantity(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, std::chrono::system_clock::time_point anchorDate, const IntervalComponents& intervalComponents, const std::optional<StatisticsQueryOptionsWithStringUnit>& options) = 0;
97
+ virtual std::shared_ptr<Promise<std::vector<QueryStatisticsResponseFromSingleSource>>> queryStatisticsForQuantitySeparateBySource(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, const std::optional<StatisticsQueryOptionsWithStringUnit>& options) = 0;
98
+ virtual std::shared_ptr<Promise<std::vector<QueryStatisticsResponseFromSingleSource>>> queryStatisticsCollectionForQuantitySeparateBySource(QuantityTypeIdentifier identifier, const std::vector<StatisticsOptions>& statistics, std::chrono::system_clock::time_point anchorDate, const IntervalComponents& intervalComponents, const std::optional<StatisticsQueryOptionsWithStringUnit>& options) = 0;
99
+ virtual std::shared_ptr<Promise<QuantitySamplesWithAnchorResponse>> queryQuantitySamplesWithAnchor(QuantityTypeIdentifier identifier, const QueryOptionsWithAnchorAndStringUnit& options) = 0;
100
100
 
101
101
  protected:
102
102
  // Hybrid Setup
@@ -22,40 +22,14 @@ namespace margelo::nitro::healthkit {
22
22
  prototype.registerHybridGetter("totalFlightsClimbed", &HybridWorkoutProxySpec::getTotalFlightsClimbed);
23
23
  prototype.registerHybridGetter("events", &HybridWorkoutProxySpec::getEvents);
24
24
  prototype.registerHybridGetter("activities", &HybridWorkoutProxySpec::getActivities);
25
- prototype.registerHybridGetter("metadataAverageMETs", &HybridWorkoutProxySpec::getMetadataAverageMETs);
26
- prototype.registerHybridGetter("metadataElevationAscended", &HybridWorkoutProxySpec::getMetadataElevationAscended);
27
- prototype.registerHybridGetter("metadataElevationDescended", &HybridWorkoutProxySpec::getMetadataElevationDescended);
28
- prototype.registerHybridGetter("metadataIndoorWorkout", &HybridWorkoutProxySpec::getMetadataIndoorWorkout);
29
- prototype.registerHybridGetter("metadataAverageSpeed", &HybridWorkoutProxySpec::getMetadataAverageSpeed);
30
- prototype.registerHybridGetter("metadataMaximumSpeed", &HybridWorkoutProxySpec::getMetadataMaximumSpeed);
25
+ prototype.registerHybridGetter("metadata", &HybridWorkoutProxySpec::getMetadata);
31
26
  prototype.registerHybridGetter("sampleType", &HybridWorkoutProxySpec::getSampleType);
32
27
  prototype.registerHybridGetter("startDate", &HybridWorkoutProxySpec::getStartDate);
33
28
  prototype.registerHybridGetter("endDate", &HybridWorkoutProxySpec::getEndDate);
34
29
  prototype.registerHybridGetter("hasUndeterminedDuration", &HybridWorkoutProxySpec::getHasUndeterminedDuration);
35
- prototype.registerHybridGetter("metadataWeatherCondition", &HybridWorkoutProxySpec::getMetadataWeatherCondition);
36
- prototype.registerHybridGetter("metadataWeatherHumidity", &HybridWorkoutProxySpec::getMetadataWeatherHumidity);
37
- prototype.registerHybridGetter("metadataWeatherTemperature", &HybridWorkoutProxySpec::getMetadataWeatherTemperature);
38
- prototype.registerHybridGetter("metadataInsulinDeliveryReason", &HybridWorkoutProxySpec::getMetadataInsulinDeliveryReason);
39
- prototype.registerHybridGetter("metadataHeartRateMotionContext", &HybridWorkoutProxySpec::getMetadataHeartRateMotionContext);
40
30
  prototype.registerHybridGetter("uuid", &HybridWorkoutProxySpec::getUuid);
41
31
  prototype.registerHybridGetter("sourceRevision", &HybridWorkoutProxySpec::getSourceRevision);
42
32
  prototype.registerHybridGetter("device", &HybridWorkoutProxySpec::getDevice);
43
- prototype.registerHybridGetter("metadata", &HybridWorkoutProxySpec::getMetadata);
44
- prototype.registerHybridGetter("metadataExternalUUID", &HybridWorkoutProxySpec::getMetadataExternalUUID);
45
- prototype.registerHybridGetter("metadataTimeZone", &HybridWorkoutProxySpec::getMetadataTimeZone);
46
- prototype.registerHybridGetter("metadataWasUserEntered", &HybridWorkoutProxySpec::getMetadataWasUserEntered);
47
- prototype.registerHybridGetter("metadataDeviceSerialNumber", &HybridWorkoutProxySpec::getMetadataDeviceSerialNumber);
48
- prototype.registerHybridGetter("metadataUdiDeviceIdentifier", &HybridWorkoutProxySpec::getMetadataUdiDeviceIdentifier);
49
- prototype.registerHybridGetter("metadataUdiProductionIdentifier", &HybridWorkoutProxySpec::getMetadataUdiProductionIdentifier);
50
- prototype.registerHybridGetter("metadataDigitalSignature", &HybridWorkoutProxySpec::getMetadataDigitalSignature);
51
- prototype.registerHybridGetter("metadataDeviceName", &HybridWorkoutProxySpec::getMetadataDeviceName);
52
- prototype.registerHybridGetter("metadataDeviceManufacturerName", &HybridWorkoutProxySpec::getMetadataDeviceManufacturerName);
53
- prototype.registerHybridGetter("metadataSyncIdentifier", &HybridWorkoutProxySpec::getMetadataSyncIdentifier);
54
- prototype.registerHybridGetter("metadataSyncVersion", &HybridWorkoutProxySpec::getMetadataSyncVersion);
55
- prototype.registerHybridGetter("metadataWasTakenInLab", &HybridWorkoutProxySpec::getMetadataWasTakenInLab);
56
- prototype.registerHybridGetter("metadataReferenceRangeLowerLimit", &HybridWorkoutProxySpec::getMetadataReferenceRangeLowerLimit);
57
- prototype.registerHybridGetter("metadataReferenceRangeUpperLimit", &HybridWorkoutProxySpec::getMetadataReferenceRangeUpperLimit);
58
- prototype.registerHybridGetter("metadataAlgorithmVersion", &HybridWorkoutProxySpec::getMetadataAlgorithmVersion);
59
33
  prototype.registerHybridMethod("toJSON", &HybridWorkoutProxySpec::toJSON);
60
34
  prototype.registerHybridMethod("saveWorkoutRoute", &HybridWorkoutProxySpec::saveWorkoutRoute);
61
35
  prototype.registerHybridMethod("getWorkoutPlan", &HybridWorkoutProxySpec::getWorkoutPlan);
@@ -23,12 +23,6 @@ namespace margelo::nitro::healthkit { struct WorkoutEvent; }
23
23
  namespace margelo::nitro::healthkit { struct WorkoutActivity; }
24
24
  // Forward declaration of `SampleType` to properly resolve imports.
25
25
  namespace margelo::nitro::healthkit { struct SampleType; }
26
- // Forward declaration of `WeatherCondition` to properly resolve imports.
27
- namespace margelo::nitro::healthkit { enum class WeatherCondition; }
28
- // Forward declaration of `InsulinDeliveryReason` to properly resolve imports.
29
- namespace margelo::nitro::healthkit { enum class InsulinDeliveryReason; }
30
- // Forward declaration of `HeartRateMotionContext` to properly resolve imports.
31
- namespace margelo::nitro::healthkit { enum class HeartRateMotionContext; }
32
26
  // Forward declaration of `SourceRevision` to properly resolve imports.
33
27
  namespace margelo::nitro::healthkit { struct SourceRevision; }
34
28
  // Forward declaration of `Device` to properly resolve imports.
@@ -52,15 +46,12 @@ namespace margelo::nitro::healthkit { enum class QuantityTypeIdentifier; }
52
46
  #include "WorkoutEvent.hpp"
53
47
  #include <vector>
54
48
  #include "WorkoutActivity.hpp"
49
+ #include <NitroModules/AnyMap.hpp>
55
50
  #include "SampleType.hpp"
56
51
  #include <chrono>
57
- #include "WeatherCondition.hpp"
58
- #include "InsulinDeliveryReason.hpp"
59
- #include "HeartRateMotionContext.hpp"
60
52
  #include <string>
61
53
  #include "SourceRevision.hpp"
62
54
  #include "Device.hpp"
63
- #include <NitroModules/AnyMap.hpp>
64
55
  #include "WorkoutSample.hpp"
65
56
  #include <NitroModules/Promise.hpp>
66
57
  #include "LocationForSaving.hpp"
@@ -105,40 +96,14 @@ namespace margelo::nitro::healthkit {
105
96
  virtual std::optional<Quantity> getTotalFlightsClimbed() = 0;
106
97
  virtual std::optional<std::vector<WorkoutEvent>> getEvents() = 0;
107
98
  virtual std::optional<std::vector<WorkoutActivity>> getActivities() = 0;
108
- virtual std::optional<Quantity> getMetadataAverageMETs() = 0;
109
- virtual std::optional<Quantity> getMetadataElevationAscended() = 0;
110
- virtual std::optional<Quantity> getMetadataElevationDescended() = 0;
111
- virtual std::optional<bool> getMetadataIndoorWorkout() = 0;
112
- virtual std::optional<Quantity> getMetadataAverageSpeed() = 0;
113
- virtual std::optional<Quantity> getMetadataMaximumSpeed() = 0;
99
+ virtual std::shared_ptr<AnyMap> getMetadata() = 0;
114
100
  virtual SampleType getSampleType() = 0;
115
101
  virtual std::chrono::system_clock::time_point getStartDate() = 0;
116
102
  virtual std::chrono::system_clock::time_point getEndDate() = 0;
117
103
  virtual bool getHasUndeterminedDuration() = 0;
118
- virtual std::optional<WeatherCondition> getMetadataWeatherCondition() = 0;
119
- virtual std::optional<Quantity> getMetadataWeatherHumidity() = 0;
120
- virtual std::optional<Quantity> getMetadataWeatherTemperature() = 0;
121
- virtual std::optional<InsulinDeliveryReason> getMetadataInsulinDeliveryReason() = 0;
122
- virtual std::optional<HeartRateMotionContext> getMetadataHeartRateMotionContext() = 0;
123
104
  virtual std::string getUuid() = 0;
124
105
  virtual SourceRevision getSourceRevision() = 0;
125
106
  virtual std::optional<Device> getDevice() = 0;
126
- virtual std::shared_ptr<AnyMap> getMetadata() = 0;
127
- virtual std::optional<std::string> getMetadataExternalUUID() = 0;
128
- virtual std::optional<std::string> getMetadataTimeZone() = 0;
129
- virtual std::optional<bool> getMetadataWasUserEntered() = 0;
130
- virtual std::optional<std::string> getMetadataDeviceSerialNumber() = 0;
131
- virtual std::optional<std::string> getMetadataUdiDeviceIdentifier() = 0;
132
- virtual std::optional<std::string> getMetadataUdiProductionIdentifier() = 0;
133
- virtual std::optional<std::string> getMetadataDigitalSignature() = 0;
134
- virtual std::optional<std::string> getMetadataDeviceName() = 0;
135
- virtual std::optional<std::string> getMetadataDeviceManufacturerName() = 0;
136
- virtual std::optional<std::string> getMetadataSyncIdentifier() = 0;
137
- virtual std::optional<double> getMetadataSyncVersion() = 0;
138
- virtual std::optional<bool> getMetadataWasTakenInLab() = 0;
139
- virtual std::optional<double> getMetadataReferenceRangeLowerLimit() = 0;
140
- virtual std::optional<double> getMetadataReferenceRangeUpperLimit() = 0;
141
- virtual std::optional<double> getMetadataAlgorithmVersion() = 0;
142
107
 
143
108
  public:
144
109
  // Methods
@@ -34,14 +34,6 @@ namespace margelo::nitro::healthkit { enum class MedicationDoseEventScheduleType
34
34
  namespace margelo::nitro::healthkit { enum class MedicationDoseEventLogStatus; }
35
35
  // Forward declaration of `SampleType` to properly resolve imports.
36
36
  namespace margelo::nitro::healthkit { struct SampleType; }
37
- // Forward declaration of `WeatherCondition` to properly resolve imports.
38
- namespace margelo::nitro::healthkit { enum class WeatherCondition; }
39
- // Forward declaration of `Quantity` to properly resolve imports.
40
- namespace margelo::nitro::healthkit { struct Quantity; }
41
- // Forward declaration of `InsulinDeliveryReason` to properly resolve imports.
42
- namespace margelo::nitro::healthkit { enum class InsulinDeliveryReason; }
43
- // Forward declaration of `HeartRateMotionContext` to properly resolve imports.
44
- namespace margelo::nitro::healthkit { enum class HeartRateMotionContext; }
45
37
  // Forward declaration of `SourceRevision` to properly resolve imports.
46
38
  namespace margelo::nitro::healthkit { struct SourceRevision; }
47
39
  // Forward declaration of `Device` to properly resolve imports.
@@ -53,13 +45,9 @@ namespace margelo::nitro::healthkit { struct Device; }
53
45
  #include <chrono>
54
46
  #include "MedicationDoseEventLogStatus.hpp"
55
47
  #include "SampleType.hpp"
56
- #include "WeatherCondition.hpp"
57
- #include "Quantity.hpp"
58
- #include "InsulinDeliveryReason.hpp"
59
- #include "HeartRateMotionContext.hpp"
48
+ #include <NitroModules/AnyMap.hpp>
60
49
  #include "SourceRevision.hpp"
61
50
  #include "Device.hpp"
62
- #include <NitroModules/AnyMap.hpp>
63
51
 
64
52
  namespace margelo::nitro::healthkit {
65
53
 
@@ -80,34 +68,14 @@ namespace margelo::nitro::healthkit {
80
68
  std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
81
69
  std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
82
70
  bool hasUndeterminedDuration SWIFT_PRIVATE;
83
- std::optional<WeatherCondition> metadataWeatherCondition SWIFT_PRIVATE;
84
- std::optional<Quantity> metadataWeatherHumidity SWIFT_PRIVATE;
85
- std::optional<Quantity> metadataWeatherTemperature SWIFT_PRIVATE;
86
- std::optional<InsulinDeliveryReason> metadataInsulinDeliveryReason SWIFT_PRIVATE;
87
- std::optional<HeartRateMotionContext> metadataHeartRateMotionContext SWIFT_PRIVATE;
71
+ std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
88
72
  std::string uuid SWIFT_PRIVATE;
89
73
  SourceRevision sourceRevision SWIFT_PRIVATE;
90
74
  std::optional<Device> device SWIFT_PRIVATE;
91
- std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
92
- std::optional<std::string> metadataExternalUUID SWIFT_PRIVATE;
93
- std::optional<std::string> metadataTimeZone SWIFT_PRIVATE;
94
- std::optional<bool> metadataWasUserEntered SWIFT_PRIVATE;
95
- std::optional<std::string> metadataDeviceSerialNumber SWIFT_PRIVATE;
96
- std::optional<std::string> metadataUdiDeviceIdentifier SWIFT_PRIVATE;
97
- std::optional<std::string> metadataUdiProductionIdentifier SWIFT_PRIVATE;
98
- std::optional<std::string> metadataDigitalSignature SWIFT_PRIVATE;
99
- std::optional<std::string> metadataDeviceName SWIFT_PRIVATE;
100
- std::optional<std::string> metadataDeviceManufacturerName SWIFT_PRIVATE;
101
- std::optional<std::string> metadataSyncIdentifier SWIFT_PRIVATE;
102
- std::optional<double> metadataSyncVersion SWIFT_PRIVATE;
103
- std::optional<bool> metadataWasTakenInLab SWIFT_PRIVATE;
104
- std::optional<double> metadataReferenceRangeLowerLimit SWIFT_PRIVATE;
105
- std::optional<double> metadataReferenceRangeUpperLimit SWIFT_PRIVATE;
106
- std::optional<double> metadataAlgorithmVersion SWIFT_PRIVATE;
107
75
 
108
76
  public:
109
77
  MedicationDoseEvent() = default;
110
- explicit MedicationDoseEvent(MedicationDoseEventScheduleType scheduleType, std::string medicationConceptIdentifier, std::optional<std::string> medicationDisplayText, std::optional<std::chrono::system_clock::time_point> scheduledDate, std::optional<double> scheduledDoseQuantity, std::optional<double> doseQuantity, MedicationDoseEventLogStatus logStatus, std::string unit, SampleType sampleType, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, bool hasUndeterminedDuration, std::optional<WeatherCondition> metadataWeatherCondition, std::optional<Quantity> metadataWeatherHumidity, std::optional<Quantity> metadataWeatherTemperature, std::optional<InsulinDeliveryReason> metadataInsulinDeliveryReason, std::optional<HeartRateMotionContext> metadataHeartRateMotionContext, std::string uuid, SourceRevision sourceRevision, std::optional<Device> device, std::shared_ptr<AnyMap> metadata, std::optional<std::string> metadataExternalUUID, std::optional<std::string> metadataTimeZone, std::optional<bool> metadataWasUserEntered, std::optional<std::string> metadataDeviceSerialNumber, std::optional<std::string> metadataUdiDeviceIdentifier, std::optional<std::string> metadataUdiProductionIdentifier, std::optional<std::string> metadataDigitalSignature, std::optional<std::string> metadataDeviceName, std::optional<std::string> metadataDeviceManufacturerName, std::optional<std::string> metadataSyncIdentifier, std::optional<double> metadataSyncVersion, std::optional<bool> metadataWasTakenInLab, std::optional<double> metadataReferenceRangeLowerLimit, std::optional<double> metadataReferenceRangeUpperLimit, std::optional<double> metadataAlgorithmVersion): scheduleType(scheduleType), medicationConceptIdentifier(medicationConceptIdentifier), medicationDisplayText(medicationDisplayText), scheduledDate(scheduledDate), scheduledDoseQuantity(scheduledDoseQuantity), doseQuantity(doseQuantity), logStatus(logStatus), unit(unit), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), metadataWeatherCondition(metadataWeatherCondition), metadataWeatherHumidity(metadataWeatherHumidity), metadataWeatherTemperature(metadataWeatherTemperature), metadataInsulinDeliveryReason(metadataInsulinDeliveryReason), metadataHeartRateMotionContext(metadataHeartRateMotionContext), uuid(uuid), sourceRevision(sourceRevision), device(device), metadata(metadata), metadataExternalUUID(metadataExternalUUID), metadataTimeZone(metadataTimeZone), metadataWasUserEntered(metadataWasUserEntered), metadataDeviceSerialNumber(metadataDeviceSerialNumber), metadataUdiDeviceIdentifier(metadataUdiDeviceIdentifier), metadataUdiProductionIdentifier(metadataUdiProductionIdentifier), metadataDigitalSignature(metadataDigitalSignature), metadataDeviceName(metadataDeviceName), metadataDeviceManufacturerName(metadataDeviceManufacturerName), metadataSyncIdentifier(metadataSyncIdentifier), metadataSyncVersion(metadataSyncVersion), metadataWasTakenInLab(metadataWasTakenInLab), metadataReferenceRangeLowerLimit(metadataReferenceRangeLowerLimit), metadataReferenceRangeUpperLimit(metadataReferenceRangeUpperLimit), metadataAlgorithmVersion(metadataAlgorithmVersion) {}
78
+ explicit MedicationDoseEvent(MedicationDoseEventScheduleType scheduleType, std::string medicationConceptIdentifier, std::optional<std::string> medicationDisplayText, std::optional<std::chrono::system_clock::time_point> scheduledDate, std::optional<double> scheduledDoseQuantity, std::optional<double> doseQuantity, MedicationDoseEventLogStatus logStatus, std::string unit, SampleType sampleType, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, bool hasUndeterminedDuration, std::shared_ptr<AnyMap> metadata, std::string uuid, SourceRevision sourceRevision, std::optional<Device> device): scheduleType(scheduleType), medicationConceptIdentifier(medicationConceptIdentifier), medicationDisplayText(medicationDisplayText), scheduledDate(scheduledDate), scheduledDoseQuantity(scheduledDoseQuantity), doseQuantity(doseQuantity), logStatus(logStatus), unit(unit), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), metadata(metadata), uuid(uuid), sourceRevision(sourceRevision), device(device) {}
111
79
 
112
80
  public:
113
81
  friend bool operator==(const MedicationDoseEvent& lhs, const MedicationDoseEvent& rhs) = default;
@@ -135,30 +103,10 @@ namespace margelo::nitro {
135
103
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
136
104
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
137
105
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"))),
138
- JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition"))),
139
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity"))),
140
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature"))),
141
- JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason"))),
142
- JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext"))),
106
+ JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
143
107
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid"))),
144
108
  JSIConverter<margelo::nitro::healthkit::SourceRevision>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"))),
145
- JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device"))),
146
- JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
147
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID"))),
148
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone"))),
149
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered"))),
150
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber"))),
151
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier"))),
152
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier"))),
153
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature"))),
154
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName"))),
155
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName"))),
156
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier"))),
157
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion"))),
158
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab"))),
159
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit"))),
160
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit"))),
161
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion")))
109
+ JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))
162
110
  );
163
111
  }
164
112
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::MedicationDoseEvent& arg) {
@@ -175,30 +123,10 @@ namespace margelo::nitro {
175
123
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
176
124
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
177
125
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"), JSIConverter<bool>::toJSI(runtime, arg.hasUndeterminedDuration));
178
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition"), JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::toJSI(runtime, arg.metadataWeatherCondition));
179
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherHumidity));
180
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherTemperature));
181
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason"), JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::toJSI(runtime, arg.metadataInsulinDeliveryReason));
182
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext"), JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::toJSI(runtime, arg.metadataHeartRateMotionContext));
126
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
183
127
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "uuid"), JSIConverter<std::string>::toJSI(runtime, arg.uuid));
184
128
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"), JSIConverter<margelo::nitro::healthkit::SourceRevision>::toJSI(runtime, arg.sourceRevision));
185
129
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "device"), JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
186
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
187
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataExternalUUID));
188
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataTimeZone));
189
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasUserEntered));
190
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceSerialNumber));
191
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiDeviceIdentifier));
192
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiProductionIdentifier));
193
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDigitalSignature));
194
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceName));
195
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceManufacturerName));
196
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataSyncIdentifier));
197
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataSyncVersion));
198
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasTakenInLab));
199
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeLowerLimit));
200
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeUpperLimit));
201
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataAlgorithmVersion));
202
130
  return obj;
203
131
  }
204
132
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -221,30 +149,10 @@ namespace margelo::nitro {
221
149
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
222
150
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
223
151
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration")))) return false;
224
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition")))) return false;
225
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity")))) return false;
226
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature")))) return false;
227
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason")))) return false;
228
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext")))) return false;
152
+ if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
229
153
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid")))) return false;
230
154
  if (!JSIConverter<margelo::nitro::healthkit::SourceRevision>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision")))) return false;
231
155
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))) return false;
232
- if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
233
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID")))) return false;
234
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone")))) return false;
235
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered")))) return false;
236
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber")))) return false;
237
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier")))) return false;
238
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier")))) return false;
239
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature")))) return false;
240
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName")))) return false;
241
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName")))) return false;
242
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier")))) return false;
243
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion")))) return false;
244
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab")))) return false;
245
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit")))) return false;
246
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit")))) return false;
247
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion")))) return false;
248
156
  return true;
249
157
  }
250
158
  };